Attack chain, initial setup. (pull *immediately* for *any* TM issues) (#26834)

* refactor: Attack chain, initial setup.

* migrate curtain to make dreamchecker happy

* update thurible

* don't call attacked_by separately for legacy attack chain

* remove duplicate proc

* condense similar code, put allowances for legacy code in new procs

* update docs, include diagram source

* add comment on how to update diagram

* fix admonition

* mindflayer updates

* remove commented out code

* clarify all steps

* after_attack should be overridable

* whoops

* retrofit recent changes

* duh, can't restrict this yet because of tool_acts

* i hate ore bags with the fire of a thousand suns

* return correct value for object attack logic

* Various cleanups.

We don't want to attempt to pull stuff out of `/obj/item/attackby`,
because those pieces are part of the related objects' migrations, not
`/obj/item` itself. Attempting to do this causes knockon effects where
things expected to call e.g. `/obj/item/storage/attackby` in the call
chain were not ferried over to the new item interaction code, because
the related objects hadn't actually been migrated over yet.

I've used refactoring /obj/vehicle as the example for migrating
`attackby` methods instead.

* simplify some argument names

* fuck it

* make it do the thing

* Rename CI module call

* Prove that CI works

* improve test output

* aaand fix it again

* fix curtain tool interactions

* fix compile error

* fix compile error

* Better docs, introduce migration plan tool.
This commit is contained in:
warriorstar-orion
2024-12-02 23:36:36 +00:00
committed by GitHub
parent e9e16645e1
commit 525c68d617
724 changed files with 4266 additions and 1862 deletions
+2 -2
View File
@@ -99,7 +99,7 @@
return TRUE
return FALSE
/obj/item/assembly/attackby(obj/item/W, mob/user, params)
/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)
@@ -128,7 +128,7 @@
else
. += "[src] can be attached!"
/obj/item/assembly/attack_self(mob/user)
/obj/item/assembly/attack_self__legacy__attackchain(mob/user)
if(!user)
return
user.set_machine(src)
+5 -5
View File
@@ -153,7 +153,7 @@
to_chat(user, "<span class='notice'>[src] can now be taken apart!</span>")
update_icon()
/obj/item/assembly_holder/attack_self(mob/user)
/obj/item/assembly_holder/attack_self__legacy__attackchain(mob/user)
add_fingerprint(user)
if(secured)
if(!a_left || !a_right)
@@ -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(user)
a_left.attack_self__legacy__attackchain(user)
if("Right")
a_right.attack_self(user)
a_right.attack_self__legacy__attackchain(user)
return
else
a_left.attack_self(user)
a_right.attack_self(user)
a_left.attack_self__legacy__attackchain(user)
a_right.attack_self__legacy__attackchain(user)
else
var/turf/T = get_turf(src)
if(!T)
+4 -4
View File
@@ -27,9 +27,9 @@
. += bombassembly.overlays
. += "bomb_assembly"
/obj/item/onetankbomb/attackby(obj/item/W, mob/user, params)
/obj/item/onetankbomb/attackby__legacy__attackchain(obj/item/W, mob/user, params)
if(istype(W, /obj/item/analyzer))
bombtank.attackby(W, user, params)
bombtank.attackby__legacy__attackchain(W, user, params)
return
return ..()
@@ -65,8 +65,8 @@
to_chat(user, "<span class='notice'>The hole has been closed.</span>")
/obj/item/onetankbomb/attack_self(mob/user) //pressing the bomb accesses its assembly
bombassembly.attack_self(user, 1)
/obj/item/onetankbomb/attack_self__legacy__attackchain(mob/user) //pressing the bomb accesses its assembly
bombassembly.attack_self__legacy__attackchain(user, 1)
add_fingerprint(user)
return
+1 -1
View File
@@ -70,7 +70,7 @@
user_health = null // Clear out the user data, we're no longer scanning
STOP_PROCESSING(SSobj, src)
/obj/item/assembly/health/attack_self(mob/user)
/obj/item/assembly/health/attack_self__legacy__attackchain(mob/user)
ui_interact(user)
/obj/item/assembly/health/ui_state(mob/user)
+2 -2
View File
@@ -57,7 +57,7 @@
return TRUE
/obj/item/assembly/igniter/attack(mob/living/target, mob/living/user)
/obj/item/assembly/igniter/attack__legacy__attackchain(mob/living/target, mob/living/user)
if(!cigarette_lighter_act(user, target))
return ..()
@@ -82,7 +82,7 @@
cig.light(user, target)
return TRUE
/obj/item/assembly/igniter/attack_self(mob/user)
/obj/item/assembly/igniter/attack_self__legacy__attackchain(mob/user)
if(!istype(loc, /obj/item/assembly_holder))
activate()
add_fingerprint(user)
+1 -1
View File
@@ -166,7 +166,7 @@
usr << browse(null, "window=infra")
return
if(usr)
attack_self(usr)
attack_self__legacy__attackchain(usr)
/obj/item/assembly/infra/AltClick(mob/user)
rotate(user)
+1 -1
View File
@@ -77,7 +77,7 @@
update_icon()
pulse(0)
/obj/item/assembly/mousetrap/attack_self(mob/living/user)
/obj/item/assembly/mousetrap/attack_self__legacy__attackchain(mob/living/user)
if(!armed)
to_chat(user, "<span class='notice'>You arm [src].</span>")
else
+1 -1
View File
@@ -137,4 +137,4 @@
return
if(usr)
attack_self(usr)
attack_self__legacy__attackchain(usr)
+3 -3
View File
@@ -35,9 +35,9 @@
add_fingerprint(user)
return TRUE
/obj/item/assembly/shock_kit/attack_self(mob/user as mob)
part1.attack_self(user, status)
part2.attack_self(user, status)
/obj/item/assembly/shock_kit/attack_self__legacy__attackchain(mob/user as mob)
part1.attack_self__legacy__attackchain(user, status)
part2.attack_self__legacy__attackchain(user, status)
add_fingerprint(user)
return
+2 -2
View File
@@ -34,7 +34,7 @@ GLOBAL_LIST_EMPTY(remote_signalers)
to_chat(user, "<span class='notice'>You activate [src].</span>")
activate()
/obj/item/assembly/signaler/attackby(obj/item/W, mob/user, params)
/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)
@@ -76,7 +76,7 @@ GLOBAL_LIST_EMPTY(remote_signalers)
// UI STUFF //
/obj/item/assembly/signaler/attack_self(mob/user)
/obj/item/assembly/signaler/attack_self__legacy__attackchain(mob/user)
ui_interact(user)
/obj/item/assembly/signaler/ui_state(mob/user)
+1 -1
View File
@@ -126,4 +126,4 @@
return
if(usr)
attack_self(usr)
attack_self__legacy__attackchain(usr)
+2 -2
View File
@@ -46,7 +46,7 @@
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(mob/user)
/obj/item/assembly/voice/attack_self__legacy__attackchain(mob/user)
if(!user || !secured)
return FALSE
@@ -68,7 +68,7 @@
origin_tech = "magnets=1;engineering=1"
bomb_name = "noise-activated bomb"
/obj/item/assembly/voice/noise/attack_self(mob/user)
/obj/item/assembly/voice/noise/attack_self__legacy__attackchain(mob/user)
return
/obj/item/assembly/voice/noise/examine(mob/user)