mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 11:07:12 +01:00
Migrate transfer valve, assembly holder, and chem grenade to the new attack chain. (#32262)
* Add transfer valve to the new attack chain. * Apply suggestions from CRUNCH review Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan <alfalfascout@users.noreply.github.com> * Update assembly messages, migrate assembly holder and chem grenade. * Fix onetankbomb gas analysis. --------- Signed-off-by: Alan <alfalfascout@users.noreply.github.com> Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
///if the icon_state for the TTV's tank is in assemblies.dmi
|
||||
/// If the icon_state for the TTV's tank is in `assemblies.dmi`.
|
||||
#define TTV_TANK_ICON_STATES list("anesthetic", "emergency", "emergency_double", "emergency_engi", "emergency_sleep", "jetpack", "jetpack_black", "jetpack_void", "oxygen", "oxygen_f", "oxygen_fr", "plasma")
|
||||
|
||||
/obj/item/transfer_valve
|
||||
@@ -14,6 +14,7 @@
|
||||
var/valve_open = FALSE
|
||||
var/toggle = TRUE
|
||||
origin_tech = "materials=1;engineering=1"
|
||||
new_attack_chain = TRUE
|
||||
|
||||
/obj/item/transfer_valve/Destroy()
|
||||
QDEL_NULL(tank_one)
|
||||
@@ -23,52 +24,58 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/transfer_valve/IsAssemblyHolder()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/transfer_valve/attackby__legacy__attackchain(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/tank))
|
||||
/obj/item/transfer_valve/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(istype(used, /obj/item/tank))
|
||||
if(tank_one && tank_two)
|
||||
to_chat(user, SPAN_WARNING("There are already two tanks attached, remove one first."))
|
||||
return
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
if(!tank_one)
|
||||
if(!user.transfer_item_to(I, src))
|
||||
return
|
||||
tank_one = I
|
||||
if(!user.transfer_item_to(used, src))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
tank_one = used
|
||||
to_chat(user, SPAN_NOTICE("You attach the tank to the transfer valve."))
|
||||
if(I.w_class > w_class)
|
||||
w_class = I.w_class
|
||||
if(used.w_class > w_class)
|
||||
w_class = used.w_class
|
||||
else if(!tank_two)
|
||||
if(!user.transfer_item_to(I, src))
|
||||
return
|
||||
tank_two = I
|
||||
if(!user.transfer_item_to(used, src))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
tank_two = used
|
||||
to_chat(user, SPAN_NOTICE("You attach the tank to the transfer valve."))
|
||||
if(I.w_class > w_class)
|
||||
w_class = I.w_class
|
||||
if(used.w_class > w_class)
|
||||
w_class = used.w_class
|
||||
|
||||
update_icon()
|
||||
SStgui.update_uis(src) // update all UIs attached to src
|
||||
//TODO: Have this take an assemblyholder
|
||||
else if(isassembly(I))
|
||||
var/obj/item/assembly/A = I
|
||||
if(A.secured)
|
||||
to_chat(user, SPAN_NOTICE("The device is secured."))
|
||||
return
|
||||
if(attached_device)
|
||||
to_chat(user, SPAN_WARNING("There is already a device attached to the valve, remove it first."))
|
||||
return
|
||||
if(!user.transfer_item_to(A, src))
|
||||
return
|
||||
attached_device = A
|
||||
to_chat(user, SPAN_NOTICE("You attach [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).
|
||||
SStgui.update_uis(src) // Update all UIs attached to src.
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
investigate_log("[key_name(user)] attached a [A] to a transfer valve.", INVESTIGATE_BOMB)
|
||||
add_attack_logs(user, src, "attached [A] to a transfer valve", ATKLOG_FEW)
|
||||
log_game("[key_name_admin(user)] attached [A] to a transfer valve.")
|
||||
attacher = user
|
||||
SStgui.update_uis(src) // update all UIs attached to src
|
||||
//TODO: Have this take an assemblyholder
|
||||
if(!isassembly(used))
|
||||
return ..()
|
||||
|
||||
var/obj/item/assembly/assembly = used
|
||||
if(assembly.secured)
|
||||
to_chat(user, SPAN_WARNING("[assembly] is secured and cannot be attached! Loosen it with a screwdriver."))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
if(attached_device)
|
||||
to_chat(user, SPAN_WARNING("There is already a [attached_device.name] attached to the valve, remove it first!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
if(!user.transfer_item_to(assembly, src))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
attached_device = assembly
|
||||
to_chat(user, SPAN_NOTICE("You attach [assembly] to the valve controls and secure it."))
|
||||
assembly.holder = src
|
||||
assembly.toggle_secure() // This calls `update_icon()`, which calls `update_icon()` on the holder (i.e. the bomb).
|
||||
|
||||
investigate_log("[key_name(user)] attached a [assembly] to a transfer valve.", INVESTIGATE_BOMB)
|
||||
add_attack_logs(user, src, "attached [assembly] to a transfer valve", ATKLOG_FEW)
|
||||
log_game("[key_name_admin(user)] attached [assembly] to a transfer valve.")
|
||||
attacher = user
|
||||
SStgui.update_uis(src) // Update all UIs attached to src.
|
||||
add_fingerprint(user)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
|
||||
/obj/item/transfer_valve/HasProximity(atom/movable/AM)
|
||||
@@ -86,8 +93,12 @@
|
||||
for(var/obj/O in contents)
|
||||
O.hear_message(M, msg)
|
||||
|
||||
/obj/item/transfer_valve/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/transfer_valve/activate_self(mob/user)
|
||||
if(..())
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
ui_interact(user)
|
||||
add_fingerprint(user)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/item/transfer_valve/ui_state(mob/user)
|
||||
return GLOB.inventory_state
|
||||
@@ -106,8 +117,6 @@
|
||||
data["valve"] = valve_open
|
||||
return data
|
||||
|
||||
|
||||
|
||||
/obj/item/transfer_valve/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
@@ -148,7 +157,6 @@
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
|
||||
|
||||
/obj/item/transfer_valve/proc/process_activation(obj/item/D)
|
||||
if(toggle)
|
||||
toggle = FALSE
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
. = ..()
|
||||
display_timer = (stage == READY && !nadeassembly) //show/hide the timer based on assembly state
|
||||
|
||||
|
||||
|
||||
/obj/item/grenade/chem_grenade/proc/get_trigger()
|
||||
if(!nadeassembly) return null
|
||||
for(var/obj/O in list(nadeassembly.a_left, nadeassembly.a_right))
|
||||
@@ -102,7 +100,7 @@
|
||||
var/turf/bombturf = get_turf(src)
|
||||
var/area/A = get_area(bombturf)
|
||||
if(nadeassembly)
|
||||
nadeassembly.attack_self__legacy__attackchain(user)
|
||||
nadeassembly.activate_self(user)
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
else if(clown_check(user))
|
||||
// This used to go before the assembly check, but that has absolutely zero to do with priming the damn thing. You could spam the admins with it.
|
||||
|
||||
Reference in New Issue
Block a user