Files
Leland KembleandGitHub d6f14fe29d Moves an amount up to interpretation of things from attackby() to item_interaction() (#96757)
## About The Pull Request

Thirty files changed, one's not really changed, one's actually just a
copy of a change from a different pr, because for the sake of pipe
cleaners I decided to change the base turf. Probably wasn't a good idea.
This one contains the full set of `/turf/` `attackby()`s(besides those
meant for attacks), converted all at once because the tree of turf
subtypes looks a lot more like a spire than a bush.

Changes beyond conversion:
I added messaging for when you're crowbarring transit tube pods out of
the tubes because I genuinely wasted half an hour trying to figure out
what I'd done wrong in conversion because they don't look any different
so I thought it wasn't working.

If you're reinforcing plating and the plating is reinforced
mid-reinforcement you will no longer waste your plasteel reinforcing the
reinforced plating.


## Why It's Good For The Game

what are we at, ~120? I was expecting this to be a lot more drawn out,
but most of them are really small. I'm gonna have to do a final pass of
calls to `attackby()` once the dust settles, but the end of non-attack
`attackby()`s is just a week away.
2026-07-15 17:37:00 -05:00

69 lines
2.2 KiB
Plaintext

/obj/structure/closet/crate/bin
desc = "A trash bin, place your trash here for the janitor to collect."
name = "trash bin"
icon_state = "trashbin"
base_icon_state = "trashbin"
open_sound = 'sound/effects/bin/bin_open.ogg'
close_sound = 'sound/effects/bin/bin_close.ogg'
anchored = TRUE
horizontal = FALSE
delivery_icon = null
can_install_electronics = FALSE
paint_jobs = null
elevation = 17
elevation_open = 17
can_weld_shut = FALSE
/obj/structure/closet/crate/bin/LateInitialize()
. = ..()
update_appearance(UPDATE_ICON)
var/static/list/loc_connections = list(
COMSIG_TURF_RECEIVE_SWEEPED_ITEMS = PROC_REF(ready_for_trash),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/closet/crate/bin/update_overlays()
. = ..()
. += emissive_appearance(icon, base_icon_state + "_empty", src, alpha = src.alpha)
if(contents.len == 0)
. += base_icon_state + "_empty"
return
if(contents.len >= storage_capacity)
. += base_icon_state + "_full"
return
. += base_icon_state + "_some"
/obj/structure/closet/crate/bin/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!istype(tool, /obj/item/storage/bag/trash) || !opened)
return ..()
var/obj/item/storage/bag/trash/garbage_bag = tool
to_chat(user, span_notice("You fill the bag."))
for(var/obj/item/garbage in src)
garbage_bag.atom_storage?.attempt_insert(garbage, user, TRUE)
do_animate()
return ITEM_INTERACT_SUCCESS
/obj/structure/closet/crate/bin/proc/do_animate()
playsound(loc, open_sound, 15, TRUE, -3)
flick(base_icon_state + "_animate", src)
addtimer(CALLBACK(src, PROC_REF(do_close)), 1.1 SECONDS)
/obj/structure/closet/crate/bin/proc/do_close()
playsound(loc, close_sound, 15, TRUE, -3)
update_appearance()
///Called when a push broom is trying to sweep items onto the turf this object is standing on. Garbage will be moved inside.
/obj/structure/closet/crate/bin/proc/ready_for_trash(datum/source, obj/item/pushbroom/broom, mob/user, list/items_to_sweep)
SIGNAL_HANDLER
if(!items_to_sweep || !opened)
return
for (var/obj/item/garbage in items_to_sweep)
garbage.forceMove(loc)
items_to_sweep.Cut()
to_chat(user, span_notice("You sweep the pile of garbage into [src]."))
playsound(broom.loc, 'sound/items/weapons/thudswoosh.ogg', 30, TRUE, -1)