mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 21:12:24 +01:00
Gas Tank Dispenser Code Cleanup (#15290)
* Tweaks EVA Gear * Fix * Fixes * Fixes Gas Tank Storage Unit * Fix * Ditto * Fix * Ditto * Ditto * Restores to Rack Method * Fixes Manually Mapped in Variables * Undoes Mapping * Update Changelog * Code Tweaks * Remove Unused Variants * Code Cleanup * Fix * Fix * Remove Manually Mapped Variable * Undo Update Icon Changes * Kill Trailing Whitespace * Another Manually Mapped Variable
This commit is contained in:
@@ -1,21 +1,27 @@
|
||||
/obj/structure/dispenser
|
||||
name = "tank storage unit"
|
||||
desc = "A simple yet bulky storage device for gas tanks. Has room for up to ten oxygen tanks, and ten phoron tanks."
|
||||
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 = ITEMSIZE_HUGE
|
||||
var/oxygentanks = 10
|
||||
var/phorontanks = 10
|
||||
var/list/oxytanks = list() //sorry for the similar var names
|
||||
var/list/platanks = list()
|
||||
var/max_tanks = 20
|
||||
var/oxygen_tanks = 10
|
||||
var/phoron_tanks = 10
|
||||
var/list/held_oxygen_tanks = list()
|
||||
var/list/held_phoron_tanks = list()
|
||||
|
||||
// Oxygen
|
||||
/obj/structure/dispenser/oxygen
|
||||
phorontanks = 0
|
||||
desc = "A simple yet bulky storage device for gas tanks. Has room for up to 10 oxygen tanks."
|
||||
max_tanks = 10
|
||||
phoron_tanks = 0
|
||||
|
||||
// Phoron
|
||||
/obj/structure/dispenser/phoron
|
||||
oxygentanks = 0
|
||||
desc = "A simple yet bulky storage device for gas tanks. Has room for up to 10 phoron tanks."
|
||||
oxygen_tanks = 0
|
||||
|
||||
/obj/structure/dispenser/Initialize()
|
||||
. = ..()
|
||||
@@ -23,14 +29,14 @@
|
||||
|
||||
/obj/structure/dispenser/update_icon()
|
||||
cut_overlays()
|
||||
switch(oxygentanks)
|
||||
switch(oxygen_tanks)
|
||||
if(1 to 4)
|
||||
add_overlay("oxygen-[oxygentanks]")
|
||||
add_overlay("oxygen-[oxygen_tanks]")
|
||||
if(5 to INFINITY)
|
||||
add_overlay("oxygen-5")
|
||||
switch(phorontanks)
|
||||
switch(phoron_tanks)
|
||||
if(1 to 4)
|
||||
add_overlay("phoron-[phorontanks]")
|
||||
add_overlay("phoron-[phoron_tanks]")
|
||||
if(5 to INFINITY)
|
||||
add_overlay("phoron-5")
|
||||
|
||||
@@ -42,8 +48,8 @@
|
||||
/obj/structure/dispenser/attack_hand(mob/user)
|
||||
user.set_machine(src)
|
||||
var/dat = "<br>"
|
||||
dat += "Oxygen tanks: [oxygentanks] - [oxygentanks ? "<A href='?src=\ref[src];oxygen=1'>Dispense</A>" : "empty"]<br>"
|
||||
dat += "Phoron tanks: [phorontanks] - [phorontanks ? "<A href='?src=\ref[src];phoron=1'>Dispense</A>" : "empty"]"
|
||||
dat += "Oxygen Tanks: [oxygen_tanks] - [oxygen_tanks ? "<a href='?src=\ref[src];oxygen=1'>Dispense</a>" : "empty"]<br>"
|
||||
dat += "Phoron Tanks: [phoron_tanks] - [phoron_tanks ? "<a href='?src=\ref[src];phoron=1'>Dispense</a>" : "empty"]"
|
||||
|
||||
var/datum/browser/dispenser_win = new(user, "dispenser", capitalize_first_letters(name), 300, 250)
|
||||
dispenser_win.set_content(dat)
|
||||
@@ -51,24 +57,24 @@
|
||||
|
||||
/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(oxygentanks < 10)
|
||||
if(oxygen_tanks < max_tanks)
|
||||
user.drop_from_inventory(attacking_item, src)
|
||||
oxytanks.Add(attacking_item)
|
||||
oxygentanks++
|
||||
held_oxygen_tanks.Add(attacking_item)
|
||||
oxygen_tanks++
|
||||
to_chat(user, SPAN_NOTICE("You put \the [attacking_item] into \the [src]."))
|
||||
if(oxygentanks < 5)
|
||||
if(oxygen_tanks < 5)
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [src] is full."))
|
||||
updateUsrDialog()
|
||||
return
|
||||
if(istype(attacking_item, /obj/item/tank/phoron))
|
||||
if(phorontanks < 10)
|
||||
if(phoron_tanks < max_tanks)
|
||||
user.drop_from_inventory(attacking_item, src)
|
||||
platanks.Add(attacking_item)
|
||||
phorontanks++
|
||||
held_oxygen_tanks.Add(attacking_item)
|
||||
phoron_tanks++
|
||||
to_chat(user, SPAN_NOTICE("You put \the [attacking_item] into \the [src]."))
|
||||
if(oxygentanks < 6)
|
||||
if(oxygen_tanks < 6)
|
||||
update_icon()
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [src] is full."))
|
||||
@@ -76,10 +82,10 @@
|
||||
return
|
||||
if(attacking_item.iswrench())
|
||||
if(anchored)
|
||||
to_chat(user, SPAN_NOTICE("You lean down and unwrench [src]."))
|
||||
to_chat(user, SPAN_NOTICE("You lean down and unwrench \the [src]."))
|
||||
anchored = FALSE
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("You wrench [src] into place."))
|
||||
to_chat(user, SPAN_NOTICE("You wrench \the [src] into place."))
|
||||
anchored = TRUE
|
||||
return
|
||||
|
||||
@@ -89,28 +95,28 @@
|
||||
if(Adjacent(usr))
|
||||
usr.set_machine(src)
|
||||
if(href_list[GAS_OXYGEN])
|
||||
if(oxygentanks > 0)
|
||||
if(oxygen_tanks > 0)
|
||||
var/obj/item/tank/oxygen/O
|
||||
if(oxytanks.len == oxygentanks)
|
||||
O = oxytanks[1]
|
||||
oxytanks.Remove(O)
|
||||
if(held_oxygen_tanks.len == oxygen_tanks)
|
||||
O = held_oxygen_tanks[1]
|
||||
held_oxygen_tanks.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]."))
|
||||
oxygentanks--
|
||||
oxygen_tanks--
|
||||
update_icon()
|
||||
if(href_list[GAS_PHORON])
|
||||
if(phorontanks > 0)
|
||||
if(phoron_tanks > 0)
|
||||
var/obj/item/tank/phoron/P
|
||||
if(platanks.len == phorontanks)
|
||||
P = platanks[1]
|
||||
platanks.Remove(P)
|
||||
if(held_phoron_tanks.len == phoron_tanks)
|
||||
P = held_phoron_tanks[1]
|
||||
held_phoron_tanks.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]."))
|
||||
phorontanks--
|
||||
phoron_tanks--
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
|
||||
Reference in New Issue
Block a user