mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 02:54:41 +01:00
Migrate /obj/item/assembly to the new attack chain. (#31987)
* Migrate /obj/item/assembly to the new attack chain. * Migrate more procs. * Add parent calls to activate_self(). * Add parent call to activate_self() in noise sensor. * Apply CRUNCH's style suggestions. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan <alfalfascout@users.noreply.github.com> * Change igniter attack to interact_with_atom(). * Restore assembly UIs. * Ensure assembly interact procs fire, ensure fingerprints. --------- 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:
@@ -13,6 +13,7 @@
|
||||
usesound = 'sound/items/deconstruct.ogg'
|
||||
drop_sound = 'sound/items/handling/component_drop.ogg'
|
||||
pickup_sound = 'sound/items/handling/component_pickup.ogg'
|
||||
new_attack_chain = TRUE
|
||||
|
||||
var/bomb_name = "bomb" // used for naming bombs / mines
|
||||
|
||||
@@ -34,8 +35,9 @@
|
||||
/obj/item/assembly/proc/holder_movement()
|
||||
return
|
||||
|
||||
/// Called when attack_self is called
|
||||
/// Called when activate_self is called
|
||||
/obj/item/assembly/interact(mob/user)
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/on_atom_entered(datum/source, atom/movable/entered)
|
||||
@@ -130,14 +132,13 @@
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/attackby__legacy__attackchain(obj/item/W, mob/user, params)
|
||||
if(isassembly(W))
|
||||
var/obj/item/assembly/A = W
|
||||
if(!A.secured && !secured)
|
||||
attach_assembly(A, user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
/obj/item/assembly/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(!isassembly(used))
|
||||
return ..()
|
||||
var/obj/item/assembly/A = used
|
||||
if(!A.secured && !secured)
|
||||
attach_assembly(A, user)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/item/assembly/screwdriver_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
@@ -159,9 +160,9 @@
|
||||
else
|
||||
. += "[src] can be attached!"
|
||||
|
||||
/obj/item/assembly/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/assembly/activate_self(mob/user)
|
||||
if(!user)
|
||||
return
|
||||
return ..()
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return TRUE
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
@@ -162,13 +162,13 @@
|
||||
if(istype(a_left, a_right.type)) // If they are the same type it causes issues due to window code
|
||||
switch(tgui_alert(user, "Which side would you like to use?", "Choose", list("Left", "Right")))
|
||||
if("Left")
|
||||
a_left.attack_self__legacy__attackchain(user)
|
||||
a_left.activate_self(user)
|
||||
if("Right")
|
||||
a_right.attack_self__legacy__attackchain(user)
|
||||
a_right.activate_self(user)
|
||||
return
|
||||
else
|
||||
a_left.attack_self__legacy__attackchain(user)
|
||||
a_right.attack_self__legacy__attackchain(user)
|
||||
a_left.activate_self(user)
|
||||
a_right.activate_self(user)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
|
||||
@@ -70,7 +70,8 @@
|
||||
user_health = null // Clear out the user data, we're no longer scanning
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/health/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/assembly/health/activate_self(mob/user)
|
||||
. = ..()
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/assembly/health/ui_state(mob/user)
|
||||
|
||||
@@ -57,9 +57,10 @@
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/igniter/attack__legacy__attackchain(mob/living/target, mob/living/user)
|
||||
/obj/item/assembly/igniter/interact_with_atom(mob/living/target, mob/living/user, list/modifiers)
|
||||
if(!cigarette_lighter_act(user, target))
|
||||
return ..()
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/item/assembly/igniter/cigarette_lighter_act(mob/living/user, mob/living/target, obj/item/direct_attackby_item)
|
||||
var/obj/item/clothing/mask/cigarette/cig = ..()
|
||||
@@ -82,10 +83,10 @@
|
||||
cig.light(user, target)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/igniter/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/assembly/igniter/activate_self(mob/user)
|
||||
. = ..()
|
||||
if(!istype(loc, /obj/item/assembly_holder))
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/item/assembly/igniter/get_heat()
|
||||
return 2000
|
||||
|
||||
@@ -146,6 +146,7 @@
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "infra")
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/infra/Topic(href, href_list)
|
||||
..()
|
||||
@@ -166,7 +167,7 @@
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
if(usr)
|
||||
attack_self__legacy__attackchain(usr)
|
||||
activate_self(usr)
|
||||
|
||||
/obj/item/assembly/infra/AltClick(mob/user)
|
||||
rotate(user)
|
||||
|
||||
@@ -77,7 +77,8 @@
|
||||
update_icon()
|
||||
pulse(0)
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_self__legacy__attackchain(mob/living/user)
|
||||
/obj/item/assembly/mousetrap/activate_self(mob/living/user)
|
||||
. = ..()
|
||||
if(!armed)
|
||||
to_chat(user, SPAN_NOTICE("You arm [src]."))
|
||||
else
|
||||
@@ -97,16 +98,17 @@
|
||||
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, TRUE, -3)
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_hand(mob/living/user)
|
||||
if(armed)
|
||||
if((user.getBrainLoss() >= 60 || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
if(!armed)
|
||||
return ..()
|
||||
if(!((user.getBrainLoss() >= 60 || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50)))
|
||||
return ..()
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
|
||||
triggered(user, which_hand)
|
||||
user.visible_message(SPAN_WARNING("[user] accidentally sets off [src], breaking [user.p_their()] fingers."), SPAN_WARNING("You accidentally trigger [src]!"))
|
||||
|
||||
triggered(user, which_hand)
|
||||
user.visible_message(SPAN_WARNING("[user] accidentally sets off [src], breaking [user.p_their()] fingers."), SPAN_WARNING("You accidentally trigger [src]!"))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/assembly/mousetrap/on_atom_entered(datum/source, atom/movable/entered)
|
||||
if(armed)
|
||||
@@ -128,7 +130,7 @@
|
||||
if(armed)
|
||||
finder.visible_message(SPAN_WARNING("[finder] accidentally sets off [src], breaking [finder.p_their()] fingers."), SPAN_WARNING("You accidentally trigger [src]!"))
|
||||
triggered(finder, finder.hand ? "l_hand" : "r_hand")
|
||||
return TRUE //end the search!
|
||||
return TRUE // End the search!
|
||||
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
return FALSE
|
||||
cooldown = 2
|
||||
pulse(FALSE)
|
||||
visible_message("[bicon(src)] *beep* *beep* *beep*", "*beep* *beep* *beep*")
|
||||
audible_message("[bicon(src)] *beep* *beep* *beep*", "*beep* *beep* *beep*")
|
||||
playsound(src, 'sound/machines/triple_beep.ogg', 40, extrarange = -10)
|
||||
addtimer(CALLBACK(src, PROC_REF(process_cooldown)), 10)
|
||||
|
||||
@@ -157,6 +157,7 @@
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "prox")
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/prox_sensor/Topic(href, href_list)
|
||||
..()
|
||||
@@ -182,4 +183,4 @@
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self__legacy__attackchain(usr)
|
||||
activate_self(usr)
|
||||
|
||||
@@ -34,11 +34,14 @@
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/shock_kit/attack_self__legacy__attackchain(mob/user as mob)
|
||||
/obj/item/assembly/shock_kit/activate_self(mob/user)
|
||||
if(!user)
|
||||
return ..()
|
||||
if(!part1 || !part2)
|
||||
return
|
||||
part1.activate_self(user)
|
||||
part2.attack_self__legacy__attackchain(user, status)
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/shock_kit/proc/shock_invoke()
|
||||
if(istype(loc, /obj/structure/chair/e_chair))
|
||||
|
||||
@@ -32,14 +32,16 @@ GLOBAL_LIST_EMPTY(remote_signalers)
|
||||
to_chat(user, SPAN_NOTICE("You activate [src]."))
|
||||
activate()
|
||||
|
||||
/obj/item/assembly/signaler/attackby__legacy__attackchain(obj/item/W, mob/user, params)
|
||||
if(issignaler(W))
|
||||
var/obj/item/assembly/signaler/signaler2 = W
|
||||
if(secured && signaler2.secured)
|
||||
code = signaler2.code
|
||||
frequency = signaler2.frequency
|
||||
to_chat(user, "You transfer the frequency and code to [src].")
|
||||
return ..()
|
||||
/obj/item/assembly/signaler/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(!issignaler(used))
|
||||
return ..()
|
||||
var/obj/item/assembly/signaler/signaler2 = used
|
||||
if(!secured || !signaler2.secured)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
code = signaler2.code
|
||||
frequency = signaler2.frequency
|
||||
to_chat(user, "You transfer the frequency and code to [src].")
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/// Called from activate(), actually invokes the signal on other signallers in the world
|
||||
/obj/item/assembly/signaler/proc/signal()
|
||||
@@ -58,7 +60,7 @@ GLOBAL_LIST_EMPTY(remote_signalers)
|
||||
|
||||
/obj/item/assembly/signaler/proc/signal_callback()
|
||||
pulse(1)
|
||||
visible_message("[bicon(src)] *beep* *beep* *beep*")
|
||||
audible_message("[bicon(src)] *beep* *beep* *beep*")
|
||||
playsound(src, 'sound/machines/triple_beep.ogg', 40, extrarange = -10)
|
||||
|
||||
// Activation pre-runner, handles cooldown and calls signal(), invoked from ui_act()
|
||||
@@ -74,7 +76,8 @@ GLOBAL_LIST_EMPTY(remote_signalers)
|
||||
|
||||
// UI STUFF //
|
||||
|
||||
/obj/item/assembly/signaler/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/assembly/signaler/activate_self(mob/user)
|
||||
. = ..()
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/assembly/signaler/ui_state(mob/user)
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
cooldown = 2
|
||||
pulse(FALSE)
|
||||
if(loc)
|
||||
loc.visible_message("[bicon(src)] *beep* *beep* *beep*", "*beep* *beep* *beep*")
|
||||
loc.audible_message("[bicon(src)] *beep* *beep* *beep*", "*beep* *beep* *beep*")
|
||||
playsound(src, 'sound/machines/triple_beep.ogg', 40, extrarange = -10)
|
||||
addtimer(CALLBACK(src, PROC_REF(process_cooldown)), 10)
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/timer/interact(mob/user as mob)//TODO: Have this use the wires
|
||||
/obj/item/assembly/timer/interact(mob/user)//TODO: Have this use the wires
|
||||
if(!secured)
|
||||
user.show_message(SPAN_WARNING("[src] is unsecured!"))
|
||||
return FALSE
|
||||
@@ -92,6 +92,7 @@
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "timer")
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/timer/Topic(href, href_list)
|
||||
..()
|
||||
@@ -125,4 +126,4 @@
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self__legacy__attackchain(usr)
|
||||
activate_self(usr)
|
||||
|
||||
@@ -45,14 +45,15 @@
|
||||
return ..() // previously this toggled listning when not in a holder, that's a little silly. It was only called in attack_self that way.
|
||||
|
||||
|
||||
/obj/item/assembly/voice/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/assembly/voice/activate_self(mob/user)
|
||||
. = ..()
|
||||
if(!user || !secured)
|
||||
return FALSE
|
||||
|
||||
listening = !listening
|
||||
var/turf/T = get_turf(src)
|
||||
T.visible_message("[bicon(src)] beeps, \"[listening ? "Now" : "No longer"] recording input.\"")
|
||||
return TRUE
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
|
||||
/obj/item/assembly/voice/toggle_secure()
|
||||
@@ -65,7 +66,10 @@
|
||||
materials = list(MAT_METAL = 210, MAT_GLASS = 50)
|
||||
bomb_name = "noise-activated bomb"
|
||||
|
||||
/obj/item/assembly/voice/noise/attack_self__legacy__attackchain(mob/user)
|
||||
/obj/item/assembly/voice/noise/activate_self(mob/user)
|
||||
if(!user)
|
||||
return ..()
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/voice/noise/examine(mob/user)
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
var/obj/effect/anomaly/A = loc
|
||||
A.anomalyNeutralize()
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/attack_self__legacy__attackchain()
|
||||
/obj/item/assembly/signaler/anomaly/activate_self(mob/user)
|
||||
if(!user)
|
||||
return ..()
|
||||
return
|
||||
|
||||
//Anomaly cores
|
||||
|
||||
Reference in New Issue
Block a user