Files
Leland KembleandGitHub 06608081d2 Moves a greater manyer morer things from attackby() to item_interaction() (#96739)
## About The Pull Request

50 files, plus additonal file that was necessary because I slightly
refactored windoor construction. This ended up like three and a half
times larger than most of the other ones, I really wasn't meaning for
that to happen. Maybe its because I more vigorously enforced the empty
line after every return thing. The only way to find out is to read 1700
lines of changes, and I don't feel like doing that again. I pinky
promise it all works, and I've tested every item changed individually.

Changes beyond conversion:
You can't welder down reinforced falsewalls anymore, pretty sure it was
an oversight because they're supposed to be taken down by wirecutters
You can right click to close gun lockers with an empty hand, because
otherwise you can't close the lockers at all if there's a gun in them
Meatspikes no longer runtime on construction due to the old trick of
balloon alert + qdel
Windoor assembly no longer SUCKS DICK!!, it's no longer storing
essentially a boolean in an undocumented number in a string, it no
longer requires a VERB to flip its direction.
on a related note, the creator of the windoor assembly construction
steps has been sent to live on a farm far out in the country

Also, a quick note about how these prs are gonna fuck everything up
until they're all together. There's a lot more places where `attackby()`
is directly called than I would have assumed, and given as those are
being changed to call `item_interaction()` potentially(usually) in a
different pr than the pr in which that atom's `attackby()` is actually
converted, that function's not going to work at all until both are
merged. The good news is that almost every instance this is happening,
it's pure convenience, where the user would have access to both items
anyway and could just manually call the attack chain by clicking them
together. Instances where this is not the case are being skipped over
until they can be packaged together to avoid the issue, but I'm not
bothering to do this on ones where the desync won't make an interaction
actually unusable, because that would require me to turn a 1700 line pr
into a 3500 line pr and I really was aiming for like 500

## Why It's Good For The Game

Ignore the paragraph about how I expect this to create a hostage
situation where the only fix to the bugs I make is to merge my other
prs, and instead think about how cool swing combat would be and how much
you want it

## Changelog
🆑
fix: you now can only use a wirecutter to take down a reinforced
falsewall
fix: meatspikes no longer runtime on construction
fix: you no longer have to use a verb that you can't use to flip windoor
assemblies

qol: you can right click a gun locker to close it

code: 50 files have been moved from attackby() to item_interaction()
/🆑
2026-07-16 15:07:43 +02:00

160 lines
4.4 KiB
Plaintext

/**
* Shower Curtains
*/
/obj/structure/curtain
name = "curtain"
desc = "Contains less than 1% mercury."
icon = 'icons/obj/watercloset.dmi'
icon_state = "bathroom-open"
color = "#ACD1E9" //Default color, didn't bother hardcoding other colors, mappers can and should easily change it.
alpha = 200 //Mappers can also just set this to 255 if they want curtains that can't be seen through
layer = SIGN_LAYER
anchored = TRUE
opacity = FALSE
density = FALSE
custom_materials = list(/datum/material/plastic = SHEET_MATERIAL_AMOUNT * 2, /datum/material/iron = HALF_SHEET_MATERIAL_AMOUNT)
/// used in making the icon state
var/icon_type = "bathroom"
var/open = TRUE
/// if it can be seen through when closed
var/opaque_closed = FALSE
/obj/structure/curtain/Initialize(mapload)
// see-through curtains should let emissives shine through
if(!opaque_closed)
blocks_emissive = EMISSIVE_BLOCK_NONE
. = ..()
ADD_TRAIT(src, TRAIT_INVERTED_DEMOLITION, INNATE_TRAIT)
/obj/structure/curtain/proc/toggle()
open = !open
if(open)
layer = SIGN_LAYER
set_opacity(FALSE)
else
layer = WALL_OBJ_LAYER
if(opaque_closed)
set_opacity(TRUE)
update_appearance()
/obj/structure/curtain/update_icon_state()
icon_state = "[icon_type]-[open ? "open" : "closed"]"
return ..()
/obj/structure/curtain/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!istype(tool, /obj/item/toy/crayon))
return NONE
color = tgui_color_picker(user, "", "Choose Color", color)
return ITEM_INTERACT_SUCCESS
/obj/structure/curtain/wrench_act(mob/living/user, obj/item/tool)
. = ..()
default_unfasten_wrench(user, tool, time = 5 SECONDS)
return TRUE
/obj/structure/curtain/wirecutter_act(mob/living/user, obj/item/I)
..()
if(anchored)
return TRUE
user.visible_message(span_warning("[user] cuts apart [src]."),
span_notice("You start to cut apart [src]."), span_hear("You hear cutting."))
if(I.use_tool(src, user, 50, volume=100) && !anchored)
to_chat(user, span_notice("You cut apart [src]."))
deconstruct()
return TRUE
/obj/structure/curtain/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
return
playsound(loc, 'sound/effects/curtain.ogg', 50, TRUE)
toggle()
/obj/structure/curtain/atom_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)
/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/items/weapons/slash.ogg', 80, TRUE)
else
playsound(loc, 'sound/items/weapons/tap.ogg', 50, TRUE)
if(BURN)
playsound(loc, 'sound/items/tools/welder.ogg', 80, TRUE)
/obj/structure/curtain/bounty
icon_type = "bounty"
icon_state = "bounty-open"
color = null
alpha = 255
opaque_closed = TRUE
/obj/structure/curtain/bounty/start_closed
icon_state = "bounty-closed"
/obj/structure/curtain/bounty/start_closed/Initialize(mapload)
. = ..()
if(open)
toggle()
/obj/structure/curtain/cloth
color = null
alpha = 255
opaque_closed = TRUE
custom_materials = list(/datum/material/iron = HALF_SHEET_MATERIAL_AMOUNT)
/obj/structure/curtain/cloth/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/cloth (loc, 4)
new /obj/item/stack/rods (loc)
/obj/structure/curtain/cloth/fancy
icon_type = "cur_fancy"
icon_state = "cur_fancy-open"
/obj/structure/curtain/cloth/fancy/mechanical
var/id = null
/obj/structure/curtain/cloth/fancy/mechanical/Destroy()
GLOB.curtains -= src
return ..()
/obj/structure/curtain/cloth/fancy/mechanical/Initialize(mapload)
. = ..()
GLOB.curtains += src
/obj/structure/curtain/cloth/fancy/mechanical/connect_to_shuttle(mapload, obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
id = "[port.shuttle_id]_[id]"
/obj/structure/curtain/cloth/fancy/mechanical/proc/open()
icon_state = "[icon_type]-open"
layer = SIGN_LAYER
SET_PLANE_IMPLICIT(src, GAME_PLANE)
set_density(FALSE)
open = TRUE
set_opacity(FALSE)
/obj/structure/curtain/cloth/fancy/mechanical/proc/close()
icon_state = "[icon_type]-closed"
layer = WALL_OBJ_LAYER
set_density(TRUE)
open = FALSE
if(opaque_closed)
set_opacity(TRUE)
/obj/structure/curtain/cloth/fancy/mechanical/attack_hand(mob/user, list/modifiers)
return
/obj/structure/curtain/cloth/fancy/mechanical/start_closed
icon_state = "cur_fancy-closed"
/obj/structure/curtain/cloth/fancy/mechanical/start_closed/Initialize(mapload)
. = ..()
close()