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
+1 -1
View File
@@ -398,7 +398,7 @@
return FALSE
return TRUE
/obj/item/mod/module/anomaly_locked/attackby(obj/item/item, mob/living/user, params)
/obj/item/mod/module/anomaly_locked/attackby__legacy__attackchain(obj/item/item, mob/living/user, params)
if(item.type in accepted_anomalies)
if(core)
to_chat(user, "<span class='warning'>A core is already installed!</span>")
@@ -31,7 +31,7 @@
else
. += "<span class='warning'>The implant is missing.</span>"
/obj/item/mod/module/pathfinder/attack(mob/living/target, mob/living/user, params)
/obj/item/mod/module/pathfinder/attack__legacy__attackchain(mob/living/target, mob/living/user, params)
if(!ishuman(target) || !implant)
return
if(!do_after(user, 1.5 SECONDS, target = target))
+2 -2
View File
@@ -287,7 +287,7 @@
RegisterSignal(mod.wearer, COMSIG_LIVING_MOB_BUMP, PROC_REF(unstealth))
RegisterSignal(mod.wearer, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, PROC_REF(on_unarmed_attack))
RegisterSignal(mod.wearer, COMSIG_ATOM_BULLET_ACT, PROC_REF(on_bullet_act))
RegisterSignals(mod.wearer, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_PARENT_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW), PROC_REF(unstealth))
RegisterSignals(mod.wearer, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_ATTACK_BY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW), PROC_REF(unstealth))
mod.wearer.set_alpha_tracking(stealth_alpha, src, update_alpha = FALSE)
animate(mod.wearer, alpha = mod.wearer.get_alpha(), time = 1.5 SECONDS)
drain_power(use_power_cost)
@@ -298,7 +298,7 @@
return
if(bumpoff)
UnregisterSignal(mod.wearer, COMSIG_LIVING_MOB_BUMP)
UnregisterSignal(mod.wearer, list(COMSIG_HUMAN_MELEE_UNARMED_ATTACK, COMSIG_MOB_ITEM_ATTACK, COMSIG_PARENT_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW))
UnregisterSignal(mod.wearer, list(COMSIG_HUMAN_MELEE_UNARMED_ATTACK, COMSIG_MOB_ITEM_ATTACK, COMSIG_ATTACK_BY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW))
mod.wearer.set_alpha_tracking(ALPHA_VISIBLE, src, update_alpha = FALSE)
animate(mod.wearer, alpha = mod.wearer.get_alpha(), time = 1.5 SECONDS)
@@ -188,7 +188,7 @@
var/metal_synthesis_charge = 5
COOLDOWN_DECLARE(nanofrost_cooldown)
/obj/item/extinguisher/mini/mod/attack_self(mob/user)
/obj/item/extinguisher/mini/mod/attack_self__legacy__attackchain(mob/user)
switch(nozzle_mode)
if(EXTINGUISHER)
nozzle_mode = NANOFROST
@@ -220,7 +220,7 @@
if(METAL_FOAM)
. += "<span class='notice'>[src] is currently set to metal foam mode.</span>"
/obj/item/extinguisher/mini/mod/afterattack(atom/target, mob/user)
/obj/item/extinguisher/mini/mod/afterattack__legacy__attackchain(atom/target, mob/user)
var/is_adjacent = user.Adjacent(target)
if(is_adjacent && AttemptRefill(target, user))
return
+1 -1
View File
@@ -122,7 +122,7 @@
desc = "A high-power stamp, able to switch between accept and deny mode when used."
flags = NODROP
/obj/item/stamp/mod/attack_self(mob/user, modifiers)
/obj/item/stamp/mod/attack_self__legacy__attackchain(mob/user, modifiers)
. = ..()
if(icon_state == "stamp-ok")
icon_state = "stamp-deny"
+6 -6
View File
@@ -66,7 +66,7 @@
if(!.)
return
var/obj/item/grenade/mirage/grenade = .
grenade.attack_self(mod.wearer)
grenade.attack_self__legacy__attackchain(mod.wearer)
/obj/item/grenade/mirage
name = "mirage grenade"
@@ -81,7 +81,7 @@
thrower = null
return ..()
/obj/item/grenade/mirage/attack_self(mob/user)
/obj/item/grenade/mirage/attack_self__legacy__attackchain(mob/user)
. = ..()
thrower = user
@@ -191,7 +191,7 @@
playsound(src, 'sound/machines/click.ogg', 100, TRUE)
drain_power(use_power_cost)
var/obj/item/grenade/grenade = dispensed
grenade.attack_self(mod.wearer)
grenade.attack_self__legacy__attackchain(mod.wearer)
return grenade
/obj/item/mod/module/anomaly_locked/firewall/prebuilt
@@ -245,7 +245,7 @@
playsound(src, 'sound/machines/click.ogg', 100, TRUE)
drain_power(use_power_cost)
var/obj/item/grenade/grenade = dispensed
grenade.attack_self(mod.wearer)
grenade.attack_self__legacy__attackchain(mod.wearer)
return grenade
/obj/item/mod/module/anomaly_locked/cryogrenade/prebuilt
@@ -270,7 +270,7 @@
thrower = null
return ..()
/obj/item/grenade/cryogrenade_mod/attack_self(mob/user)
/obj/item/grenade/cryogrenade_mod/attack_self__legacy__attackchain(mob/user)
. = ..()
thrower = user
@@ -304,4 +304,4 @@
var/obj/item/grenade/smokebomb/grenade = ..()
if(!grenade)
return
grenade.attack_self(mod.wearer)
grenade.attack_self__legacy__attackchain(mod.wearer)