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

151 lines
3.9 KiB
Plaintext

//Chain link fences
//Sprites ported from /VG/
#define CUT_TIME 100
#define CLIMB_TIME 150
#define NO_HOLE 0 //section is intact
#define MEDIUM_HOLE 1 //medium hole in the section - can climb through
#define LARGE_HOLE 2 //large hole in the section - can walk through
#define MAX_HOLE_SIZE LARGE_HOLE
/obj/structure/fence
name = "fence"
desc = "A chain link fence. Not as effective as a wall, but generally it keeps people out."
density = TRUE
anchored = TRUE
icon = 'icons/obj/fence.dmi'
icon_state = "straight"
tacmap_color = TACMAP_FENCE
var/cuttable = TRUE
var/hole_size= NO_HOLE
var/invulnerable = FALSE
/obj/structure/fence/Initialize(mapload)
. = ..()
update_cut_status()
/obj/structure/fence/examine(mob/user)
. = ..()
switch(hole_size)
if(MEDIUM_HOLE)
. += "There is a large hole in \the [src]."
if(LARGE_HOLE)
. += "\The [src] has been completely cut through."
/obj/structure/fence/end
icon_state = "end"
cuttable = FALSE
/obj/structure/fence/corner
icon_state = "corner"
cuttable = FALSE
/obj/structure/fence/post
icon_state = "post"
cuttable = FALSE
/obj/structure/fence/cut/medium
icon_state = "straight_cut2"
hole_size = MEDIUM_HOLE
/obj/structure/fence/cut/large
icon_state = "straight_cut3"
hole_size = LARGE_HOLE
/obj/structure/fence/wirecutter_act(mob/living/user, obj/item/tool)
if(!cuttable)
to_chat(user, span_warning("This section of the fence can't be cut!"))
return ITEM_INTERACT_BLOCKING
if(invulnerable)
to_chat(user, span_warning("This fence is too strong to cut through!"))
return ITEM_INTERACT_BLOCKING
var/current_stage = hole_size
if(current_stage >= MAX_HOLE_SIZE)
to_chat(user, span_warning("This fence has too much cut out of it already!"))
return ITEM_INTERACT_BLOCKING
user.visible_message(span_danger("\The [user] starts cutting through \the [src] with \the [tool]."),\
span_danger("You start cutting through \the [src] with \the [tool]."))
if(!tool.use_tool(src, user, CUT_TIME))
return ITEM_INTERACT_BLOCKING
if(current_stage != hole_size)
return ITEM_INTERACT_BLOCKING
switch(++hole_size)
if(MEDIUM_HOLE)
visible_message(span_notice("\The [user] cuts into \the [src] some more."))
to_chat(user, span_info("You could probably fit yourself through that hole now. Although climbing through would be much faster if you made it even bigger."))
AddElement(/datum/element/climbable)
if(LARGE_HOLE)
visible_message(span_notice("\The [user] completely cuts through \the [src]."))
to_chat(user, span_info("The hole in \the [src] is now big enough to walk through."))
RemoveElement(/datum/element/climbable)
update_cut_status()
return ITEM_INTERACT_SUCCESS
/obj/structure/fence/proc/update_cut_status()
if(!cuttable)
return
var/new_density = TRUE
switch(hole_size)
if(NO_HOLE)
icon_state = initial(icon_state)
if(MEDIUM_HOLE)
icon_state = "straight_cut2"
if(LARGE_HOLE)
icon_state = "straight_cut3"
new_density = FALSE
set_density(new_density)
//FENCE DOORS
/obj/structure/fence/door
name = "fence door"
desc = "Not very useful without a real lock."
icon_state = "door_closed"
cuttable = FALSE
/obj/structure/fence/door/Initialize(mapload)
. = ..()
update_icon_state()
/obj/structure/fence/door/opened
icon_state = "door_opened"
density = FALSE
/obj/structure/fence/door/attack_hand(mob/user, list/modifiers)
if(can_open(user))
toggle(user)
return TRUE
/obj/structure/fence/door/proc/toggle(mob/user)
visible_message(span_notice("\The [user] [density ? "opens" : "closes"] \the [src]."))
set_density(!density)
update_icon_state()
playsound(src, 'sound/machines/click.ogg', 100, TRUE)
/obj/structure/fence/door/update_icon_state()
icon_state = density ? "door_closed" : "door_opened"
return ..()
/obj/structure/fence/door/proc/can_open(mob/user)
return TRUE
#undef CUT_TIME
#undef CLIMB_TIME
#undef NO_HOLE
#undef MEDIUM_HOLE
#undef LARGE_HOLE
#undef MAX_HOLE_SIZE