Files
Paradise/code/game/objects/structures/crates_lockers/largecrate.dm
T
warriorstar-orionandGitHub 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

122 lines
3.2 KiB
Plaintext

/obj/structure/largecrate
name = "large crate"
desc = "A hefty wooden crate."
icon = 'icons/obj/crates.dmi'
icon_state = "largecrate"
density = TRUE
var/obj/item/paper/manifest/manifest
/obj/structure/largecrate/Initialize(mapload)
. = ..()
update_icon()
/obj/structure/largecrate/update_overlays()
. = ..()
if(manifest)
. += "manifest"
/obj/structure/largecrate/attack_hand(mob/user as mob)
if(manifest)
to_chat(user, "<span class='notice'>You tear the manifest off of the crate.</span>")
playsound(src.loc, 'sound/items/poster_ripped.ogg', 75, 1)
manifest.forceMove(loc)
if(ishuman(user))
user.put_in_hands(manifest)
manifest = null
update_icon()
return
else
to_chat(user, "<span class='notice'>You need a crowbar to pry this open!</span>")
return
/obj/structure/largecrate/attackby__legacy__attackchain(obj/item/W as obj, mob/user as mob, params)
if(user.a_intent != INTENT_HARM)
attack_hand(user)
else
return ..()
/obj/structure/largecrate/crowbar_act(mob/living/user, obj/item/I)
. = TRUE
if(manifest)
manifest.forceMove(loc)
manifest = null
update_icon()
new /obj/item/stack/sheet/wood(src)
var/turf/T = get_turf(src)
for(var/O in contents)
var/atom/movable/A = O
A.forceMove(T)
user.visible_message("<span class='notice'>[user] pries [src] open.</span>", \
"<span class='notice'>You pry open [src].</span>", \
"<span class='notice'>You hear splitting wood.</span>")
qdel(src)
/obj/structure/largecrate/Destroy()
var/turf/src_turf = get_turf(src)
for(var/obj/O in contents)
O.forceMove(src_turf)
return ..()
/obj/structure/largecrate/mule
/obj/structure/largecrate/lisa
icon_state = "lisacrate"
/obj/structure/largecrate/lisa/crowbar_act(mob/living/user, obj/item/I)
if(!I.use_tool(src, user, I.tool_volume))
return
new /mob/living/simple_animal/pet/dog/corgi/lisa(loc)
return ..()
/obj/structure/largecrate/cow
name = "cow crate"
icon_state = "lisacrate"
/obj/structure/largecrate/cow/crowbar_act(mob/living/user, obj/item/I)
if(!I.use_tool(src, user, I.tool_volume))
return
new /mob/living/simple_animal/cow(loc)
return ..()
/obj/structure/largecrate/goat
name = "goat crate"
icon_state = "lisacrate"
/obj/structure/largecrate/goat/crowbar_act(mob/living/user, obj/item/I)
if(!I.use_tool(src, user, I.tool_volume))
return
new /mob/living/simple_animal/hostile/retaliate/goat(loc)
return ..()
/obj/structure/largecrate/chick
name = "chicken crate"
icon_state = "lisacrate"
/obj/structure/largecrate/chick/crowbar_act(mob/living/user, obj/item/I)
if(!I.use_tool(src, user, I.tool_volume))
return
var/num = rand(4, 6)
for(var/i in 1 to num)
new /mob/living/simple_animal/chick(loc)
return ..()
/obj/structure/largecrate/cat
name = "cat crate"
icon_state = "lisacrate"
/obj/structure/largecrate/cat/crowbar_act(mob/living/user, obj/item/I)
if(!I.use_tool(src, user, I.tool_volume))
return
new /mob/living/simple_animal/pet/cat(loc)
return ..()
/obj/structure/largecrate/secway
name = "secway crate"
/obj/structure/largecrate/secway/crowbar_act(mob/living/user, obj/item/I)
if(!I.use_tool(src, user, I.tool_volume))
return
new /obj/vehicle/secway(loc)
new /obj/item/key/security(loc)
return ..()