Atmospherics refactor (#18460)

* Atmospherics refactor

* META(GAMING)

* Cleanup

* RPD hotfix

* Fox review

* Do this

* Well that escalated

* Repath these

* Ah yes, scope creep

* Remove this comment

* Regression #1
This commit is contained in:
AffectedArc07
2022-08-01 16:27:35 -04:00
committed by GitHub
parent 1d552ab0e4
commit 2da68e9b64
75 changed files with 1230 additions and 1265 deletions
@@ -59,6 +59,7 @@
var/atmos_overlay_type = null //current active overlay
// Dont make this Initialize(), youll break all of atmos
// Challenge accepted in a few years -aa07
/turf/simulated/New()
..()
if(!blocks_air)
@@ -257,8 +257,8 @@
apply_preset(1) // Don't cycle.
GLOB.air_alarm_repository.update_cache(src)
/obj/machinery/alarm/Initialize()
..()
/obj/machinery/alarm/Initialize(mapload)
. = ..()
set_frequency(frequency)
if(!master_is_operating())
elect_master()
@@ -18,13 +18,14 @@ Pipelines + Other Objects -> Pipe network
active_power_usage = 0
power_channel = ENVIRON
on_blueprints = TRUE
armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 100, ACID = 70)
var/nodealert = FALSE
var/can_unwrench = FALSE
/// If the machine is currently operating or not.
var/on = FALSE
/// The amount of pressure the machine wants to operate at.
var/target_pressure = 0
var/connect_types[] = list(1) //1=regular, 2=supply, 3=scrubber
var/list/connect_types = list(CONNECT_TYPE_NORMAL)
var/connected_to = 1 //same as above, currently not used for anything
var/icon_connect_type = "" //"-supply" or "-scrubbers"
@@ -33,21 +34,22 @@ Pipelines + Other Objects -> Pipe network
var/pipe_color
var/image/pipe_image
/obj/machinery/atmospherics/New()
if (!armor)
armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 100, ACID = 70)
..()
/obj/machinery/atmospherics/Initialize(mapload)
. = ..()
SSair.atmos_machinery += src
if(!pipe_color)
pipe_color = color
color = null
if(!pipe_color_check(pipe_color))
pipe_color = null
/obj/machinery/atmospherics/Initialize()
. = ..()
SSair.atmos_machinery += src
/obj/machinery/atmospherics/proc/process_atmos() //If you dont use process why are you here
return PROCESS_KILL
/obj/machinery/atmospherics/proc/atmos_init()
// Updates all pipe overlays and underlays
@@ -122,24 +124,20 @@ Pipelines + Other Objects -> Pipe network
// Connect types
/obj/machinery/atmospherics/proc/check_connect_types(obj/machinery/atmospherics/atmos1, obj/machinery/atmospherics/atmos2)
var/i
var/list1[] = atmos1.connect_types
var/list2[] = atmos2.connect_types
for(i=1,i<=list1.len,i++)
var/j
for(j=1,j<=list2.len,j++)
var/list/list1 = atmos1.connect_types
var/list/list2 = atmos2.connect_types
for(var/i in 1 to length(list1))
for(var/j in 1 to length(list2))
if(list1[i] == list2[j])
var/n = list1[i]
return n
return 0
/obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/atmospherics/atmos1, obj/item/pipe/pipe2)
var/i
var/list1[] = atmos1.connect_types
var/list2[] = pipe2.connect_types
for(i=1,i<=list1.len,i++)
var/j
for(j=1,j<=list2.len,j++)
var/list/list1 = atmos1.connect_types
var/list/list2 = pipe2.connect_types
for(var/i in 1 to length(list1))
for(var/j in 1 to length(list2))
if(list1[i] == list2[j])
var/n = list1[i]
return n
@@ -247,7 +245,7 @@ Pipelines + Other Objects -> Pipe network
/obj/machinery/atmospherics/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
if(can_unwrench)
var/obj/item/pipe/stored = new(loc, make_from = src)
var/obj/item/pipe/stored = new(loc, null, null, src)
if(!disassembled)
stored.obj_integrity = stored.max_integrity * 0.5
transfer_fingerprints_to(stored)
@@ -27,15 +27,16 @@
/obj/item/pipe/circulator
name = "circulator/heat exchanger fitting"
/obj/item/pipe/circulator/New(loc)
var/obj/machinery/atmospherics/binary/circulator/C = new /obj/machinery/atmospherics/binary/circulator(null)
..(loc, make_from = C)
/obj/item/pipe/circulator/Initialize(mapload, pipe_type, dir, obj/machinery/atmospherics/make_from)
. = ..(make_from = new /obj/machinery/atmospherics/binary/circulator(null))
/obj/machinery/atmospherics/binary/circulator/Destroy()
if(generator && generator.cold_circ == src)
generator.cold_circ = null
else if(generator && generator.hot_circ == src)
generator.hot_circ = null
return ..()
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
@@ -14,7 +14,7 @@
level = 1
connect_types = list(1,2,3) //connects to regular, supply and scrubbers pipes
connect_types = list(CONNECT_TYPE_NORMAL, CONNECT_TYPE_SUPPLY, CONNECT_TYPE_SCRUBBER) //connects to regular, supply and scrubbers pipes
var/releasing = TRUE //FALSE = siphoning, TRUE = releasing
@@ -8,7 +8,7 @@
can_unwrench = TRUE
layer = GAS_FILTER_LAYER
var/obj/machinery/portable_atmospherics/connected_device
var/obj/machinery/atmospherics/portable/connected_device
/obj/machinery/atmospherics/unary/portables_connector/Destroy()
if(connected_device)
@@ -44,7 +44,7 @@
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,2) //connects to regular and supply pipes
connect_types = list(CONNECT_TYPE_NORMAL, CONNECT_TYPE_SUPPLY) //connects to regular and supply pipes
/obj/machinery/atmospherics/unary/vent_pump/detailed_examine()
return "This pumps the contents of the attached pipe out into the atmosphere, if needed. It can be controlled from an Air Alarm."
@@ -36,7 +36,7 @@
var/radio_filter_out
var/radio_filter_in
connect_types = list(1,3) //connects to regular and scrubber pipes
connect_types = list(CONNECT_TYPE_NORMAL, CONNECT_TYPE_SCRUBBER) //connects to regular and scrubber pipes
/obj/machinery/atmospherics/unary/vent_scrubber/on
on = TRUE
@@ -73,7 +73,7 @@
<font color="red">[status]</font><br>
<a href="?src=[UID()];scan=1">Scan</a>
<table border="1" width="90%">"}
for(var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber in connectedscrubbers)
for(var/obj/machinery/atmospherics/portable/scrubber/huge/scrubber in connectedscrubbers)
dat += {"
<tr>
<td>[scrubber.name]</td>
@@ -100,7 +100,7 @@
if(href_list["scan"])
scanscrubbers()
else if(href_list["toggle"])
var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber = locate(href_list["scrub"])
var/obj/machinery/atmospherics/portable/scrubber/huge/scrubber = locate(href_list["scrub"])
if(!validscrubber(scrubber))
spawn(20)
@@ -112,7 +112,7 @@
scrubber.on = text2num(href_list["toggle"])
scrubber.update_icon()
/obj/machinery/computer/area_atmos/proc/validscrubber(obj/machinery/portable_atmospherics/scrubber/huge/scrubber as obj)
/obj/machinery/computer/area_atmos/proc/validscrubber(obj/machinery/atmospherics/portable/scrubber/huge/scrubber as obj)
if(!isobj(scrubber) || get_dist(scrubber.loc, src.loc) > src.range || scrubber.loc.z != src.loc.z)
return 0
@@ -122,7 +122,7 @@
connectedscrubbers = new()
var/found = 0
for(var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber in range(range, src.loc))
for(var/obj/machinery/atmospherics/portable/scrubber/huge/scrubber in range(range, src.loc))
if(istype(scrubber))
found = 1
connectedscrubbers += scrubber
@@ -136,7 +136,7 @@
/obj/machinery/computer/area_atmos/area
zone = "This computer is working in a wired network limited to this area."
/obj/machinery/computer/area_atmos/area/validscrubber(obj/machinery/portable_atmospherics/scrubber/huge/scrubber as obj )
/obj/machinery/computer/area_atmos/area/validscrubber(obj/machinery/atmospherics/portable/scrubber/huge/scrubber as obj )
if(!isobj(scrubber))
return 0
@@ -164,7 +164,7 @@
var/turf/T = get_turf(src)
if(!T.loc) return
var/area/A = get_area(T)
for(var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber in SSair.atmos_machinery)
for(var/obj/machinery/atmospherics/portable/scrubber/huge/scrubber in SSair.atmos_machinery)
var/turf/T2 = get_turf(scrubber)
if(T2 && T2.loc)
var/area/A2 = T2.loc
@@ -1,4 +1,4 @@
/obj/machinery/meter
/obj/machinery/atmospherics/meter
name = "gas flow meter"
desc = "It measures something."
icon = 'icons/obj/meter.dmi'
@@ -12,7 +12,6 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 40, ACID = 0)
power_channel = ENVIRON
frequency = ATMOS_DISTRO_FREQ
var/id
var/id_tag
use_power = IDLE_POWER_USE
idle_power_usage = 2
@@ -21,28 +20,18 @@
Mtoollink = TRUE
settagwhitelist = list("id_tag")
/obj/machinery/meter/New()
..()
SSair.atmos_machinery += src
/obj/machinery/atmospherics/meter/Initialize(mapload)
. = ..()
target = locate(/obj/machinery/atmospherics/pipe) in loc
if(id && !id_tag)//i'm not dealing with further merge conflicts, fuck it
id_tag = id
return 1
/obj/machinery/meter/Destroy()
SSair.atmos_machinery -= src
/obj/machinery/atmospherics/meter/Destroy()
target = null
return ..()
/obj/machinery/meter/Initialize()
..()
if(!target)
target = locate(/obj/machinery/atmospherics/pipe) in loc
/obj/machinery/meter/detailed_examine()
/obj/machinery/atmospherics/meter/detailed_examine()
return "Measures the volume and temperature of the pipe under the meter."
/obj/machinery/meter/process_atmos()
/obj/machinery/atmospherics/meter/process_atmos()
if(!target || (stat & (BROKEN|NOPOWER)))
update_icon(UPDATE_ICON_STATE)
return
@@ -69,9 +58,9 @@
"sigtype" = "status"
)
radio_connection.post_signal(src, signal)
/obj/machinery/meter/update_icon_state()
/obj/machinery/atmospherics/meter/update_icon_state()
if(!target)
icon_state = "meterX"
return
@@ -100,7 +89,7 @@
else
icon_state = "meter4"
/obj/machinery/meter/proc/status()
/obj/machinery/atmospherics/meter/proc/status()
var/t = ""
if(target)
var/datum/gas_mixture/environment = target.return_air()
@@ -112,7 +101,7 @@
t += "The connect error light is blinking."
return t
/obj/machinery/meter/examine(mob/user)
/obj/machinery/atmospherics/meter/examine(mob/user)
var/t = "A gas flow meter. "
if(get_dist(user, src) > 3 && !(istype(user, /mob/living/silicon/ai) || istype(user, /mob/dead)))
@@ -132,14 +121,14 @@
. = list(t)
/obj/machinery/meter/Click()
/obj/machinery/atmospherics/meter/Click()
if(istype(usr, /mob/living/silicon/ai)) // ghosts can call ..() for examine
usr.examinate(src)
return 1
return ..()
/obj/machinery/meter/attackby(obj/item/W as obj, mob/user as mob, params)
/obj/machinery/atmospherics/meter/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/multitool))
update_multitool_menu(user)
return 1
@@ -155,33 +144,17 @@
"You hear ratchet.")
deconstruct(TRUE)
/obj/machinery/meter/deconstruct(disassembled = TRUE)
/obj/machinery/atmospherics/meter/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
new /obj/item/pipe_meter(loc)
qdel(src)
/obj/machinery/meter/singularity_pull(S, current_size)
/obj/machinery/atmospherics/meter/singularity_pull(S, current_size)
..()
if(current_size >= STAGE_FIVE)
deconstruct()
// TURF METER - REPORTS A TILE'S AIR CONTENTS
/obj/machinery/meter/turf/New()
..()
target = loc
return 1
/obj/machinery/meter/turf/Initialize()
if(!target)
target = loc
..()
/obj/machinery/meter/turf/attackby(obj/item/W as obj, mob/user as mob, params)
return
/obj/machinery/meter/multitool_menu(mob/user, obj/item/multitool/P)
/obj/machinery/atmospherics/meter/multitool_menu(mob/user, obj/item/multitool/P)
return {"
<b>Main</b>
<ul>
@@ -86,7 +86,7 @@
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
icon_state = "cap-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -95,7 +95,7 @@
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
icon_state = "cap-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -109,7 +109,7 @@
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
icon_state = "cap-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -118,7 +118,7 @@
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
icon_state = "cap-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -160,7 +160,7 @@
name="Scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -173,7 +173,7 @@
name="Air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -209,7 +209,7 @@
name="Scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -222,7 +222,7 @@
name="Air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -170,7 +170,7 @@
name="4-way scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map_4way-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -183,7 +183,7 @@
name="4-way air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map_4way-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -213,7 +213,7 @@
name="4-way scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map_4way-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -226,7 +226,7 @@
name="4-way air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map_4way-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -15,8 +15,8 @@
flags_2 = NO_MALF_EFFECT_2
/obj/machinery/atmospherics/pipe/New()
..()
/obj/machinery/atmospherics/pipe/Initialize(mapload)
. = ..()
//so pipes under walls are hidden
if(istype(get_turf(src), /turf/simulated/wall))
level = 1
@@ -26,7 +26,7 @@
QDEL_NULL(air_temporary)
var/turf/T = loc
for(var/obj/machinery/meter/meter in T)
for(var/obj/machinery/atmospherics/meter/meter in T)
if(meter.target == src)
var/obj/item/pipe_meter/PM = new (T)
meter.transfer_fingerprints_to(PM)
@@ -7,7 +7,7 @@
name = "Scrubbers pipe"
desc = "A one meter section of scrubbers pipe"
icon_state = "intact-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -20,7 +20,7 @@
name = "Air supply pipe"
desc = "A one meter section of supply pipe"
icon_state = "intact-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -32,7 +32,7 @@
/obj/machinery/atmospherics/pipe/simple/hidden/universal
name="Universal pipe adapter"
desc = "An adapter for regular, supply and scrubbers pipes"
connect_types = list(1,2,3)
connect_types = list(CONNECT_TYPE_NORMAL, CONNECT_TYPE_SUPPLY, CONNECT_TYPE_SCRUBBER)
icon_state = "map_universal"
/obj/machinery/atmospherics/pipe/simple/hidden/universal/detailed_examine()
@@ -41,7 +41,7 @@
/obj/machinery/atmospherics/pipe/simple/hidden/universal/update_overlays()
. = list()
alpha = 255
. += SSair.icon_manager.get_atmos_icon("pipe", , pipe_color, "universal")
. += SSair.icon_manager.get_atmos_icon("pipe", color = pipe_color, state = "universal")
update_underlays()
/obj/machinery/atmospherics/pipe/simple/hidden/universal/update_underlays()
@@ -53,14 +53,14 @@
universal_underlays(node2)
else
var/node2_dir = turn(get_dir(src,node1),-180)
universal_underlays(,node2_dir)
universal_underlays(direction = node2_dir)
else if(node2)
universal_underlays(node2)
var/node1_dir = turn(get_dir(src,node2),-180)
universal_underlays(,node1_dir)
universal_underlays(direction = node1_dir)
else
universal_underlays(,dir)
universal_underlays(,turn(dir, -180))
universal_underlays(direction = dir)
universal_underlays(direction = turn(dir, -180))
/obj/machinery/atmospherics/pipe/simple/hidden/yellow
color = PIPE_COLOR_YELLOW
@@ -6,7 +6,7 @@
name = "Scrubbers pipe"
desc = "A one meter section of scrubbers pipe"
icon_state = "intact-scrubbers"
connect_types = list(3)
connect_types = list(CONNECT_TYPE_SCRUBBER)
layer = 2.38
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
@@ -19,7 +19,7 @@
name = "Air supply pipe"
desc = "A one meter section of supply pipe"
icon_state = "intact-supply"
connect_types = list(2)
connect_types = list(CONNECT_TYPE_SUPPLY)
layer = 2.39
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
@@ -49,7 +49,7 @@
/obj/machinery/atmospherics/pipe/simple/visible/universal
name="Universal pipe adapter"
desc = "An adapter for regular, supply and scrubbers pipes"
connect_types = list(1,2,3)
connect_types = list(CONNECT_TYPE_NORMAL, CONNECT_TYPE_SUPPLY, CONNECT_TYPE_SCRUBBER)
icon_state = "map_universal"
/obj/machinery/atmospherics/pipe/simple/visible/universal/detailed_examine()
@@ -58,7 +58,7 @@
/obj/machinery/atmospherics/pipe/simple/visible/universal/update_overlays()
. = list()
alpha = 255
. += SSair.icon_manager.get_atmos_icon("pipe", , pipe_color, "universal")
. += SSair.icon_manager.get_atmos_icon("pipe", color = pipe_color, state = "universal")
update_underlays()
/obj/machinery/atmospherics/pipe/simple/visible/universal/update_underlays()
@@ -70,9 +70,9 @@
universal_underlays(node2)
else
var/node1_dir = get_dir(node1,src)
universal_underlays(,node1_dir)
universal_underlays(direction = node1_dir)
else if(node2)
universal_underlays(node2)
else
universal_underlays(,dir)
universal_underlays(,turn(dir, -180))
universal_underlays(direction = dir)
universal_underlays(direction = turn(dir, -180))
@@ -1,42 +1,46 @@
/datum/canister_icons
var
possiblemaincolor = list( //these lists contain the possible colors of a canister
list("name" = "\[N2O\]", "icon" = "redws"),
list("name" = "\[N2\]", "icon" = "red"),
list("name" = "\[O2\]", "icon" = "blue"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange"),
list("name" = "\[CO2\]", "icon" = "black"),
list("name" = "\[Air\]", "icon" = "grey"),
list("name" = "\[CAUTION\]", "icon" = "yellow"),
list("name" = "\[SPECIAL\]", "icon" = "whiters")
)
possibleseccolor = list( // no point in having the N2O and "whiters" ones in these lists
list("name" = "\[None\]", "icon" = "none"),
list("name" = "\[N2\]", "icon" = "red-c"),
list("name" = "\[O2\]", "icon" = "blue-c"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange-c"),
list("name" = "\[CO2\]", "icon" = "black-c"),
list("name" = "\[Air\]", "icon" = "grey-c"),
list("name" = "\[CAUTION\]", "icon" = "yellow-c")
)
possibletertcolor = list(
list("name" = "\[None\]", "icon" = "none"),
list("name" = "\[N2\]", "icon" = "red-c-1"),
list("name" = "\[O2\]", "icon" = "blue-c-1"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange-c-1"),
list("name" = "\[CO2\]", "icon" = "black-c-1"),
list("name" = "\[Air\]", "icon" = "grey-c-1"),
list("name" = "\[CAUTION\]", "icon" = "yellow-c-1")
)
possiblequartcolor = list(
list("name" = "\[None\]", "icon" = "none"),
list("name" = "\[N2\]", "icon" = "red-c-2"),
list("name" = "\[O2\]", "icon" = "blue-c-2"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange-c-2"),
list("name" = "\[CO2\]", "icon" = "black-c-2"),
list("name" = "\[Air\]", "icon" = "grey-c-2"),
list("name" = "\[CAUTION\]", "icon" = "yellow-c-2")
)
var/list/possiblemaincolor = list( //these lists contain the possible colors of a canister
list("name" = "\[N2O\]", "icon" = "redws"),
list("name" = "\[N2\]", "icon" = "red"),
list("name" = "\[O2\]", "icon" = "blue"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange"),
list("name" = "\[CO2\]", "icon" = "black"),
list("name" = "\[Air\]", "icon" = "grey"),
list("name" = "\[CAUTION\]", "icon" = "yellow"),
list("name" = "\[SPECIAL\]", "icon" = "whiters")
)
var/list/possibleseccolor = list( // no point in having the N2O and "whiters" ones in these lists
list("name" = "\[None\]", "icon" = "none"),
list("name" = "\[N2\]", "icon" = "red-c"),
list("name" = "\[O2\]", "icon" = "blue-c"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange-c"),
list("name" = "\[CO2\]", "icon" = "black-c"),
list("name" = "\[Air\]", "icon" = "grey-c"),
list("name" = "\[CAUTION\]", "icon" = "yellow-c")
)
var/list/possibletertcolor = list(
list("name" = "\[None\]", "icon" = "none"),
list("name" = "\[N2\]", "icon" = "red-c-1"),
list("name" = "\[O2\]", "icon" = "blue-c-1"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange-c-1"),
list("name" = "\[CO2\]", "icon" = "black-c-1"),
list("name" = "\[Air\]", "icon" = "grey-c-1"),
list("name" = "\[CAUTION\]", "icon" = "yellow-c-1")
)
var/list/possiblequartcolor = list(
list("name" = "\[None\]", "icon" = "none"),
list("name" = "\[N2\]", "icon" = "red-c-2"),
list("name" = "\[O2\]", "icon" = "blue-c-2"),
list("name" = "\[Toxin (Bio)\]", "icon" = "orange-c-2"),
list("name" = "\[CO2\]", "icon" = "black-c-2"),
list("name" = "\[Air\]", "icon" = "grey-c-2"),
list("name" = "\[CAUTION\]", "icon" = "yellow-c-2")
)
GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
#define HOLDING_TANK 1
@@ -48,7 +52,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
#define NEW_COLOR 64
#define RESET 68
/obj/machinery/portable_atmospherics/canister
/obj/machinery/atmospherics/portable/canister
name = "canister"
icon = 'icons/obj/atmos.dmi'
icon_state = "yellow"
@@ -80,15 +84,18 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
var/release_log = ""
var/update_flag = NONE
/obj/machinery/portable_atmospherics/canister/New()
..()
/obj/machinery/atmospherics/portable/canister/Initialize(mapload)
. = ..()
canister_color = list(
"prim" = "yellow",
"sec" = "none",
"ter" = "none",
"quart" = "none"
)
old_color = new /list()
old_color = list()
colorcontainer = list(
"prim" = list(
"options" = GLOB.canister_icon_container.possiblemaincolor,
@@ -107,18 +114,20 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
"name" = "Quaternary color",
)
)
color_index = list()
update_icon()
/obj/machinery/portable_atmospherics/canister/detailed_examine()
/obj/machinery/atmospherics/portable/canister/detailed_examine()
return "The canister can be connected to a connector port with a wrench. Tanks of gas (the kind you can hold in your hand) \
can be filled by the canister, by using the tank on the canister, increasing the release pressure, then opening the valve until it is full, and then close it. \
*DO NOT* remove the tank until the valve is closed. A gas analyzer can be used to check the contents of the canister."
/obj/machinery/portable_atmospherics/canister/detailed_examine_antag()
/obj/machinery/atmospherics/portable/canister/detailed_examine_antag()
return "Canisters can be damaged, spilling their contents into the air, or you can just leave the release valve open."
/obj/machinery/portable_atmospherics/canister/proc/check_change()
/obj/machinery/atmospherics/portable/canister/proc/check_change()
var/old_flag = update_flag
update_flag = NONE
if(holding_tank)
@@ -144,7 +153,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
return FALSE
return TRUE
/obj/machinery/portable_atmospherics/canister/update_icon_state()
/obj/machinery/atmospherics/portable/canister/update_icon_state()
/*
(note: colors has to be applied every icon update)
*/
@@ -159,7 +168,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
if(!check_change()) //Returns FALSE if no change needed to icons.
return
/obj/machinery/portable_atmospherics/canister/update_overlays()
/obj/machinery/atmospherics/portable/canister/update_overlays()
. = ..()
if(stat & BROKEN)
return
@@ -187,12 +196,12 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
update_flag &= ~RESET //the flag NEW_COLOR represents change, not states. As such, we have to reset them to be able to detect a change on the next go.
return
/obj/machinery/portable_atmospherics/canister/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
/obj/machinery/atmospherics/portable/canister/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
..()
if(exposed_temperature > temperature_resistance)
take_damage(5, BURN, 0)
/obj/machinery/portable_atmospherics/canister/deconstruct(disassembled = TRUE)
/obj/machinery/atmospherics/portable/canister/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
if(!(stat & BROKEN))
canister_break()
@@ -202,12 +211,12 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
new /obj/item/stack/sheet/metal (loc, 5)
qdel(src)
/obj/machinery/portable_atmospherics/canister/obj_break(damage_flag)
/obj/machinery/atmospherics/portable/canister/obj_break(damage_flag)
if((stat & BROKEN) || (flags & NODECONSTRUCT))
return
canister_break()
/obj/machinery/portable_atmospherics/canister/proc/canister_break()
/obj/machinery/atmospherics/portable/canister/proc/canister_break()
disconnect()
var/datum/gas_mixture/expelled_gas = air_contents.remove(air_contents.total_moles())
var/turf/T = get_turf(src)
@@ -223,7 +232,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
holding_tank.forceMove(T)
holding_tank = null
/obj/machinery/portable_atmospherics/canister/process_atmos()
/obj/machinery/atmospherics/portable/canister/process_atmos()
if(stat & BROKEN)
return
@@ -260,49 +269,50 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
else
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/return_air()
/obj/machinery/atmospherics/portable/canister/return_air()
return air_contents
/obj/machinery/portable_atmospherics/canister/proc/return_temperature()
/obj/machinery/atmospherics/portable/canister/proc/return_temperature()
var/datum/gas_mixture/GM = return_air()
if(GM && GM.volume>0)
return GM.temperature
return
/obj/machinery/portable_atmospherics/canister/proc/return_pressure()
/obj/machinery/atmospherics/portable/canister/proc/return_pressure()
var/datum/gas_mixture/GM = return_air()
if(GM && GM.volume>0)
return GM.return_pressure()
return
/obj/machinery/portable_atmospherics/canister/replace_tank(mob/living/user, close_valve)
/obj/machinery/atmospherics/portable/canister/replace_tank(mob/living/user, close_valve)
. = ..()
if(.)
if(close_valve)
valve_open = FALSE
update_icon()
investigate_log("Valve was <b>closed</b> by [key_name(user)].<br>", "atmos")
else if(valve_open && holding_tank)
investigate_log("[key_name(user)] started a transfer into [holding_tank].<br>", "atmos")
/obj/machinery/portable_atmospherics/canister/attack_ai(mob/user)
/obj/machinery/atmospherics/portable/canister/attack_ai(mob/user)
add_hiddenprint(user)
return attack_hand(user)
/obj/machinery/portable_atmospherics/canister/attack_ghost(mob/user)
/obj/machinery/atmospherics/portable/canister/attack_ghost(mob/user)
return ui_interact(user)
/obj/machinery/portable_atmospherics/canister/attack_hand(mob/user)
/obj/machinery/atmospherics/portable/canister/attack_hand(mob/user)
return ui_interact(user)
/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
/obj/machinery/atmospherics/portable/canister/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "Canister", name, 600, 350, master_ui, state)
ui.open()
/obj/machinery/portable_atmospherics/canister/ui_data()
/obj/machinery/atmospherics/portable/canister/ui_data()
var/data = list()
data["portConnected"] = connected_port ? TRUE : FALSE
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
@@ -320,12 +330,14 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
data["holdingTank"] = list("name" = holding_tank.name, "tankPressure" = round(holding_tank.air_contents.return_pressure()))
return data
/obj/machinery/portable_atmospherics/canister/ui_act(action, params)
/obj/machinery/atmospherics/portable/canister/ui_act(action, params)
if(..())
return
var/can_min_release_pressure = round(ONE_ATMOSPHERE / 10)
var/can_max_release_pressure = round(ONE_ATMOSPHERE * 10)
. = TRUE
switch(action)
if("relabel")
if(can_label)
@@ -338,6 +350,7 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
else
to_chat(usr, "<span class='warning'>As you attempted to rename it the pressure rose!</span>")
. = FALSE
if("pressure")
var/pressure = params["pressure"]
if(pressure == "reset")
@@ -355,141 +368,152 @@ GLOBAL_DATUM_INIT(canister_icon_container, /datum/canister_icons, new())
if(.)
release_pressure = clamp(round(pressure), can_min_release_pressure, can_max_release_pressure)
investigate_log("was set to [release_pressure] kPa by [key_name(usr)].", "atmos")
if("valve")
var/logmsg
valve_open = !valve_open
if(valve_open)
logmsg = "Valve was <b>opened</b> by [key_name(usr)], starting a transfer into the [holding_tank || "air"].<br>"
if(!holding_tank)
logmsg = "Valve was <b>opened</b> by [key_name(usr)], starting a transfer into the air.<br>"
if(air_contents.toxins > 0)
message_admins("[key_name_admin(usr)] opened a canister that contains plasma in [get_area(src)]! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_admin("[key_name(usr)] opened a canister that contains plasma at [get_area(src)]: [x], [y], [z]")
if(air_contents.sleeping_agent > 0)
message_admins("[key_name_admin(usr)] opened a canister that contains N2O in [get_area(src)]! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_admin("[key_name(usr)] opened a canister that contains N2O at [get_area(src)]: [x], [y], [z]")
else
logmsg = "Valve was <b>closed</b> by [key_name(usr)], stopping the transfer into the [holding_tank || "air"].<br>"
investigate_log(logmsg, "atmos")
release_log += logmsg
if("eject")
if(holding_tank)
if(valve_open)
valve_open = FALSE
release_log += "Valve was <b>closed</b> by [key_name(usr)], stopping the transfer into the [holding_tank]<br>"
replace_tank(usr, FALSE)
if("recolor")
if(can_label)
var/ctype = params["ctype"]
var/cnum = text2num(params["nc"])
if(isnull(colorcontainer[ctype]))
message_admins("[key_name_admin(usr)] passed an invalid ctype var to a canister.")
return
var/newcolor = sanitize_integer(cnum, 0, length(colorcontainer[ctype]["options"]))
color_index[ctype] = newcolor
newcolor++ // javascript starts arrays at 0, byond (for some reason) starts them at 1, this converts JS values to byond values
canister_color[ctype] = colorcontainer[ctype]["options"][newcolor]["icon"]
add_fingerprint(usr)
update_icon()
/obj/machinery/atmospherics/portable/canister/atmos_init()
. = ..()
update_icon()
/obj/machinery/portable_atmospherics/canister/toxins
/obj/machinery/atmospherics/portable/canister/toxins
name = "Canister \[Toxin (Plasma)\]"
icon_state = "orange" //See New()
icon_state = "orange" //See Initialize()
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/oxygen
/obj/machinery/atmospherics/portable/canister/oxygen
name = "Canister: \[O2\]"
icon_state = "blue" //See New()
icon_state = "blue" //See Initialize()
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/sleeping_agent
/obj/machinery/atmospherics/portable/canister/sleeping_agent
name = "Canister: \[N2O\]"
icon_state = "redws" //See New()
icon_state = "redws" //See Initialize()
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/nitrogen
/obj/machinery/atmospherics/portable/canister/nitrogen
name = "Canister: \[N2\]"
icon_state = "red" //See New()
icon_state = "red" //See Initialize()
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/carbon_dioxide
/obj/machinery/atmospherics/portable/canister/carbon_dioxide
name = "Canister \[CO2\]"
icon_state = "black" //See New()
icon_state = "black" //See Initialize()
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/air
/obj/machinery/atmospherics/portable/canister/air
name = "Canister \[Air\]"
icon_state = "grey" //See New()
icon_state = "grey" //See Initialize()
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/custom_mix
/obj/machinery/atmospherics/portable/canister/custom_mix
name = "Canister \[Custom\]"
icon_state = "whiters" //See New()
icon_state = "whiters" //See Initialize()
can_label = FALSE
/obj/machinery/portable_atmospherics/canister/toxins/New()
..()
/obj/machinery/atmospherics/portable/canister/toxins/Initialize(mapload)
. = ..()
canister_color["prim"] = "orange"
air_contents.toxins = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
update_icon()
return TRUE
/obj/machinery/portable_atmospherics/canister/oxygen/New()
..()
/obj/machinery/atmospherics/portable/canister/oxygen/Initialize(mapload)
. = ..()
canister_color["prim"] = "blue"
air_contents.oxygen = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
update_icon()
return TRUE
/obj/machinery/portable_atmospherics/canister/sleeping_agent/New()
..()
/obj/machinery/atmospherics/portable/canister/sleeping_agent/Initialize(mapload)
. = ..()
canister_color["prim"] = "redws"
air_contents.sleeping_agent = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
update_icon()
return TRUE
/obj/machinery/portable_atmospherics/canister/nitrogen/New()
..()
/obj/machinery/atmospherics/portable/canister/nitrogen/Initialize(mapload)
. = ..()
canister_color["prim"] = "red"
air_contents.nitrogen = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
update_icon()
return TRUE
/obj/machinery/portable_atmospherics/canister/carbon_dioxide/New()
..()
/obj/machinery/atmospherics/portable/canister/carbon_dioxide/Initialize(mapload)
. = ..()
canister_color["prim"] = "black"
air_contents.carbon_dioxide = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
update_icon()
return TRUE
/obj/machinery/portable_atmospherics/canister/air/New()
..()
/obj/machinery/atmospherics/portable/canister/air/Initialize(mapload)
. = ..()
canister_color["prim"] = "grey"
air_contents.oxygen = (O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
air_contents.nitrogen = (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
update_icon()
return TRUE
/obj/machinery/portable_atmospherics/canister/custom_mix/New()
..()
/obj/machinery/atmospherics/portable/canister/custom_mix/Initialize(mapload)
. = ..()
canister_color["prim"] = "whiters"
update_icon() // Otherwise new canisters do not have their icon updated with the pressure light, likely want to add this to the canister class constructor, avoiding at current time to refrain from screwing up code for other canisters. --DZD
return TRUE
/obj/machinery/portable_atmospherics/canister/welder_act(mob/user, obj/item/I)
/obj/machinery/atmospherics/portable/canister/welder_act(mob/user, obj/item/I)
if(!(stat & BROKEN))
return
. = TRUE
if(!I.tool_use_check(user, 0))
return
WELDER_ATTEMPT_SLICING_MESSAGE
if(I.use_tool(src, user, 50, volume = I.tool_volume))
to_chat(user, "<span class='notice'>You salvage whats left of [src]!</span>")
@@ -1,5 +1,7 @@
/obj/machinery/portable_atmospherics
/obj/machinery/atmospherics/portable
name = "atmoalter"
anchored = FALSE
layer = BELOW_OBJ_LAYER
use_power = NO_POWER_USE
max_integrity = 250
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 60, ACID = 30)
@@ -10,40 +12,45 @@
var/volume = 0
var/maximum_pressure = 90*ONE_ATMOSPHERE
var/maximum_pressure = 90 * ONE_ATMOSPHERE
/obj/machinery/portable_atmospherics/New()
..()
/obj/machinery/atmospherics/portable/Initialize(mapload)
. = ..()
SSair.atmos_machinery += src
air_contents.volume = volume
air_contents.temperature = T20C
return TRUE
if(mapload)
return INITIALIZE_HINT_LATELOAD
/obj/machinery/portable_atmospherics/Initialize()
. = ..()
spawn()
var/obj/machinery/atmospherics/unary/portables_connector/port = locate() in loc
if(port)
connect(port)
update_icon()
check_for_port()
/obj/machinery/portable_atmospherics/process_atmos()
// Late init this otherwise it shares with the port and it tries to div temperature by 0
/obj/machinery/atmospherics/portable/LateInitialize()
check_for_port()
/obj/machinery/atmospherics/portable/proc/check_for_port()
var/obj/machinery/atmospherics/unary/portables_connector/port = locate() in loc
if(port)
connect(port)
/obj/machinery/atmospherics/portable/process_atmos()
if(!connected_port) //only react when pipe_network will ont it do it for you
//Allow for reactions
air_contents.react()
else
update_icon()
return
/obj/machinery/portable_atmospherics/Destroy()
update_icon()
/obj/machinery/atmospherics/portable/Destroy()
SSair.atmos_machinery -= src
disconnect()
QDEL_NULL(air_contents)
QDEL_NULL(holding_tank)
return ..()
/obj/machinery/portable_atmospherics/proc/connect(obj/machinery/atmospherics/unary/portables_connector/new_port)
/obj/machinery/atmospherics/portable/proc/connect(obj/machinery/atmospherics/unary/portables_connector/new_port)
//Make sure not already connected to something else
if(connected_port || !new_port || new_port.connected_device)
return
@@ -65,7 +72,7 @@
return TRUE
/obj/machinery/portable_atmospherics/proc/disconnect()
/obj/machinery/atmospherics/portable/disconnect()
if(!connected_port)
return
@@ -76,10 +83,10 @@
return TRUE
/obj/machinery/portable_atmospherics/portableConnectorReturnAir()
/obj/machinery/atmospherics/portable/portableConnectorReturnAir()
return air_contents
/obj/machinery/portable_atmospherics/AltClick(mob/living/user)
/obj/machinery/atmospherics/portable/AltClick(mob/living/user)
if(!istype(user) || user.incapacitated())
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
@@ -91,12 +98,12 @@
to_chat(user, "<span class='notice'>You remove [holding_tank] from [src].</span>")
replace_tank(user, TRUE)
/obj/machinery/portable_atmospherics/examine(mob/user)
/obj/machinery/atmospherics/portable/examine(mob/user)
. = ..()
if(holding_tank)
. += "<span class='notice'>\The [src] contains [holding_tank]. Alt-click [src] to remove it.</span>"
/obj/machinery/portable_atmospherics/proc/replace_tank(mob/living/user, close_valve, obj/item/tank/new_tank)
/obj/machinery/atmospherics/portable/proc/replace_tank(mob/living/user, close_valve, obj/item/tank/new_tank)
if(holding_tank)
holding_tank.forceMove(drop_location())
if(Adjacent(user) && !issilicon(user))
@@ -108,7 +115,7 @@
update_icon()
return TRUE
/obj/machinery/portable_atmospherics/attackby(obj/item/W, mob/user, params)
/obj/machinery/atmospherics/portable/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/tank))
if(!(stat & BROKEN))
if(!user.drop_item())
@@ -127,7 +134,7 @@
return
return ..()
/obj/machinery/portable_atmospherics/wrench_act(mob/user, obj/item/I)
/obj/machinery/atmospherics/portable/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
@@ -148,7 +155,7 @@
else
to_chat(user, "<span class='notice'>Nothing happens.</span>")
/obj/machinery/portable_atmospherics/attacked_by(obj/item/I, mob/user)
/obj/machinery/atmospherics/portable/attacked_by(obj/item/I, mob/user)
if(I.force < 10 && !(stat & BROKEN))
take_damage(0)
else
@@ -6,35 +6,33 @@
/// The pump will be pumping gas out.
#define DIRECTION_OUT 1
/obj/machinery/portable_atmospherics/pump
/obj/machinery/atmospherics/portable/pump
name = "Portable Air Pump"
icon = 'icons/obj/atmos.dmi'
icon_state = "psiphon:0"
density = TRUE
volume = 1000
/// If the pump is turned on or off.
var/on = FALSE
/// The direction the pump is operating in. This should be either `DIRECTION_IN` or `DIRECTION_OUT`.
var/direction = DIRECTION_IN
/// The desired pressure the pump should be outputting, either into the atmosphere, or into a holding tank.
var/target_pressure = 101.325
target_pressure = 101.325
/obj/machinery/portable_atmospherics/pump/detailed_examine()
/obj/machinery/atmospherics/portable/pump/detailed_examine()
return "Invaluable for filling air in a room rapidly after a breach repair. The internal gas container can be filled by \
connecting it to a connector port. The pump can pump the air in (sucking) or out (blowing), at a specific target pressure. The powercell inside can be \
replaced by using a screwdriver, and then adding a new cell. A tank of gas can also be attached to the air pump."
/obj/machinery/portable_atmospherics/pump/update_icon_state()
/obj/machinery/atmospherics/portable/pump/update_icon_state()
icon_state = "psiphon:[on]"
/obj/machinery/portable_atmospherics/pump/update_overlays()
/obj/machinery/atmospherics/portable/pump/update_overlays()
. = ..()
if(holding_tank)
. += "siphon-open"
if(connected_port)
. += "siphon-connector"
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
/obj/machinery/atmospherics/portable/pump/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
@@ -50,7 +48,7 @@
..(severity)
/obj/machinery/portable_atmospherics/pump/process_atmos()
/obj/machinery/atmospherics/portable/pump/process_atmos()
..()
if(on)
var/datum/gas_mixture/environment
@@ -94,10 +92,10 @@
return
/obj/machinery/portable_atmospherics/pump/return_air()
/obj/machinery/atmospherics/portable/pump/return_air()
return air_contents
/obj/machinery/portable_atmospherics/pump/replace_tank(mob/living/user, close_valve)
/obj/machinery/atmospherics/portable/pump/replace_tank(mob/living/user, close_valve)
. = ..()
if(.)
if(close_valve)
@@ -107,23 +105,23 @@
else if(on && holding_tank && direction == DIRECTION_OUT)
investigate_log("[key_name(user)] started a transfer into [holding_tank].<br>", "atmos")
/obj/machinery/portable_atmospherics/pump/attack_ai(mob/user)
/obj/machinery/atmospherics/portable/pump/attack_ai(mob/user)
add_hiddenprint(user)
return attack_hand(user)
/obj/machinery/portable_atmospherics/pump/attack_ghost(mob/user)
/obj/machinery/atmospherics/portable/pump/attack_ghost(mob/user)
return attack_hand(user)
/obj/machinery/portable_atmospherics/pump/attack_hand(mob/user)
/obj/machinery/atmospherics/portable/pump/attack_hand(mob/user)
ui_interact(user)
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
/obj/machinery/atmospherics/portable/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "PortablePump", "Portable Pump", 434, 377, master_ui, state)
ui.open()
/obj/machinery/portable_atmospherics/pump/ui_data(mob/user)
/obj/machinery/atmospherics/portable/pump/ui_data(mob/user)
var/list/data = list(
"on" = on,
"direction" = direction,
@@ -140,7 +138,7 @@
return data
/obj/machinery/portable_atmospherics/pump/ui_act(action, list/params)
/obj/machinery/atmospherics/portable/pump/ui_act(action, list/params)
if(..())
return
@@ -1,25 +1,23 @@
#define MAX_RATE 10 * ONE_ATMOSPHERE
/obj/machinery/portable_atmospherics/scrubber
/obj/machinery/atmospherics/portable/scrubber
name = "Portable Air Scrubber"
icon = 'icons/obj/atmos.dmi'
icon_state = "pscrubber:0"
density = TRUE
volume = 750
/// Whether the scrubber is switched on or off.
var/on = FALSE
/// The volume of gas that can be scrubbed every time `process_atmos()` is called (0.5 seconds).
var/volume_rate = 101.325
/// Is this scrubber acting on the 3x3 area around it.
var/widenet = FALSE
/obj/machinery/portable_atmospherics/scrubber/detailed_examine()
/obj/machinery/atmospherics/portable/scrubber/detailed_examine()
return "Filters the air, placing harmful gases into the internal gas container. The container can be emptied by \
connecting it to a connector port. The pump can pump the air in (sucking) or out (blowing), at a specific target pressure. The powercell inside can be \
replaced by using a screwdriver, and then adding a new cell. A tank of gas can also be attached to the scrubber."
/obj/machinery/portable_atmospherics/scrubber/emp_act(severity)
/obj/machinery/atmospherics/portable/scrubber/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
@@ -30,20 +28,20 @@
..(severity)
/obj/machinery/portable_atmospherics/scrubber/update_icon_state()
/obj/machinery/atmospherics/portable/scrubber/update_icon_state()
if(on)
icon_state = "pscrubber:1"
else
icon_state = "pscrubber:0"
/obj/machinery/portable_atmospherics/scrubber/update_overlays()
/obj/machinery/atmospherics/portable/scrubber/update_overlays()
. = ..()
if(holding_tank)
. += "scrubber-open"
if(connected_port)
. += "scrubber-connector"
/obj/machinery/portable_atmospherics/scrubber/process_atmos()
/obj/machinery/atmospherics/portable/scrubber/process_atmos()
..()
if(!on)
@@ -55,7 +53,7 @@
for(var/turf/simulated/tile in T.GetAtmosAdjacentTurfs(alldir=1))
scrub(tile)
/obj/machinery/portable_atmospherics/scrubber/proc/scrub(turf/simulated/tile)
/obj/machinery/atmospherics/portable/scrubber/proc/scrub(turf/simulated/tile)
var/datum/gas_mixture/environment
if(holding_tank)
environment = holding_tank.air_contents
@@ -98,28 +96,28 @@
tile.assume_air(removed)
tile.air_update_turf()
/obj/machinery/portable_atmospherics/scrubber/return_air()
/obj/machinery/atmospherics/portable/scrubber/return_air()
return air_contents
/obj/machinery/portable_atmospherics/scrubber/attack_ai(mob/user)
/obj/machinery/atmospherics/portable/scrubber/attack_ai(mob/user)
add_hiddenprint(user)
return attack_hand(user)
/obj/machinery/portable_atmospherics/scrubber/attack_ghost(mob/user)
/obj/machinery/atmospherics/portable/scrubber/attack_ghost(mob/user)
return attack_hand(user)
/obj/machinery/portable_atmospherics/scrubber/attack_hand(mob/user)
/obj/machinery/atmospherics/portable/scrubber/attack_hand(mob/user)
ui_interact(user)
return
/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
/obj/machinery/atmospherics/portable/scrubber/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "PortableScrubber", "Portable Scrubber", 433, 346, master_ui, state)
ui.open()
ui.set_autoupdate(TRUE)
/obj/machinery/portable_atmospherics/scrubber/ui_data(mob/user)
/obj/machinery/atmospherics/portable/scrubber/ui_data(mob/user)
var/list/data = list(
"on" = on,
"port_connected" = connected_port ? TRUE : FALSE,
@@ -135,7 +133,7 @@
return data
/obj/machinery/portable_atmospherics/scrubber/ui_act(action, list/params)
/obj/machinery/atmospherics/portable/scrubber/ui_act(action, list/params)
if(..())
return
@@ -158,7 +156,7 @@
add_fingerprint(usr)
/obj/machinery/portable_atmospherics/scrubber/huge
/obj/machinery/atmospherics/portable/scrubber/huge
name = "Huge Air Scrubber"
icon_state = "scrubber:0"
anchored = TRUE
@@ -170,26 +168,26 @@
var/id = 0
var/stationary = FALSE
/obj/machinery/portable_atmospherics/scrubber/huge/New()
/obj/machinery/atmospherics/portable/scrubber/huge/New()
..()
id = gid
gid++
name = "[name] (ID [id])"
/obj/machinery/portable_atmospherics/scrubber/huge/attack_hand(mob/user)
/obj/machinery/atmospherics/portable/scrubber/huge/attack_hand(mob/user)
to_chat(usr, "<span class='warning'>You can't directly interact with this machine. Use the area atmos computer.</span>")
/obj/machinery/portable_atmospherics/scrubber/huge/update_icon_state()
/obj/machinery/atmospherics/portable/scrubber/huge/update_icon_state()
icon_state = "scrubber:[on]"
/obj/machinery/portable_atmospherics/scrubber/huge/attackby(obj/item/W, mob/user, params)
/obj/machinery/atmospherics/portable/scrubber/huge/attackby(obj/item/W, mob/user, params)
if((istype(W, /obj/item/analyzer)) && get_dist(user, src) <= 1)
atmosanalyzer_scan(air_contents, user)
return
return ..()
/obj/machinery/portable_atmospherics/scrubber/huge/wrench_act(mob/user, obj/item/I)
/obj/machinery/atmospherics/portable/scrubber/huge/wrench_act(mob/user, obj/item/I)
. = TRUE
if(stationary)
to_chat(user, "<span class='warning'>The bolts are too tight for you to unscrew!</span>")
@@ -202,7 +200,7 @@
anchored = !anchored
to_chat(user, "<span class='notice'>You [anchored ? "wrench" : "unwrench"] [src].</span>")
/obj/machinery/portable_atmospherics/scrubber/huge/stationary
/obj/machinery/atmospherics/portable/scrubber/huge/stationary
name = "Stationary Air Scrubber"
stationary = TRUE