Files
Aurora.3/code/game/objects/structures/tank_dispenser.dm
T
14b6339d5c TGUI Migration (for everything remaining except the hardsuit) (#22404)
```
  - refactor: "Updates the Computer Fabricator to TGUI"
  - refactor: "Updates the Instruments to TGUI"
  - refactor: "Updates the Geo Scanner to TGUI"
  - refactor: "Updates the Stacking Machine to TGUI"
  - refactor: "Updates the Robotics Console to TGUI"
  - refactor: "Updates the Requests Console to TGUI"
  - refactor: "Updates the Synthesizer/Instrument main panel to TGUI"
  - refactor: "Updates the Nuclear Bomb control panel to TGUI"
  - rscadd: "Requests Console messages are now typed (Assistance Request, Supply Request, Information, Reply); the type is shown in the recipient's log, audible alert, and PDA notification."
  - rscadd: "Reconstructs the Synthesizer's Virtual Environment Editor (was broken since added — its NanoUI template never existed). The Custom environment preset that depends on it is gated behind a new musical_config.can_use_custom flag (default off, matching prior behavior)."
  - bugfix: "Fixes the Autolathe UI re-opening after every print job."
  - bugfix: "Fixes the Song Editor's currently-playing line indicator not advancing during playback."
  - bugfix: "Fixes a class of bugs where TGUI windows for the Air Alarm, Portable Turret, Mining Vendor, Mineral Processor, Tank Dispenser, Helm Console, all Chemistry machines, and Suit Cycler would force themselves back open after every action, even when the player had closed them."
  - bugfix: "Fixes the spatial sound system silently dropping every sound that used the 'None' (-1) environment id or a 23-element custom environment list. The validator was rejecting both as invalid, so synthesizer notes played with Custom or None mode produced no audible output at all."
  - admin: "Adds two requests consoles and two fax machines to the bridge on the runtime test map."

```

Claude Opus 4.7 has been used during the creation of this PR

---------

Signed-off-by: Arrow768 <1331699+Arrow768@users.noreply.github.com>
Co-authored-by: Werner <Arrow768@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Batrachophreno <Batrochophreno@gmail.com>
2026-05-26 17:57:26 +00:00

133 lines
3.8 KiB
Plaintext

/obj/structure/dispenser
name = "gas tank storage unit"
desc = "A simple yet bulky storage device for gas tanks. Has room for up to 10 oxygen tanks and 10 phoron tanks."
icon = 'icons/obj/tank_dispenser.dmi'
icon_state = "dispenser"
density = TRUE
anchored = TRUE
w_class = WEIGHT_CLASS_HUGE
var/max_tanks = 20
var/tanks_oxygen = 10
var/tanks_phoron = 10
var/list/held_tanks_oxygen = list()
var/list/held_tanks_phoron = list()
// Oxygen
/obj/structure/dispenser/oxygen
desc = "A simple yet bulky storage device for gas tanks. Has room for up to 10 oxygen tanks."
max_tanks = 10
tanks_phoron = 0
// Phoron
/obj/structure/dispenser/phoron
desc = "A simple yet bulky storage device for gas tanks. Has room for up to 10 phoron tanks."
max_tanks = 10
tanks_oxygen = 0
/obj/structure/dispenser/Initialize()
. = ..()
update_icon()
/obj/structure/dispenser/update_icon()
ClearOverlays()
switch(tanks_oxygen)
if(1 to 4)
AddOverlays("oxygen-[tanks_oxygen]")
if(5 to INFINITY)
AddOverlays("oxygen-5")
switch(tanks_phoron)
if(1 to 4)
AddOverlays("phoron-[tanks_phoron]")
if(5 to INFINITY)
AddOverlays("phoron-5")
/obj/structure/dispenser/attack_ai(mob/user)
if(user.Adjacent(src))
return attack_hand(user)
..()
/obj/structure/dispenser/attack_hand(mob/user)
add_fingerprint(user)
ui_interact(user)
// TGUI functions begin
/obj/structure/dispenser/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "TankDispenser", src.name, 400, 150)
ui.open()
/obj/structure/dispenser/ui_data(mob/user)
var/list/data = list()
data["tanks_oxygen"] = tanks_oxygen
data["tanks_phoron"] = tanks_phoron
return data
/obj/structure/dispenser/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if (.)
return
switch(action)
if("dispense_oxygen")
if(tanks_oxygen > 0)
var/obj/item/tank/oxygen/O
if(held_tanks_oxygen.len == tanks_oxygen)
O = held_tanks_oxygen[1]
held_tanks_oxygen.Remove(O)
else
O = new /obj/item/tank/oxygen(loc)
usr.put_in_hands(O)
to_chat(usr, SPAN_NOTICE("You take \the [O] out of \the [src]."))
tanks_oxygen--
update_icon()
if ("dispense_phoron")
if(tanks_phoron > 0)
var/obj/item/tank/phoron/P
if(held_tanks_phoron.len == tanks_phoron)
P = held_tanks_phoron[1]
held_tanks_phoron.Remove(P)
else
P = new /obj/item/tank/phoron(loc)
usr.put_in_hands(P)
to_chat(usr, SPAN_NOTICE("You take \the [P] out of \the [src]."))
tanks_phoron--
update_icon()
// TGUI functions end
/obj/structure/dispenser/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/tank/oxygen) || istype(attacking_item, /obj/item/tank/air) || istype(attacking_item, /obj/item/tank/anesthetic))
if(tanks_oxygen < max_tanks)
user.drop_from_inventory(attacking_item, src)
held_tanks_oxygen.Add(attacking_item)
tanks_oxygen++
to_chat(user, SPAN_NOTICE("You put \the [attacking_item] into \the [src]."))
if(tanks_oxygen < 5)
update_icon()
else
to_chat(user, SPAN_WARNING("\The [src] is full."))
SStgui.update_uis(src)
return
if(istype(attacking_item, /obj/item/tank/phoron))
if(tanks_phoron < max_tanks)
user.drop_from_inventory(attacking_item, src)
held_tanks_oxygen.Add(attacking_item)
tanks_phoron++
to_chat(user, SPAN_NOTICE("You put \the [attacking_item] into \the [src]."))
if(tanks_oxygen < 6)
update_icon()
else
to_chat(user, SPAN_WARNING("\The [src] is full."))
SStgui.update_uis(src)
return
if(attacking_item.tool_behaviour == TOOL_WRENCH)
if(anchored)
to_chat(user, SPAN_NOTICE("You lean down and unwrench \the [src]."))
anchored = FALSE
else
to_chat(user, SPAN_NOTICE("You wrench \the [src] into place."))
anchored = TRUE
return