Files
Paradise/code/game/objects/structures/target_stake.dm
warriorstar-orion 525c68d617 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.
2024-12-02 23:36:36 +00:00

55 lines
1.5 KiB
Plaintext

// Basically they are for the firing range
/obj/structure/target_stake
name = "target stake"
desc = "A thin platform with negatively-magnetized wheels."
icon = 'icons/obj/objects.dmi'
icon_state = "target_stake"
density = TRUE
flags = CONDUCT
var/obj/item/target/pinned_target // the current pinned target
/obj/structure/target_stake/Destroy()
QDEL_NULL(pinned_target)
return ..()
/obj/structure/target_stake/Move()
. = ..()
// Move the pinned target along with the stake
if(pinned_target in view(3, src))
pinned_target.loc = loc
else // Sanity check: if the pinned target can't be found in immediate view
pinned_target = null
density = TRUE
/obj/structure/target_stake/attackby__legacy__attackchain(obj/item/W, mob/user, params)
// Putting objects on the stake. Most importantly, targets
if(istype(W, /obj/item/target) && !pinned_target)
density = FALSE
W.density = TRUE
user.drop_item(src)
W.loc = loc
W.layer = 3.1
pinned_target = W
to_chat(user, "You slide the target into the stake.")
return
return ..()
/obj/structure/target_stake/attack_hand(mob/user)
// taking pinned targets off!
if(pinned_target)
density = TRUE
pinned_target.density = FALSE
pinned_target.layer = OBJ_LAYER
pinned_target.loc = user.loc
if(ishuman(user))
if(!user.get_active_hand())
user.put_in_hands(pinned_target)
to_chat(user, "You take the target out of the stake.")
else
pinned_target.loc = get_turf(user)
to_chat(user, "You take the target out of the stake.")
pinned_target = null