Files
Paradise/code/game/objects/structures/curtains.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

107 lines
3.0 KiB
Plaintext

#define SHOWER_OPEN_LAYER OBJ_LAYER + 0.4
#define SHOWER_CLOSED_LAYER MOB_LAYER + 0.1
/obj/structure/curtain
icon = 'icons/obj/curtain.dmi'
name = "curtain"
icon_state = "closed"
face_while_pulling = FALSE
layer = SHOWER_CLOSED_LAYER
opacity = TRUE
density = FALSE
new_attack_chain = TRUE
/obj/structure/curtain/open
icon_state = "open"
layer = SHOWER_OPEN_LAYER
opacity = FALSE
/obj/structure/curtain/attack_hand(mob/user)
playsound(get_turf(loc), "rustle", 15, TRUE, -5)
toggle()
..()
/obj/structure/curtain/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
if(BRUTE)
if(damage_amount)
playsound(src.loc, 'sound/weapons/slash.ogg', 80, TRUE)
else
playsound(loc, 'sound/weapons/tap.ogg', 50, TRUE)
if(BURN)
playsound(loc, 'sound/items/welder.ogg', 80, TRUE)
/obj/structure/curtain/proc/toggle()
set_opacity(!opacity)
if(opacity)
icon_state = "closed"
layer = SHOWER_CLOSED_LAYER
else
icon_state = "open"
layer = SHOWER_OPEN_LAYER
/obj/structure/curtain/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/toy/crayon))
color = tgui_input_color(user,"Please choose a color.", "Curtain Color")
return ITEM_INTERACT_SUCCESS
/obj/structure/curtain/screwdriver_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_start_check(src, user, 0))
return
if(anchored)
user.visible_message("<span class='warning'>[user] unscrews [src] from the floor.</span>", "<span class='notice'>You start to unscrew [src] from the floor...</span>", "You hear rustling noises.")
if(I.use_tool(src, user, 50, volume = I.tool_volume) && anchored)
anchored = FALSE
to_chat(user, "<span class='notice'>You unscrew [src] from the floor.</span>")
else
user.visible_message("<span class='warning'>[user] screws [src] to the floor.</span>", "<span class='notice'>You start to screw [src] to the floor...</span>", "You hear rustling noises.")
if(I.use_tool(src, user, 50, volume = I.tool_volume) && !anchored)
anchored = TRUE
to_chat(user, "<span class='notice'>You screw [src] to the floor.</span>")
/obj/structure/curtain/wirecutter_act(mob/user, obj/item/I)
if(anchored)
return
. = TRUE
if(!I.tool_start_check(src, user, 0))
return
WIRECUTTER_ATTEMPT_DISMANTLE_MESSAGE
if(I.use_tool(src, user, 50, volume = I.tool_volume))
WIRECUTTER_DISMANTLE_SUCCESS_MESSAGE
deconstruct()
/obj/structure/curtain/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/cloth(loc, 2)
new /obj/item/stack/sheet/plastic(loc, 2)
new /obj/item/stack/rods(loc, 1)
qdel(src)
/obj/structure/curtain/black
name = "black curtain"
color = "#222222"
/obj/structure/curtain/medical
name = "plastic curtain"
color = "#B8F5E3"
alpha = 200
/obj/structure/curtain/open/shower
name = "shower curtain"
color = "#ACD1E9"
alpha = 200
/obj/structure/curtain/open/shower/engineering
color = "#FFA500"
/obj/structure/curtain/open/shower/security
color = "#AA0000"
/obj/structure/curtain/open/shower/centcom
color = "#000066"
#undef SHOWER_OPEN_LAYER
#undef SHOWER_CLOSED_LAYER