Files
Bubberstation/code/game/objects/structures/tank_dispenser.dm
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

107 lines
3.2 KiB
Plaintext

#define TANK_DISPENSER_CAPACITY 10
/obj/structure/tank_dispenser
name = "tank dispenser"
desc = "A simple yet bulky storage device for gas tanks."
icon = 'icons/obj/structures.dmi'
icon_state = "dispenser"
density = TRUE
anchored = TRUE
max_integrity = 300
var/oxygentanks = TANK_DISPENSER_CAPACITY
var/plasmatanks = TANK_DISPENSER_CAPACITY
/obj/structure/tank_dispenser/oxygen
plasmatanks = 0
/obj/structure/tank_dispenser/plasma
oxygentanks = 0
/obj/structure/tank_dispenser/Initialize(mapload)
. = ..()
AddElement(/datum/element/contextual_screentip_bare_hands, lmb_text = "Take Plasma Tank", rmb_text = "Take Oxygen Tank")
update_appearance()
/obj/structure/tank_dispenser/update_overlays()
. = ..()
switch(oxygentanks)
if(1 to 3)
. += "oxygen-[oxygentanks]"
if(4 to TANK_DISPENSER_CAPACITY)
. += "oxygen-4"
switch(plasmatanks)
if(1 to 4)
. += "plasma-[plasmatanks]"
if(5 to TANK_DISPENSER_CAPACITY)
. += "plasma-5"
/obj/structure/tank_dispenser/attack_hand(mob/living/user, list/modifiers)
. = ..()
if (!plasmatanks)
balloon_alert(user, "no plasma tanks!")
return
dispense(/obj/item/tank/internals/plasma, user)
plasmatanks--
update_appearance()
/obj/structure/tank_dispenser/attack_hand_secondary(mob/user, list/modifiers)
. = ..()
if (!oxygentanks)
balloon_alert(user, "no oxygen tanks!")
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
dispense(/obj/item/tank/internals/oxygen, user)
oxygentanks--
update_appearance()
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
/obj/structure/tank_dispenser/wrench_act(mob/living/user, obj/item/tool)
. = ..()
default_unfasten_wrench(user, tool)
return ITEM_INTERACT_SUCCESS
/obj/structure/tank_dispenser/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(istype(tool, /obj/item/tank/internals/plasma))
if(plasmatanks == TANK_DISPENSER_CAPACITY)
balloon_alert(user, "it is full!")
return ITEM_INTERACT_BLOCKING
plasmatanks++
else if(istype(tool, /obj/item/tank/internals/oxygen))
if(oxygentanks == TANK_DISPENSER_CAPACITY)
balloon_alert(user, "it is full!")
return ITEM_INTERACT_BLOCKING
oxygentanks++
else
if(!user.combat_mode || (tool.item_flags & NOBLUDGEON))
balloon_alert(user, "can't insert!")
return ITEM_INTERACT_BLOCKING
return NONE
if(!user.transferItemToLoc(tool, src))
return ITEM_INTERACT_BLOCKING
balloon_alert(user, "tank inserted")
update_appearance()
return ITEM_INTERACT_SUCCESS
/obj/structure/tank_dispenser/atom_deconstruct(disassembled = TRUE)
for(var/X in src)
var/obj/item/I = X
I.forceMove(loc)
new /obj/item/stack/sheet/iron (loc, 2)
/obj/structure/tank_dispenser/examine(mob/user)
. = ..()
if(plasmatanks && oxygentanks)
. += span_notice("It has <b>[plasmatanks]</b> plasma tank\s and <b>[oxygentanks]</b> oxygen tank\s left.")
else if(plasmatanks || oxygentanks)
. += span_notice("It has <b>[plasmatanks ? "[plasmatanks]</b> plasma" : "[oxygentanks]</b> oxygen"] tank\s left.")
/obj/structure/tank_dispenser/proc/dispense(tank_type, mob/receiver)
var/existing_tank = locate(tank_type) in src
if (isnull(existing_tank))
existing_tank = new tank_type
receiver.put_in_hands(existing_tank)
balloon_alert(receiver, "tank received")
#undef TANK_DISPENSER_CAPACITY