diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm
index f126910bcbb..ba62169b886 100644
--- a/code/game/objects/items/devices/transfer_valve.dm
+++ b/code/game/objects/items/devices/transfer_valve.dm
@@ -2,11 +2,12 @@
icon = 'icons/obj/assemblies.dmi'
name = "tank transfer valve"
icon_state = "valve_1"
+ item_state = "ttv"
desc = "Regulates the transfer of air between two tanks"
- var/obj/item/weapon/tank/tank_one
- var/obj/item/weapon/tank/tank_two
- var/obj/item/device/attached_device
- var/mob/attacher = null
+ var/obj/item/weapon/tank/tank_one = null
+ var/obj/item/weapon/tank/tank_two = null
+ var/obj/item/device/assembly/attached_device = null
+ var/mob/living/attacher = null
var/valve_open = 0
var/toggle = 1
origin_tech = "materials=1;engineering=1"
@@ -21,75 +22,79 @@
if(attached_device)
qdel(attached_device)
attached_device = null
+ attacher = null
return ..()
-/obj/item/device/transfer_valve/proc/process_activation(var/obj/item/device/D)
-
/obj/item/device/transfer_valve/IsAssemblyHolder()
return 1
-/obj/item/device/transfer_valve/attackby(obj/item/item, mob/user, params)
- if(istype(item, /obj/item/weapon/tank))
+/obj/item/device/transfer_valve/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/weapon/tank))
if(tank_one && tank_two)
to_chat(user, "There are already two tanks attached, remove one first.")
return
if(!tank_one)
- tank_one = item
- user.drop_item()
- item.loc = src
+ if(!user.unEquip(I))
+ return
+ tank_one = I
+ I.forceMove(src)
to_chat(user, "You attach the tank to the transfer valve.")
+ if(I.w_class > w_class)
+ w_class = I.w_class
else if(!tank_two)
- tank_two = item
- user.drop_item()
- item.loc = src
+ if(!user.unEquip(I))
+ return
+ tank_two = I
+ I.forceMove(src)
to_chat(user, "You attach the tank to the transfer valve.")
+ if(I.w_class > w_class)
+ w_class = I.w_class
update_icon()
nanomanager.update_uis(src) // update all UIs attached to src
//TODO: Have this take an assemblyholder
- else if(isassembly(item))
- var/obj/item/device/assembly/A = item
+ else if(isassembly(I))
+ var/obj/item/device/assembly/A = I
if(A.secured)
to_chat(user, "The device is secured.")
return
if(attached_device)
to_chat(user, "There is already a device attached to the valve, remove it first.")
return
- user.remove_from_mob(item)
+ user.remove_from_mob(A)
attached_device = A
- A.loc = src
- to_chat(user, "You attach the [item] to the valve controls and secure it.")
+ A.forceMove(src)
+ to_chat(user, "You attach the [A] to the valve controls and secure it.")
A.holder = src
A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb).
- bombers += "[key_name(user)] attached a [item] to a transfer valve."
- msg_admin_attack("[key_name_admin(user)]attached [item] to a transfer valve.")
- log_game("[key_name_admin(user)] attached [item] to a transfer valve.")
+ bombers += "[key_name(user)] attached a [A] to a transfer valve."
+ msg_admin_attack("[key_name_admin(user)]attached [A] to a transfer valve.")
+ log_game("[key_name_admin(user)] attached [A] to a transfer valve.")
attacher = user
nanomanager.update_uis(src) // update all UIs attached to src
- return
-/obj/item/device/transfer_valve/HasProximity(atom/movable/AM as mob|obj)
- if(!attached_device) return
+/obj/item/device/transfer_valve/HasProximity(atom/movable/AM)
+ if(!attached_device)
+ return
attached_device.HasProximity(AM)
- return
-/obj/item/device/transfer_valve/hear_talk(mob/living/M as mob, msg)
+/obj/item/device/transfer_valve/hear_talk(mob/living/M, msg)
..()
for(var/obj/O in contents)
O.hear_talk(M, msg)
-/obj/item/device/transfer_valve/hear_message(mob/living/M as mob, msg)
+/obj/item/device/transfer_valve/hear_message(mob/living/M, msg)
..()
for(var/obj/O in contents)
O.hear_message(M, msg)
-/obj/item/device/transfer_valve/attack_self(mob/user as mob)
+/obj/item/device/transfer_valve/attack_self(mob/user)
ui_interact(user)
-/obj/item/device/transfer_valve/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
+/obj/item/device/transfer_valve/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
// update the ui if it exists, returns null if no ui is passed/found
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
@@ -113,36 +118,40 @@
/obj/item/device/transfer_valve/Topic(href, href_list)
..()
- if( usr.stat || usr.restrained() )
+ if(usr.incapacitated())
return 0
- if(src.loc != usr)
+ if(loc != usr)
return 0
if(tank_one && href_list["tankone"])
split_gases()
valve_open = 0
- tank_one.loc = get_turf(src)
+ tank_one.forceMove(get_turf(src))
tank_one = null
update_icon()
+ if((!tank_two || tank_two.w_class < 4) && (w_class > 3))
+ w_class = 3
else if(tank_two && href_list["tanktwo"])
split_gases()
valve_open = 0
- tank_two.loc = get_turf(src)
+ tank_two.forceMove(get_turf(src))
tank_two = null
update_icon()
+ if((!tank_one || tank_one.w_class < 4) && (w_class > 3))
+ w_class = 3
else if(href_list["open"])
toggle_valve()
else if(attached_device)
if(href_list["rem_device"])
- attached_device.loc = get_turf(src)
- attached_device:holder = null
+ attached_device.forceMove(get_turf(src))
+ attached_device.holder = null
attached_device = null
update_icon()
if(href_list["device"])
attached_device.attack_self(usr)
- src.add_fingerprint(usr)
+ add_fingerprint(usr)
return 1 // Returning 1 sends an update to attached UIs
-/obj/item/device/transfer_valve/process_activation(var/obj/item/device/D)
+/obj/item/device/transfer_valve/proc/process_activation(obj/item/device/D)
if(toggle)
toggle = 0
toggle_valve()
@@ -188,7 +197,7 @@
*/
/obj/item/device/transfer_valve/proc/toggle_valve()
- if(valve_open==0 && (tank_one && tank_two))
+ if(!valve_open && tank_one && tank_two)
valve_open = 1
var/turf/bombturf = get_turf(src)
var/area/A = get_area(bombturf)
@@ -206,17 +215,12 @@
log_game("Bomb valve opened at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z]) with [attached_device ? attached_device : "no device"], attached by [attacher_name]. Last touched by: [key_name(mob)]")
merge_gases()
spawn(20) // In case one tank bursts
- for(var/i=0,i<5,i++)
- src.update_icon()
+ for(var/i in 1 to 5)
+ update_icon()
sleep(10)
- src.update_icon()
+ update_icon()
- else if(valve_open==1 && (tank_one && tank_two))
+ else if(valve_open && tank_one && tank_two)
split_gases()
valve_open = 0
- src.update_icon()
-
-// this doesn't do anything but the timer etc. expects it to be here
-// eventually maybe have it update icon to show state (timer, prox etc.) like old bombs
-/obj/item/device/transfer_valve/proc/c_state()
- return
+ update_icon()
\ No newline at end of file
diff --git a/icons/mob/inhands/items_lefthand.dmi b/icons/mob/inhands/items_lefthand.dmi
index 3a6701fab2d..cecb8427e84 100644
Binary files a/icons/mob/inhands/items_lefthand.dmi and b/icons/mob/inhands/items_lefthand.dmi differ
diff --git a/icons/mob/inhands/items_righthand.dmi b/icons/mob/inhands/items_righthand.dmi
index 634e23d2f8f..fe42152fb5f 100644
Binary files a/icons/mob/inhands/items_righthand.dmi and b/icons/mob/inhands/items_righthand.dmi differ