Merge remote-tracking branch 'refs/remotes/origin/master' into custom_roundstart_items
# Conflicts: # code/controllers/configuration.dm # code/game/objects/items.dm
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
if(!blocks_air)
|
||||
air = new
|
||||
air.copy_from_turf(src)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
/turf/open/Destroy()
|
||||
if(active_hotspot)
|
||||
|
||||
@@ -3,7 +3,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
/proc/meta_gas_list()
|
||||
. = new /list
|
||||
for(var/gas_path in subtypesof(/datum/gas))
|
||||
var/list/gas_info = new(4)
|
||||
var/list/gas_info = new(5)
|
||||
var/datum/gas/gas = gas_path
|
||||
|
||||
gas_info[META_GAS_SPECIFIC_HEAT] = initial(gas.specific_heat)
|
||||
@@ -11,6 +11,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
gas_info[META_GAS_MOLES_VISIBLE] = initial(gas.moles_visible)
|
||||
if(initial(gas.moles_visible) != null)
|
||||
gas_info[META_GAS_OVERLAY] = new /obj/effect/overlay/gas(initial(gas.gas_overlay))
|
||||
gas_info[META_GAS_DANGER] = initial(gas.dangerous)
|
||||
.[initial(gas.id)] = gas_info
|
||||
|
||||
/*||||||||||||||/----------\||||||||||||||*\
|
||||
@@ -28,6 +29,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
var/name = ""
|
||||
var/gas_overlay = "" //icon_state in icons/effects/tile_effects.dmi
|
||||
var/moles_visible = null
|
||||
var/dangerous = FALSE //currently used by canisters
|
||||
|
||||
/datum/gas/oxygen
|
||||
id = "o2"
|
||||
@@ -50,6 +52,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
name = "Plasma"
|
||||
gas_overlay = "plasma"
|
||||
moles_visible = MOLES_PLASMA_VISIBLE
|
||||
dangerous = TRUE
|
||||
|
||||
/datum/gas/water_vapor
|
||||
id = "water_vapor"
|
||||
@@ -64,6 +67,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
name = "Freon"
|
||||
gas_overlay = "freon"
|
||||
moles_visible = MOLES_PLASMA_VISIBLE
|
||||
dangerous = TRUE
|
||||
|
||||
/datum/gas/nitrous_oxide
|
||||
id = "n2o"
|
||||
@@ -71,6 +75,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
name = "Nitrous Oxide"
|
||||
gas_overlay = "nitrous_oxide"
|
||||
moles_visible = 1
|
||||
dangerous = TRUE
|
||||
|
||||
/datum/gas/oxygen_agent_b
|
||||
id = "agent_b"
|
||||
@@ -86,6 +91,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
id = "bz"
|
||||
specific_heat = 20
|
||||
name = "BZ"
|
||||
dangerous = TRUE
|
||||
|
||||
/obj/effect/overlay/gas
|
||||
icon = 'icons/effects/tile_effects.dmi'
|
||||
@@ -95,4 +101,4 @@ GLOBAL_LIST_INIT(hardcoded_gases, list("o2","n2","co2","plasma")) //the main fou
|
||||
|
||||
/obj/effect/overlay/gas/New(state)
|
||||
. = ..()
|
||||
icon_state = state
|
||||
icon_state = state
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell
|
||||
name = "cryo cell"
|
||||
icon = 'icons/obj/cryogenics.dmi'
|
||||
icon_state = "cell-off"
|
||||
icon_state = "pod0"
|
||||
density = 1
|
||||
anchored = 1
|
||||
obj_integrity = 350
|
||||
@@ -12,6 +12,7 @@
|
||||
state_open = FALSE
|
||||
var/autoeject = FALSE
|
||||
var/volume = 100
|
||||
var/running_bob_animation = FALSE
|
||||
|
||||
var/efficiency = 1
|
||||
var/sleep_factor = 750
|
||||
@@ -87,17 +88,59 @@
|
||||
beaker = null
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/update_icon()
|
||||
handle_update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/handle_update_icon() //making another proc to avoid spam in update_icon
|
||||
overlays.Cut() //empty the overlay proc, just in case
|
||||
|
||||
if(panel_open)
|
||||
icon_state = "cell-o"
|
||||
icon_state = "pod0-o"
|
||||
else if(state_open)
|
||||
icon_state = "cell-open"
|
||||
icon_state = "pod0"
|
||||
else if(on && is_operational())
|
||||
if(occupant)
|
||||
icon_state = "cell-occupied"
|
||||
var/image/pickle = image(occupant.icon, occupant.icon_state)
|
||||
pickle.overlays = occupant.overlays
|
||||
pickle.pixel_y = 22
|
||||
overlays += pickle
|
||||
icon_state = "pod1"
|
||||
var/up = 0 //used to see if we are going up or down, 1 is down, 2 is up
|
||||
spawn(0) // Without this, the icon update will block. The new thread will die once the occupant leaves.
|
||||
running_bob_animation = TRUE
|
||||
while(occupant)
|
||||
overlays -= "lid1" //have to remove the overlays first, to force an update- remove cloning pod overlay
|
||||
overlays -= pickle //remove mob overlay
|
||||
|
||||
switch(pickle.pixel_y) //this looks messy as fuck but it works, switch won't call itself twice
|
||||
|
||||
if(23) //inbetween state, for smoothness
|
||||
switch(up) //this is set later in the switch, to keep track of where the mob is supposed to go
|
||||
if(2) //2 is up
|
||||
pickle.pixel_y = 24 //set to highest
|
||||
|
||||
if(1) //1 is down
|
||||
pickle.pixel_y = 22 //set to lowest
|
||||
|
||||
if(22) //mob is at it's lowest
|
||||
pickle.pixel_y = 23 //set to inbetween
|
||||
up = 2 //have to go up
|
||||
|
||||
if(24) //mob is at it's highest
|
||||
pickle.pixel_y = 23 //set to inbetween
|
||||
up = 1 //have to go down
|
||||
|
||||
overlays += pickle //re-add the mob to the icon
|
||||
overlays += "lid1" //re-add the overlay of the pod, they are inside it, not floating
|
||||
|
||||
sleep(7) //don't want to jiggle violently, just slowly bob
|
||||
return
|
||||
running_bob_animation = FALSE
|
||||
else
|
||||
icon_state = "cell-on"
|
||||
icon_state = "pod1"
|
||||
overlays += "lid0" //have to remove the overlays first, to force an update- remove cloning pod overlay
|
||||
else
|
||||
icon_state = "cell-off"
|
||||
icon_state = "pod0"
|
||||
overlays += "lid0" //if no occupant, just put the lid overlay on, and ignore the rest
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/process()
|
||||
..()
|
||||
@@ -110,8 +153,8 @@
|
||||
return
|
||||
var/datum/gas_mixture/air1 = AIR1
|
||||
var/turf/T = get_turf(src)
|
||||
if(isliving(occupant))
|
||||
var/mob/living/mob_occupant
|
||||
if(occupant)
|
||||
var/mob/living/mob_occupant = occupant
|
||||
if(mob_occupant.health >= 100) // Don't bother with fully healed people.
|
||||
on = FALSE
|
||||
update_icon()
|
||||
@@ -149,7 +192,7 @@
|
||||
on = FALSE
|
||||
update_icon()
|
||||
return
|
||||
if(isliving(occupant))
|
||||
if(occupant)
|
||||
var/mob/living/mob_occupant = occupant
|
||||
var/cold_protection = 0
|
||||
var/mob/living/carbon/human/H = occupant
|
||||
@@ -226,9 +269,10 @@
|
||||
"<span class='notice'>You place [I] in [src].</span>")
|
||||
var/reagentlist = pretty_string_from_reagent_list(I.reagents.reagent_list)
|
||||
log_game("[key_name(user)] added an [I] to cyro containing [reagentlist]")
|
||||
|
||||
return
|
||||
if(!on && !occupant && !state_open)
|
||||
if(default_deconstruction_screwdriver(user, "cell-o", "cell-off", I))
|
||||
if(default_deconstruction_screwdriver(user, "pod0-o", "pod0", I))
|
||||
return
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
@@ -255,7 +299,7 @@
|
||||
data["autoEject"] = autoeject
|
||||
|
||||
var/list/occupantData = list()
|
||||
if(isliving(occupant))
|
||||
if(occupant)
|
||||
var/mob/living/mob_occupant = occupant
|
||||
occupantData["name"] = mob_occupant.name
|
||||
occupantData["stat"] = mob_occupant.stat
|
||||
@@ -317,4 +361,4 @@
|
||||
return //can't ventcrawl in or out of cryo.
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/can_see_pipes()
|
||||
return 0 //you can't see the pipe network when inside a cryo cell.
|
||||
return 0 //you can't see the pipe network when inside a cryo cell.
|
||||
@@ -1,12 +0,0 @@
|
||||
diff a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm (rejected hunks)
|
||||
@@ -110,8 +110,8 @@
|
||||
return
|
||||
var/datum/gas_mixture/air1 = AIR1
|
||||
var/turf/T = get_turf(src)
|
||||
- if(isliving(occupant))
|
||||
- var/mob/living/mob_occupant
|
||||
+ if(occupant)
|
||||
+ var/mob/living/mob_occupant = occupant
|
||||
if(mob_occupant.health >= 100) // Don't bother with fully healed people.
|
||||
on = FALSE
|
||||
update_icon()
|
||||
@@ -1,134 +1,134 @@
|
||||
/obj/machinery/meter
|
||||
name = "gas flow meter"
|
||||
desc = "It measures something."
|
||||
icon = 'icons/obj/meter.dmi'
|
||||
icon_state = "meterX"
|
||||
var/atom/target = null
|
||||
anchored = 1
|
||||
power_channel = ENVIRON
|
||||
var/frequency = 0
|
||||
var/id_tag
|
||||
use_power = 1
|
||||
idle_power_usage = 2
|
||||
active_power_usage = 4
|
||||
obj_integrity = 150
|
||||
max_integrity = 150
|
||||
armor = list(melee = 0, bullet = 0, laser = 0, energy = 100, bomb = 0, bio = 100, rad = 100, fire = 40, acid = 0)
|
||||
|
||||
|
||||
/obj/machinery/meter
|
||||
name = "gas flow meter"
|
||||
desc = "It measures something."
|
||||
icon = 'icons/obj/meter.dmi'
|
||||
icon_state = "meterX"
|
||||
var/atom/target = null
|
||||
anchored = 1
|
||||
power_channel = ENVIRON
|
||||
var/frequency = 0
|
||||
var/id_tag
|
||||
use_power = 1
|
||||
idle_power_usage = 2
|
||||
active_power_usage = 4
|
||||
obj_integrity = 150
|
||||
max_integrity = 150
|
||||
armor = list(melee = 0, bullet = 0, laser = 0, energy = 100, bomb = 0, bio = 100, rad = 100, fire = 40, acid = 0)
|
||||
|
||||
|
||||
/obj/machinery/meter/Initialize(mapload)
|
||||
. = ..()
|
||||
SSair.atmos_machinery += src
|
||||
SSair.atmos_machinery += src
|
||||
if (mapload && !target)
|
||||
target = locate(/obj/machinery/atmospherics/pipe) in loc
|
||||
|
||||
/obj/machinery/meter/Destroy()
|
||||
SSair.atmos_machinery -= src
|
||||
src.target = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/meter/process_atmos()
|
||||
if(!target)
|
||||
icon_state = "meterX"
|
||||
return 0
|
||||
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
icon_state = "meter0"
|
||||
return 0
|
||||
|
||||
use_power(5)
|
||||
|
||||
var/datum/gas_mixture/environment = target.return_air()
|
||||
if(!environment)
|
||||
icon_state = "meterX"
|
||||
return 0
|
||||
|
||||
var/env_pressure = environment.return_pressure()
|
||||
if(env_pressure <= 0.15*ONE_ATMOSPHERE)
|
||||
icon_state = "meter0"
|
||||
else if(env_pressure <= 1.8*ONE_ATMOSPHERE)
|
||||
var/val = round(env_pressure/(ONE_ATMOSPHERE*0.3) + 0.5)
|
||||
icon_state = "meter1_[val]"
|
||||
else if(env_pressure <= 30*ONE_ATMOSPHERE)
|
||||
var/val = round(env_pressure/(ONE_ATMOSPHERE*5)-0.35) + 1
|
||||
icon_state = "meter2_[val]"
|
||||
else if(env_pressure <= 59*ONE_ATMOSPHERE)
|
||||
var/val = round(env_pressure/(ONE_ATMOSPHERE*5) - 6) + 1
|
||||
icon_state = "meter3_[val]"
|
||||
else
|
||||
icon_state = "meter4"
|
||||
|
||||
if(frequency)
|
||||
var/datum/radio_frequency/radio_connection = SSradio.return_frequency(frequency)
|
||||
|
||||
if(!radio_connection)
|
||||
return
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.source = src
|
||||
signal.transmission_method = 1
|
||||
signal.data = list(
|
||||
"id_tag" = id_tag,
|
||||
"device" = "AM",
|
||||
"pressure" = round(env_pressure),
|
||||
"sigtype" = "status"
|
||||
)
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
/obj/machinery/meter/proc/status()
|
||||
var/t = ""
|
||||
if (src.target)
|
||||
var/datum/gas_mixture/environment = target.return_air()
|
||||
if(environment)
|
||||
t += "The pressure gauge reads [round(environment.return_pressure(), 0.01)] kPa; [round(environment.temperature,0.01)] K ([round(environment.temperature-T0C,0.01)]°C)"
|
||||
else
|
||||
t += "The sensor error light is blinking."
|
||||
else
|
||||
t += "The connect error light is blinking."
|
||||
return t
|
||||
|
||||
/obj/machinery/meter/examine(mob/user)
|
||||
..()
|
||||
to_chat(user, status())
|
||||
|
||||
|
||||
/obj/machinery/meter/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if (istype(W, /obj/item/weapon/wrench))
|
||||
playsound(src.loc, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
|
||||
if (do_after(user, 40*W.toolspeed, target = src))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"<span class='notice'>You unfasten \the [src].</span>", \
|
||||
"<span class='italics'>You hear ratchet.</span>")
|
||||
new /obj/item/pipe_meter(src.loc)
|
||||
qdel(src)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/meter/attack_ai(mob/user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/meter/attack_paw(mob/user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/meter/attack_hand(mob/user)
|
||||
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return 1
|
||||
else
|
||||
to_chat(usr, status())
|
||||
return 1
|
||||
|
||||
/obj/machinery/meter/singularity_pull(S, current_size)
|
||||
if(current_size >= STAGE_FIVE)
|
||||
new /obj/item/pipe_meter(loc)
|
||||
qdel(src)
|
||||
|
||||
// TURF METER - REPORTS A TILE'S AIR CONTENTS
|
||||
// why are you yelling?
|
||||
/obj/machinery/meter/turf
|
||||
|
||||
/obj/machinery/meter/turf/Initialize()
|
||||
..()
|
||||
src.target = loc
|
||||
|
||||
/obj/machinery/meter/Destroy()
|
||||
SSair.atmos_machinery -= src
|
||||
src.target = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/meter/process_atmos()
|
||||
if(!target)
|
||||
icon_state = "meterX"
|
||||
return 0
|
||||
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
icon_state = "meter0"
|
||||
return 0
|
||||
|
||||
use_power(5)
|
||||
|
||||
var/datum/gas_mixture/environment = target.return_air()
|
||||
if(!environment)
|
||||
icon_state = "meterX"
|
||||
return 0
|
||||
|
||||
var/env_pressure = environment.return_pressure()
|
||||
if(env_pressure <= 0.15*ONE_ATMOSPHERE)
|
||||
icon_state = "meter0"
|
||||
else if(env_pressure <= 1.8*ONE_ATMOSPHERE)
|
||||
var/val = round(env_pressure/(ONE_ATMOSPHERE*0.3) + 0.5)
|
||||
icon_state = "meter1_[val]"
|
||||
else if(env_pressure <= 30*ONE_ATMOSPHERE)
|
||||
var/val = round(env_pressure/(ONE_ATMOSPHERE*5)-0.35) + 1
|
||||
icon_state = "meter2_[val]"
|
||||
else if(env_pressure <= 59*ONE_ATMOSPHERE)
|
||||
var/val = round(env_pressure/(ONE_ATMOSPHERE*5) - 6) + 1
|
||||
icon_state = "meter3_[val]"
|
||||
else
|
||||
icon_state = "meter4"
|
||||
|
||||
if(frequency)
|
||||
var/datum/radio_frequency/radio_connection = SSradio.return_frequency(frequency)
|
||||
|
||||
if(!radio_connection)
|
||||
return
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.source = src
|
||||
signal.transmission_method = 1
|
||||
signal.data = list(
|
||||
"id_tag" = id_tag,
|
||||
"device" = "AM",
|
||||
"pressure" = round(env_pressure),
|
||||
"sigtype" = "status"
|
||||
)
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
/obj/machinery/meter/proc/status()
|
||||
var/t = ""
|
||||
if (src.target)
|
||||
var/datum/gas_mixture/environment = target.return_air()
|
||||
if(environment)
|
||||
t += "The pressure gauge reads [round(environment.return_pressure(), 0.01)] kPa; [round(environment.temperature,0.01)] K ([round(environment.temperature-T0C,0.01)]°C)"
|
||||
else
|
||||
t += "The sensor error light is blinking."
|
||||
else
|
||||
t += "The connect error light is blinking."
|
||||
return t
|
||||
|
||||
/obj/machinery/meter/examine(mob/user)
|
||||
..()
|
||||
to_chat(user, status())
|
||||
|
||||
|
||||
/obj/machinery/meter/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if (istype(W, /obj/item/weapon/wrench))
|
||||
playsound(src.loc, W.usesound, 50, 1)
|
||||
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
|
||||
if (do_after(user, 40*W.toolspeed, target = src))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"<span class='notice'>You unfasten \the [src].</span>", \
|
||||
"<span class='italics'>You hear ratchet.</span>")
|
||||
new /obj/item/pipe_meter(src.loc)
|
||||
qdel(src)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/meter/attack_ai(mob/user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/meter/attack_paw(mob/user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/meter/attack_hand(mob/user)
|
||||
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return 1
|
||||
else
|
||||
to_chat(usr, status())
|
||||
return 1
|
||||
|
||||
/obj/machinery/meter/singularity_pull(S, current_size)
|
||||
if(current_size >= STAGE_FIVE)
|
||||
new /obj/item/pipe_meter(loc)
|
||||
qdel(src)
|
||||
|
||||
// TURF METER - REPORTS A TILE'S AIR CONTENTS
|
||||
// why are you yelling?
|
||||
/obj/machinery/meter/turf
|
||||
|
||||
/obj/machinery/meter/turf/Initialize()
|
||||
..()
|
||||
src.target = loc
|
||||
|
||||
@@ -395,25 +395,21 @@
|
||||
if(valve_open)
|
||||
logmsg = "Valve was <b>opened</b> by [key_name(usr)], starting a transfer into \the [holding || "air"].<br>"
|
||||
if(!holding)
|
||||
var/plasma = air_contents.gases["plasma"]
|
||||
var/n2o = air_contents.gases["n2o"]
|
||||
var/bz = air_contents.gases["bz"]
|
||||
var/freon = air_contents.gases["freon"]
|
||||
if(n2o || plasma || bz || freon)
|
||||
var/list/danger = list()
|
||||
for(var/id in air_contents.gases)
|
||||
var/gas = air_contents.gases[id]
|
||||
if(!gas[GAS_META][META_GAS_DANGER])
|
||||
continue
|
||||
if(gas[MOLES] > (gas[GAS_META][META_GAS_MOLES_VISIBLE] || MOLES_PLASMA_VISIBLE)) //if moles_visible is undefined, default to plasma visibility
|
||||
danger[gas[GAS_META][META_GAS_NAME]] = gas[MOLES] //ex. "plasma" = 20
|
||||
|
||||
if(danger.len)
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] opened a canister that contains the following: [ADMIN_JMP(src)]")
|
||||
log_admin("[key_name(usr)] opened a canister that contains the following at [COORD(src)]:")
|
||||
if(plasma)
|
||||
log_admin("Plasma")
|
||||
message_admins("Plasma")
|
||||
if(n2o)
|
||||
log_admin("N2O")
|
||||
message_admins("N2O")
|
||||
if(bz)
|
||||
log_admin("BZ Gas")
|
||||
message_admins("BZ Gas")
|
||||
if(freon)
|
||||
log_admin("Freon")
|
||||
message_admins("Freon")
|
||||
for(var/name in danger)
|
||||
var/msg = "[name]: [danger[name]] moles."
|
||||
log_admin(msg)
|
||||
message_admins(msg)
|
||||
else
|
||||
logmsg = "Valve was <b>closed</b> by [key_name(usr)], stopping the transfer into \the [holding || "air"].<br>"
|
||||
investigate_log(logmsg, "atmos")
|
||||
@@ -447,6 +443,4 @@
|
||||
holding.forceMove(get_turf(src))
|
||||
holding = null
|
||||
. = TRUE
|
||||
update_icon()
|
||||
|
||||
|
||||
update_icon()
|
||||
@@ -1,142 +1,142 @@
|
||||
#define PUMP_OUT "out"
|
||||
#define PUMP_IN "in"
|
||||
#define PUMP_MAX_PRESSURE (ONE_ATMOSPHERE * 30)
|
||||
#define PUMP_MIN_PRESSURE (ONE_ATMOSPHERE / 10)
|
||||
#define PUMP_DEFAULT_PRESSURE (ONE_ATMOSPHERE)
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump
|
||||
name = "portable air pump"
|
||||
icon_state = "psiphon:0"
|
||||
density = 1
|
||||
|
||||
var/on = FALSE
|
||||
var/direction = PUMP_OUT
|
||||
var/obj/machinery/atmospherics/components/binary/pump/pump
|
||||
|
||||
volume = 1000
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Initialize()
|
||||
..()
|
||||
pump = new(src, FALSE)
|
||||
pump.on = TRUE
|
||||
pump.stat = 0
|
||||
pump.build_network()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
qdel(pump)
|
||||
pump = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/update_icon()
|
||||
icon_state = "psiphon:[on]"
|
||||
|
||||
cut_overlays()
|
||||
if(holding)
|
||||
add_overlay("siphon-open")
|
||||
if(connected_port)
|
||||
add_overlay("siphon-connector")
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
pump.AIR1 = null
|
||||
pump.AIR2 = null
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(direction == PUMP_OUT) // Hook up the internal pump.
|
||||
pump.AIR1 = holding ? holding.air_contents : air_contents
|
||||
pump.AIR2 = holding ? air_contents : T.return_air()
|
||||
else
|
||||
pump.AIR1 = holding ? air_contents : T.return_air()
|
||||
pump.AIR2 = holding ? holding.air_contents : air_contents
|
||||
|
||||
pump.process_atmos() // Pump gas.
|
||||
if(!holding)
|
||||
air_update_turf() // Update the environment if needed.
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
|
||||
if(is_operational())
|
||||
if(prob(50 / severity))
|
||||
on = !on
|
||||
if(prob(100 / severity))
|
||||
direction = PUMP_OUT
|
||||
pump.target_pressure = rand(0, 100 * ONE_ATMOSPHERE)
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||
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, "portable_pump", name, 420, 415, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["direction"] = direction
|
||||
data["connected"] = connected_port ? 1 : 0
|
||||
data["pressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
data["target_pressure"] = round(pump.target_pressure ? pump.target_pressure : 0)
|
||||
data["default_pressure"] = round(PUMP_DEFAULT_PRESSURE)
|
||||
data["min_pressure"] = round(PUMP_MIN_PRESSURE)
|
||||
data["max_pressure"] = round(PUMP_MAX_PRESSURE)
|
||||
|
||||
if(holding)
|
||||
data["holding"] = list()
|
||||
data["holding"]["name"] = holding.name
|
||||
data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
|
||||
return data
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
if(on && !holding)
|
||||
var/plasma = air_contents.gases["plasma"]
|
||||
var/n2o = air_contents.gases["n2o"]
|
||||
if(n2o || plasma)
|
||||
#define PUMP_OUT "out"
|
||||
#define PUMP_IN "in"
|
||||
#define PUMP_MAX_PRESSURE (ONE_ATMOSPHERE * 30)
|
||||
#define PUMP_MIN_PRESSURE (ONE_ATMOSPHERE / 10)
|
||||
#define PUMP_DEFAULT_PRESSURE (ONE_ATMOSPHERE)
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump
|
||||
name = "portable air pump"
|
||||
icon_state = "psiphon:0"
|
||||
density = 1
|
||||
|
||||
var/on = FALSE
|
||||
var/direction = PUMP_OUT
|
||||
var/obj/machinery/atmospherics/components/binary/pump/pump
|
||||
|
||||
volume = 1000
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Initialize()
|
||||
..()
|
||||
pump = new(src, FALSE)
|
||||
pump.on = TRUE
|
||||
pump.stat = 0
|
||||
pump.build_network()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/Destroy()
|
||||
var/turf/T = get_turf(src)
|
||||
T.assume_air(air_contents)
|
||||
air_update_turf()
|
||||
qdel(pump)
|
||||
pump = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/update_icon()
|
||||
icon_state = "psiphon:[on]"
|
||||
|
||||
cut_overlays()
|
||||
if(holding)
|
||||
add_overlay("siphon-open")
|
||||
if(connected_port)
|
||||
add_overlay("siphon-connector")
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
pump.AIR1 = null
|
||||
pump.AIR2 = null
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(direction == PUMP_OUT) // Hook up the internal pump.
|
||||
pump.AIR1 = holding ? holding.air_contents : air_contents
|
||||
pump.AIR2 = holding ? air_contents : T.return_air()
|
||||
else
|
||||
pump.AIR1 = holding ? air_contents : T.return_air()
|
||||
pump.AIR2 = holding ? holding.air_contents : air_contents
|
||||
|
||||
pump.process_atmos() // Pump gas.
|
||||
if(!holding)
|
||||
air_update_turf() // Update the environment if needed.
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
|
||||
if(is_operational())
|
||||
if(prob(50 / severity))
|
||||
on = !on
|
||||
if(prob(100 / severity))
|
||||
direction = PUMP_OUT
|
||||
pump.target_pressure = rand(0, 100 * ONE_ATMOSPHERE)
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||
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, "portable_pump", name, 420, 415, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["direction"] = direction
|
||||
data["connected"] = connected_port ? 1 : 0
|
||||
data["pressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
data["target_pressure"] = round(pump.target_pressure ? pump.target_pressure : 0)
|
||||
data["default_pressure"] = round(PUMP_DEFAULT_PRESSURE)
|
||||
data["min_pressure"] = round(PUMP_MIN_PRESSURE)
|
||||
data["max_pressure"] = round(PUMP_MAX_PRESSURE)
|
||||
|
||||
if(holding)
|
||||
data["holding"] = list()
|
||||
data["holding"]["name"] = holding.name
|
||||
data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
|
||||
return data
|
||||
|
||||
/obj/machinery/portable_atmospherics/pump/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("power")
|
||||
on = !on
|
||||
if(on && !holding)
|
||||
var/plasma = air_contents.gases["plasma"]
|
||||
var/n2o = air_contents.gases["n2o"]
|
||||
if(n2o || plasma)
|
||||
var/area/A = get_area(src)
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [A][ADMIN_JMP(src)]")
|
||||
log_admin("[key_name(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [A][COORD(src)]")
|
||||
. = TRUE
|
||||
if("direction")
|
||||
if(direction == PUMP_OUT)
|
||||
direction = PUMP_IN
|
||||
else
|
||||
direction = PUMP_OUT
|
||||
. = TRUE
|
||||
if("pressure")
|
||||
var/pressure = params["pressure"]
|
||||
if(pressure == "reset")
|
||||
pressure = PUMP_DEFAULT_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "min")
|
||||
pressure = PUMP_MIN_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "max")
|
||||
pressure = PUMP_MAX_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "input")
|
||||
pressure = input("New release pressure ([PUMP_MIN_PRESSURE]-[PUMP_MAX_PRESSURE] kPa):", name, pump.target_pressure) as num|null
|
||||
if(!isnull(pressure) && !..())
|
||||
. = TRUE
|
||||
else if(text2num(pressure) != null)
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
pump.target_pressure = Clamp(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
||||
investigate_log("was set to [pump.target_pressure] kPa by [key_name(usr)].", "atmos")
|
||||
if("eject")
|
||||
if(holding)
|
||||
holding.loc = get_turf(src)
|
||||
holding = null
|
||||
. = TRUE
|
||||
. = TRUE
|
||||
if("direction")
|
||||
if(direction == PUMP_OUT)
|
||||
direction = PUMP_IN
|
||||
else
|
||||
direction = PUMP_OUT
|
||||
. = TRUE
|
||||
if("pressure")
|
||||
var/pressure = params["pressure"]
|
||||
if(pressure == "reset")
|
||||
pressure = PUMP_DEFAULT_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "min")
|
||||
pressure = PUMP_MIN_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "max")
|
||||
pressure = PUMP_MAX_PRESSURE
|
||||
. = TRUE
|
||||
else if(pressure == "input")
|
||||
pressure = input("New release pressure ([PUMP_MIN_PRESSURE]-[PUMP_MAX_PRESSURE] kPa):", name, pump.target_pressure) as num|null
|
||||
if(!isnull(pressure) && !..())
|
||||
. = TRUE
|
||||
else if(text2num(pressure) != null)
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
pump.target_pressure = Clamp(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
||||
investigate_log("was set to [pump.target_pressure] kPa by [key_name(usr)].", "atmos")
|
||||
if("eject")
|
||||
if(holding)
|
||||
holding.loc = get_turf(src)
|
||||
holding = null
|
||||
. = TRUE
|
||||
update_icon()
|
||||
Reference in New Issue
Block a user