mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-22 04:37:45 +01:00
Merge resolution with PDA nanoui.
This commit is contained in:
+5
-2
@@ -48,6 +48,7 @@
|
||||
#include "code\_onclick\hud\other_mobs.dm"
|
||||
#include "code\_onclick\hud\robot.dm"
|
||||
#include "code\_onclick\hud\screen_objects.dm"
|
||||
#include "code\ATMOSPHERICS\_atmos_setup.dm"
|
||||
#include "code\ATMOSPHERICS\atmospherics.dm"
|
||||
#include "code\ATMOSPHERICS\datum_pipe_network.dm"
|
||||
#include "code\ATMOSPHERICS\datum_pipeline.dm"
|
||||
@@ -334,7 +335,6 @@
|
||||
#include "code\game\machinery\atmoalter\portable_atmospherics.dm"
|
||||
#include "code\game\machinery\atmoalter\pump.dm"
|
||||
#include "code\game\machinery\atmoalter\scrubber.dm"
|
||||
#include "code\game\machinery\atmoalter\zvent.dm"
|
||||
#include "code\game\machinery\bots\bots.dm"
|
||||
#include "code\game\machinery\bots\cleanbot.dm"
|
||||
#include "code\game\machinery\bots\ed209bot.dm"
|
||||
@@ -982,6 +982,7 @@
|
||||
#include "code\modules\mob\living\carbon\metroid\login.dm"
|
||||
#include "code\modules\mob\living\carbon\metroid\metroid.dm"
|
||||
#include "code\modules\mob\living\carbon\metroid\powers.dm"
|
||||
#include "code\modules\mob\living\carbon\metroid\say.dm"
|
||||
#include "code\modules\mob\living\carbon\metroid\subtypes.dm"
|
||||
#include "code\modules\mob\living\carbon\metroid\update_icons.dm"
|
||||
#include "code\modules\mob\living\carbon\monkey\death.dm"
|
||||
@@ -1425,7 +1426,8 @@
|
||||
#include "code\WorkInProgress\SkyMarshal\Ultralight_procs.dm"
|
||||
#include "code\WorkInProgress\Wrongnumber\weldbackpack.dm"
|
||||
#include "code\ZAS\_docs.dm"
|
||||
#include "code\ZAS\_gas_mixture.dm"
|
||||
#include "code\ZAS\_gas_mixture_xgm.dm"
|
||||
#include "code\ZAS\_xgm_gas_data.dm"
|
||||
#include "code\ZAS\Airflow.dm"
|
||||
#include "code\ZAS\Atom.dm"
|
||||
#include "code\ZAS\Connection.dm"
|
||||
@@ -1435,6 +1437,7 @@
|
||||
#include "code\ZAS\Debug.dm"
|
||||
#include "code\ZAS\Diagnostic.dm"
|
||||
#include "code\ZAS\Fire.dm"
|
||||
#include "code\ZAS\Gas.dm"
|
||||
#include "code\ZAS\Phoron.dm"
|
||||
#include "code\ZAS\Turf.dm"
|
||||
#include "code\ZAS\Variable Settings.dm"
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
//--------------------------------------------
|
||||
// Pipe colors
|
||||
//
|
||||
// Add them here and to the pipe_colors list
|
||||
// to automatically add them to all relevant
|
||||
// atmospherics devices.
|
||||
//--------------------------------------------
|
||||
|
||||
#define PIPE_COLOR_GREY "#ffffff" //yes white is grey
|
||||
#define PIPE_COLOR_RED "#ff0000"
|
||||
#define PIPE_COLOR_BLUE "#0000ff"
|
||||
#define PIPE_COLOR_CYAN "#00ffff"
|
||||
#define PIPE_COLOR_GREEN "#00ff00"
|
||||
#define PIPE_COLOR_YELLOW "#ffcc00"
|
||||
#define PIPE_COLOR_PURPLE "#5c1ec0"
|
||||
|
||||
var/global/list/pipe_colors = list("grey" = PIPE_COLOR_GREY, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "purple" = PIPE_COLOR_PURPLE)
|
||||
|
||||
/proc/pipe_color_lookup(var/color)
|
||||
for(var/C in pipe_colors)
|
||||
if(color == pipe_colors[C])
|
||||
return "[C]"
|
||||
|
||||
/proc/pipe_color_check(var/color)
|
||||
if(!color)
|
||||
return 1
|
||||
for(var/C in pipe_colors)
|
||||
if(color == pipe_colors[C])
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//--------------------------------------------
|
||||
// Icon cache generation
|
||||
//--------------------------------------------
|
||||
|
||||
/datum/pipe_icon_manager
|
||||
var/list/pipe_icons[]
|
||||
var/list/manifold_icons[]
|
||||
var/list/device_icons[]
|
||||
var/list/underlays_down[]
|
||||
var/list/underlays_exposed[]
|
||||
var/list/underlays_intact[]
|
||||
var/list/pipe_underlays_exposed[]
|
||||
var/list/pipe_underlays_intact[]
|
||||
var/list/omni_icons[]
|
||||
|
||||
/datum/pipe_icon_manager/New()
|
||||
check_icons()
|
||||
|
||||
/datum/pipe_icon_manager/proc/get_atmos_icon(var/device, var/dir, var/color, var/state)
|
||||
check_icons()
|
||||
|
||||
device = "[device]"
|
||||
state = "[state]"
|
||||
color = "[color]"
|
||||
dir = "[dir]"
|
||||
|
||||
switch(device)
|
||||
if("pipe")
|
||||
return pipe_icons[state + color]
|
||||
if("manifold")
|
||||
return manifold_icons[state + color]
|
||||
if("device")
|
||||
return device_icons[state]
|
||||
if("omni")
|
||||
return omni_icons[state]
|
||||
if("underlay_intact")
|
||||
return underlays_intact[dir + color]
|
||||
if("underlay_exposed")
|
||||
return underlays_exposed[dir + color]
|
||||
if("underlay_down")
|
||||
return underlays_down[dir + color]
|
||||
if("pipe_underlay_exposed")
|
||||
return pipe_underlays_exposed[dir + color]
|
||||
if("pipe_underlay_intact")
|
||||
return pipe_underlays_intact[dir + color]
|
||||
|
||||
/datum/pipe_icon_manager/proc/check_icons()
|
||||
if(!pipe_icons)
|
||||
gen_pipe_icons()
|
||||
if(!manifold_icons)
|
||||
gen_manifold_icons()
|
||||
if(!device_icons)
|
||||
gen_device_icons()
|
||||
if(!omni_icons)
|
||||
gen_omni_icons()
|
||||
if(!underlays_intact || !underlays_down || !underlays_exposed || !pipe_underlays_exposed || !pipe_underlays_intact)
|
||||
gen_underlay_icons()
|
||||
|
||||
/datum/pipe_icon_manager/proc/gen_pipe_icons()
|
||||
if(!pipe_icons)
|
||||
pipe_icons = new()
|
||||
|
||||
var/icon/pipe = new('icons/atmos/pipes.dmi')
|
||||
|
||||
for(var/state in pipe.IconStates())
|
||||
if(!state || findtext(state, "map"))
|
||||
continue
|
||||
|
||||
var/cache_name = state
|
||||
var/image/I = image('icons/atmos/pipes.dmi', icon_state = state)
|
||||
pipe_icons[cache_name] = I
|
||||
|
||||
for(var/pipe_color in pipe_colors)
|
||||
I = image('icons/atmos/pipes.dmi', icon_state = state)
|
||||
I.color = pipe_colors[pipe_color]
|
||||
pipe_icons[state + "[pipe_colors[pipe_color]]"] = I
|
||||
|
||||
/datum/pipe_icon_manager/proc/gen_manifold_icons()
|
||||
if(!manifold_icons)
|
||||
manifold_icons = new()
|
||||
|
||||
var/icon/pipe = new('icons/atmos/manifold.dmi')
|
||||
|
||||
for(var/state in pipe.IconStates())
|
||||
if(findtext(state, "clamps"))
|
||||
var/image/I = image('icons/atmos/manifold.dmi', icon_state = state)
|
||||
manifold_icons[state] = I
|
||||
continue
|
||||
|
||||
if(state == "core" || state == "4way")
|
||||
var/image/I = image('icons/atmos/manifold.dmi', icon_state = state)
|
||||
manifold_icons[state] = I
|
||||
for(var/pipe_color in pipe_colors)
|
||||
I = image('icons/atmos/manifold.dmi', icon_state = state)
|
||||
I.color = pipe_colors[pipe_color]
|
||||
manifold_icons[state + pipe_colors[pipe_color]] = I
|
||||
|
||||
/datum/pipe_icon_manager/proc/gen_device_icons()
|
||||
if(!device_icons)
|
||||
device_icons = new()
|
||||
|
||||
var/icon/device
|
||||
|
||||
device = new('icons/atmos/vent_pump.dmi')
|
||||
for(var/state in device.IconStates())
|
||||
if(!state || findtext(state, "map"))
|
||||
continue
|
||||
device_icons["vent" + state] = image('icons/atmos/vent_pump.dmi', icon_state = state)
|
||||
|
||||
device = new('icons/atmos/vent_scrubber.dmi')
|
||||
for(var/state in device.IconStates())
|
||||
if(!state || findtext(state, "map"))
|
||||
continue
|
||||
device_icons["scrubber" + state] = image('icons/atmos/vent_scrubber.dmi', icon_state = state)
|
||||
|
||||
/datum/pipe_icon_manager/proc/gen_omni_icons()
|
||||
if(!omni_icons)
|
||||
omni_icons = new()
|
||||
|
||||
var/icon/omni = new('icons/atmos/omni_devices.dmi')
|
||||
|
||||
for(var/state in omni.IconStates())
|
||||
if(!state || findtext(state, "map"))
|
||||
continue
|
||||
omni_icons[state] = image('icons/atmos/omni_devices.dmi', icon_state = state)
|
||||
|
||||
/datum/pipe_icon_manager/proc/gen_underlay_icons()
|
||||
if(!underlays_intact)
|
||||
underlays_intact = new()
|
||||
if(!underlays_exposed)
|
||||
underlays_exposed = new()
|
||||
if(!underlays_down)
|
||||
underlays_down = new()
|
||||
if(!pipe_underlays_exposed)
|
||||
pipe_underlays_exposed = new()
|
||||
if(!pipe_underlays_intact)
|
||||
pipe_underlays_intact = new()
|
||||
|
||||
var/icon/pipe = new('icons/atmos/pipe_underlays.dmi')
|
||||
|
||||
for(var/state in pipe.IconStates())
|
||||
if(state == "")
|
||||
continue
|
||||
|
||||
for(var/D in cardinal)
|
||||
var/image/I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
|
||||
switch(state)
|
||||
if("intact")
|
||||
underlays_intact["[D]"] = I
|
||||
if("exposed")
|
||||
underlays_exposed["[D]"] = I
|
||||
if("down")
|
||||
underlays_down["[D]"] = I
|
||||
if("pipe_exposed")
|
||||
pipe_underlays_exposed["[D]"] = I
|
||||
if("pipe_intact")
|
||||
pipe_underlays_intact["[D]"] = I
|
||||
for(var/pipe_color in pipe_colors)
|
||||
I = image('icons/atmos/pipe_underlays.dmi', icon_state = state, dir = D)
|
||||
I.color = pipe_colors[pipe_color]
|
||||
switch(state)
|
||||
if("intact")
|
||||
underlays_intact["[D]" + pipe_colors[pipe_color]] = I
|
||||
if("exposed")
|
||||
underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
|
||||
if("down")
|
||||
underlays_down["[D]" + pipe_colors[pipe_color]] = I
|
||||
if("pipe_exposed")
|
||||
pipe_underlays_exposed["[D]" + pipe_colors[pipe_color]] = I
|
||||
if("pipe_intact")
|
||||
pipe_underlays_intact["[D]" + pipe_colors[pipe_color]] = I
|
||||
@@ -9,49 +9,96 @@ Pipes -> Pipelines
|
||||
Pipelines + Other Objects -> Pipe network
|
||||
|
||||
*/
|
||||
|
||||
obj/machinery/atmospherics
|
||||
/obj/machinery/atmospherics
|
||||
anchored = 1
|
||||
idle_power_usage = 0
|
||||
active_power_usage = 0
|
||||
power_channel = ENVIRON
|
||||
var/nodealert = 0
|
||||
|
||||
var/initialize_directions = 0
|
||||
var/pipe_color
|
||||
|
||||
var/global/datum/pipe_icon_manager/icon_manager
|
||||
|
||||
/obj/machinery/atmospherics/New()
|
||||
if(!icon_manager)
|
||||
icon_manager = new()
|
||||
|
||||
if(!pipe_color)
|
||||
pipe_color = color
|
||||
color = null
|
||||
|
||||
if(!pipe_color_check(pipe_color))
|
||||
pipe_color = null
|
||||
..()
|
||||
|
||||
obj/machinery/atmospherics/var/initialize_directions = 0
|
||||
obj/machinery/atmospherics/var/pipe_color
|
||||
/obj/machinery/atmospherics/attackby(atom/A, mob/user as mob)
|
||||
if(istype(A, /obj/item/device/pipe_painter))
|
||||
return
|
||||
..()
|
||||
|
||||
obj/machinery/atmospherics/process()
|
||||
/obj/machinery/atmospherics/proc/add_underlay(var/turf/T, var/obj/machinery/atmospherics/node, var/direction)
|
||||
if(node)
|
||||
if(T.intact && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
||||
underlays += icon_manager.get_atmos_icon("underlay_down", direction, color_cache_name(node))
|
||||
else
|
||||
underlays += icon_manager.get_atmos_icon("underlay_intact", direction, color_cache_name(node))
|
||||
else
|
||||
underlays += icon_manager.get_atmos_icon("underlay_exposed", direction, pipe_color)
|
||||
|
||||
/obj/machinery/atmospherics/proc/update_underlays()
|
||||
if(check_icon_cache())
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/machinery/atmospherics/proc/check_icon_cache(var/safety = 0)
|
||||
if(!istype(icon_manager))
|
||||
if(!safety) //to prevent infinite loops
|
||||
icon_manager = new()
|
||||
check_icon_cache(1)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/proc/color_cache_name(var/obj/machinery/atmospherics/node)
|
||||
//Don't use this for standard pipes
|
||||
if(!istype(node))
|
||||
return null
|
||||
|
||||
return node.pipe_color
|
||||
|
||||
/obj/machinery/atmospherics/process()
|
||||
build_network()
|
||||
|
||||
obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
/obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
// Check to see if should be added to network. Add self if so and adjust variables appropriately.
|
||||
// Note don't forget to have neighbors look as well!
|
||||
|
||||
return null
|
||||
|
||||
obj/machinery/atmospherics/proc/build_network()
|
||||
/obj/machinery/atmospherics/proc/build_network()
|
||||
// Called to build a network from this node
|
||||
|
||||
return null
|
||||
|
||||
obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference)
|
||||
/obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference)
|
||||
// Returns pipe_network associated with connection to reference
|
||||
// Notes: should create network if necessary
|
||||
// Should never return null
|
||||
|
||||
return null
|
||||
|
||||
obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
/obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
// Used when two pipe_networks are combining
|
||||
|
||||
obj/machinery/atmospherics/proc/return_network_air(datum/network/reference)
|
||||
/obj/machinery/atmospherics/proc/return_network_air(datum/network/reference)
|
||||
// Return a list of gas_mixture(s) in the object
|
||||
// associated with reference pipe_network for use in rebuilding the networks gases list
|
||||
// Is permitted to return null
|
||||
|
||||
obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
|
||||
/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
|
||||
|
||||
obj/machinery/atmospherics/update_icon()
|
||||
/obj/machinery/atmospherics/update_icon()
|
||||
return null
|
||||
@@ -76,6 +76,7 @@ obj/machinery/atmospherics/binary
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
build_network()
|
||||
if(!network1 && node1)
|
||||
@@ -127,4 +128,7 @@ obj/machinery/atmospherics/binary
|
||||
del(network2)
|
||||
node2 = null
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump
|
||||
icon = 'icons/obj/atmospherics/dp_vent_pump.dmi'
|
||||
icon_state = "off"
|
||||
icon = 'icons/atmos/vent_pump.dmi'
|
||||
icon_state = "map_dp_vent"
|
||||
|
||||
//node2 is output port
|
||||
//node1 is input port
|
||||
@@ -10,15 +10,6 @@
|
||||
|
||||
level = 1
|
||||
|
||||
high_volume
|
||||
name = "Large Dual Port Air Vent"
|
||||
|
||||
New()
|
||||
..()
|
||||
|
||||
air1.volume = 1000
|
||||
air2.volume = 1000
|
||||
|
||||
var/on = 0
|
||||
var/pump_direction = 1 //0 = siphoning, 1 = releasing
|
||||
|
||||
@@ -26,174 +17,199 @@
|
||||
var/input_pressure_min = 0
|
||||
var/output_pressure_max = 0
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
var/pressure_checks = 1
|
||||
//1: Do not pass external_pressure_bound
|
||||
//2: Do not pass input_pressure_min
|
||||
//4: Do not pass output_pressure_max
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/New()
|
||||
..()
|
||||
icon = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume
|
||||
name = "Large Dual Port Air Vent"
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New()
|
||||
..()
|
||||
air1.volume = 1000
|
||||
air2.volume = 1000
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon(var/safety = 0)
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
overlays.Cut()
|
||||
|
||||
var/vent_icon = "vent"
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
|
||||
if(T.intact && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
vent_icon += "h"
|
||||
|
||||
if(!powered())
|
||||
vent_icon += "off"
|
||||
else
|
||||
vent_icon += "[on ? "[pump_direction ? "out" : "in"]" : "off"]"
|
||||
|
||||
overlays += icon_manager.get_atmos_icon("device", , , vent_icon)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
if(T.intact && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
return
|
||||
else
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
add_underlay(T, node2, dir)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/hide(var/i)
|
||||
update_icon()
|
||||
if(on)
|
||||
if(pump_direction)
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
|
||||
else
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
|
||||
else
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
on = 0
|
||||
update_underlays()
|
||||
|
||||
return
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/process()
|
||||
..()
|
||||
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(on)
|
||||
if(pump_direction)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
on = 0
|
||||
return
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
process()
|
||||
..()
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
|
||||
if(!on)
|
||||
return 0
|
||||
if(pump_direction) //input -> external
|
||||
var/pressure_delta = 10000
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||
if(pressure_checks&2)
|
||||
pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min))
|
||||
|
||||
if(pump_direction) //input -> external
|
||||
var/pressure_delta = 10000
|
||||
if(pressure_delta > 0)
|
||||
if(air1.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||
if(pressure_checks&2)
|
||||
pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min))
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
|
||||
if(pressure_delta > 0)
|
||||
if(air1.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
loc.assume_air(removed)
|
||||
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
loc.assume_air(removed)
|
||||
else //external -> output
|
||||
var/pressure_delta = 10000
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||
if(pressure_checks&4)
|
||||
pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure()))
|
||||
|
||||
else //external -> output
|
||||
var/pressure_delta = 10000
|
||||
if(pressure_delta > 0)
|
||||
if(environment.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||
if(pressure_checks&4)
|
||||
pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure()))
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
|
||||
if(pressure_delta > 0)
|
||||
if(environment.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||
air2.merge(removed)
|
||||
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
air2.merge(removed)
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
return 1
|
||||
return 1
|
||||
|
||||
//Radio remote control
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
|
||||
|
||||
broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "ADVP",
|
||||
"power" = on,
|
||||
"direction" = pump_direction?("release"):("siphon"),
|
||||
"checks" = pressure_checks,
|
||||
"input" = input_pressure_min,
|
||||
"output" = output_pressure_max,
|
||||
"external" = external_pressure_bound,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "ADVP",
|
||||
"power" = on,
|
||||
"direction" = pump_direction?("release"):("siphon"),
|
||||
"checks" = pressure_checks,
|
||||
"input" = input_pressure_min,
|
||||
"output" = output_pressure_max,
|
||||
"external" = external_pressure_bound,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
return 1
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
if(signal.data["power"])
|
||||
on = text2num(signal.data["power"])
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(signal.data["power_toggle"])
|
||||
on = !on
|
||||
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
if("power" in signal.data)
|
||||
on = text2num(signal.data["power"])
|
||||
if(signal.data["direction"])
|
||||
pump_direction = text2num(signal.data["direction"])
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
on = !on
|
||||
if(signal.data["checks"])
|
||||
pressure_checks = text2num(signal.data["checks"])
|
||||
|
||||
if("direction" in signal.data)
|
||||
pump_direction = text2num(signal.data["direction"])
|
||||
if(signal.data["purge"])
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
|
||||
if("checks" in signal.data)
|
||||
pressure_checks = text2num(signal.data["checks"])
|
||||
if(signal.data["stabalize"])
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
|
||||
if("purge" in signal.data)
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
if(signal.data["set_input_pressure"])
|
||||
input_pressure_min = between(
|
||||
0,
|
||||
text2num(signal.data["set_input_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if("stabalize" in signal.data)
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
if(signal.data["set_output_pressure"])
|
||||
output_pressure_max = between(
|
||||
0,
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if("set_input_pressure" in signal.data)
|
||||
input_pressure_min = between(
|
||||
0,
|
||||
text2num(signal.data["set_input_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
if(signal.data["set_external_pressure"])
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
output_pressure_max = between(
|
||||
0,
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if("set_external_pressure" in signal.data)
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
//if(signal.data["tag"])
|
||||
if(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
@@ -1,8 +1,9 @@
|
||||
obj/machinery/atmospherics/binary/passive_gate
|
||||
/obj/machinery/atmospherics/binary/passive_gate
|
||||
//Tries to achieve target pressure at output (like a normal pump) except
|
||||
// Uses no power but can not transfer gases from a low pressure area to a high pressure area
|
||||
icon = 'icons/obj/atmospherics/passive_gate.dmi'
|
||||
icon_state = "intact_off"
|
||||
icon = 'icons/atmos/passive_gate.dmi'
|
||||
icon_state = "map"
|
||||
level = 1
|
||||
|
||||
name = "Passive gate"
|
||||
desc = "A one-way air valve that does not require power"
|
||||
@@ -14,175 +15,161 @@ obj/machinery/atmospherics/binary/passive_gate
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
update_icon()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "intact_off"
|
||||
else if(node1 && node2)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
if(node1)
|
||||
icon_state = "exposed_1_off"
|
||||
else if(node2)
|
||||
icon_state = "exposed_2_off"
|
||||
else
|
||||
icon_state = "exposed_3_off"
|
||||
return
|
||||
/obj/machinery/atmospherics/binary/passive_gate/update_icon()
|
||||
icon_state = "[on ? "on" : "off"]"
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
/obj/machinery/atmospherics/binary/passive_gate/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node1, turn(dir, 180))
|
||||
add_underlay(T, node2, dir)
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
/obj/machinery/atmospherics/binary/passive_gate/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10))
|
||||
//No need to pump gas if target is already reached or input pressure is too low
|
||||
//Need at least 10 KPa difference to overcome friction in the mechanism
|
||||
return 1
|
||||
/obj/machinery/atmospherics/binary/passive_gate/process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
//Calculate necessary moles to transfer using PV = nRT
|
||||
if((air1.total_moles() > 0) && (air1.temperature>0))
|
||||
var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2)
|
||||
//Can not have a pressure delta that would cause output_pressure > input_pressure
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
|
||||
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10))
|
||||
//No need to pump gas if target is already reached or input pressure is too low
|
||||
//Need at least 10 KPa difference to overcome friction in the mechanism
|
||||
return 1
|
||||
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
//Calculate necessary moles to transfer using PV = nRT
|
||||
if((air1.total_moles > 0) && (air1.temperature>0))
|
||||
var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2)
|
||||
//Can not have a pressure delta that would cause output_pressure > input_pressure
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
//Radio remote control
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
|
||||
//Radio remote control
|
||||
|
||||
broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
/obj/machinery/atmospherics/binary/passive_gate/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
/obj/machinery/atmospherics/binary/passive_gate/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = on,
|
||||
"target_output" = target_pressure,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = on,
|
||||
"target_output" = target_pressure,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
return 1
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
|
||||
interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[round(target_pressure,0.1)]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
"}
|
||||
return 1
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
/obj/machinery/atmospherics/binary/passive_gate/interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[round(target_pressure,0.1)]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
"}
|
||||
|
||||
initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
/obj/machinery/atmospherics/binary/passive_gate/initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
if("power" in signal.data)
|
||||
on = text2num(signal.data["power"])
|
||||
/obj/machinery/atmospherics/binary/passive_gate/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
on = !on
|
||||
if("power" in signal.data)
|
||||
on = text2num(signal.data["power"])
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = between(
|
||||
0,
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
if("power_toggle" in signal.data)
|
||||
on = !on
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = between(
|
||||
0,
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
|
||||
|
||||
|
||||
attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
return
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_press"])
|
||||
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
|
||||
src.target_pressure = max(0, min(4500, new_pressure))
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_press"])
|
||||
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
|
||||
src.target_pressure = max(0, min(4500, new_pressure))
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
@@ -12,9 +12,10 @@ Thus, the two variables affect pump operation are set in New():
|
||||
but overall network volume is also increased as this increases...
|
||||
*/
|
||||
|
||||
obj/machinery/atmospherics/binary/pump
|
||||
icon = 'icons/obj/atmospherics/pump.dmi'
|
||||
icon_state = "intact_off"
|
||||
/obj/machinery/atmospherics/binary/pump
|
||||
icon = 'icons/atmos/pump.dmi'
|
||||
icon_state = "map_off"
|
||||
level = 1
|
||||
|
||||
name = "Gas pump"
|
||||
desc = "A pump"
|
||||
@@ -26,180 +27,181 @@ obj/machinery/atmospherics/binary/pump
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
highcap
|
||||
name = "High capacity gas pump"
|
||||
desc = "A high capacity pump"
|
||||
/obj/machinery/atmospherics/binary/pump/highcap
|
||||
name = "High capacity gas pump"
|
||||
desc = "A high capacity pump"
|
||||
|
||||
target_pressure = 15000000
|
||||
target_pressure = 15000000
|
||||
|
||||
on
|
||||
on = 1
|
||||
icon_state = "intact_on"
|
||||
/obj/machinery/atmospherics/binary/pump/on
|
||||
icon_state = "map_on"
|
||||
on = 1
|
||||
|
||||
update_icon()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "intact_off"
|
||||
else if(node1 && node2)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
if(node1)
|
||||
icon_state = "exposed_1_off"
|
||||
else if(node2)
|
||||
icon_state = "exposed_2_off"
|
||||
else
|
||||
icon_state = "exposed_3_off"
|
||||
return
|
||||
/obj/machinery/atmospherics/binary/pump/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "off"
|
||||
else
|
||||
icon_state = "[on ? "on" : "off"]"
|
||||
|
||||
process()
|
||||
// ..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
/obj/machinery/atmospherics/binary/pump/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
if(!on)
|
||||
return 0
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
add_underlay(T, node2, dir)
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
/obj/machinery/atmospherics/binary/pump/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
if( (target_pressure - output_starting_pressure) < 0.01)
|
||||
//No need to pump gas if target is already reached!
|
||||
return 1
|
||||
/obj/machinery/atmospherics/binary/pump/process()
|
||||
// ..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
//Calculate necessary moles to transfer using PV=nRT
|
||||
if((air1.total_moles() > 0) && (air1.temperature>0))
|
||||
var/pressure_delta = target_pressure - output_starting_pressure
|
||||
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
|
||||
if( (target_pressure - output_starting_pressure) < 0.01)
|
||||
//No need to pump gas if target is already reached!
|
||||
return 1
|
||||
|
||||
//Radio remote control
|
||||
//Calculate necessary moles to transfer using PV=nRT
|
||||
if((air1.total_moles > 0) && (air1.temperature>0))
|
||||
var/pressure_delta = target_pressure - output_starting_pressure
|
||||
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
|
||||
broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = on,
|
||||
"target_output" = target_pressure,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
return 1
|
||||
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
//Radio remote control
|
||||
|
||||
return 1
|
||||
/obj/machinery/atmospherics/binary/pump/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
|
||||
|
||||
interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[round(target_pressure,0.1)]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
"}
|
||||
/obj/machinery/atmospherics/binary/pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AGP",
|
||||
"power" = on,
|
||||
"target_output" = target_pressure,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
|
||||
if("power" in signal.data)
|
||||
on = text2num(signal.data["power"])
|
||||
return 1
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
on = !on
|
||||
/obj/machinery/atmospherics/binary/pump/interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[round(target_pressure,0.1)]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
"}
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = between(
|
||||
0,
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
/obj/machinery/atmospherics/binary/pump/initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
if(signal.data["power"])
|
||||
on = text2num(signal.data["power"])
|
||||
|
||||
if(signal.data["power_toggle"])
|
||||
on = !on
|
||||
|
||||
if(signal.data["set_output_pressure"])
|
||||
target_pressure = between(
|
||||
0,
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
|
||||
|
||||
attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
return
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_press"])
|
||||
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
|
||||
src.target_pressure = max(0, min(4500, new_pressure))
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
/obj/machinery/atmospherics/binary/pump/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_press"])
|
||||
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
|
||||
src.target_pressure = max(0, min(4500, new_pressure))
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
power_change()
|
||||
..()
|
||||
/obj/machinery/atmospherics/binary/pump/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
/obj/machinery/atmospherics/binary/pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
@@ -12,9 +12,10 @@ Thus, the two variables affect pump operation are set in New():
|
||||
but overall network volume is also increased as this increases...
|
||||
*/
|
||||
|
||||
obj/machinery/atmospherics/binary/volume_pump
|
||||
icon = 'icons/obj/atmospherics/volume_pump.dmi'
|
||||
icon_state = "intact_off"
|
||||
/obj/machinery/atmospherics/binary/volume_pump
|
||||
icon = 'icons/atmos/volume_pump.dmi'
|
||||
icon_state = "map_off"
|
||||
level = 1
|
||||
|
||||
name = "Volumetric gas pump"
|
||||
desc = "A volumetric pump"
|
||||
@@ -26,174 +27,168 @@ obj/machinery/atmospherics/binary/volume_pump
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
on
|
||||
on = 1
|
||||
icon_state = "intact_on"
|
||||
/obj/machinery/atmospherics/binary/volume_pump/on
|
||||
on = 1
|
||||
icon_state = "map_on"
|
||||
|
||||
update_icon()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "intact_off"
|
||||
else if(node1 && node2)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
if(node1)
|
||||
icon_state = "exposed_1_off"
|
||||
else if(node2)
|
||||
icon_state = "exposed_2_off"
|
||||
else
|
||||
icon_state = "exposed_3_off"
|
||||
return
|
||||
/obj/machinery/atmospherics/binary/volume_pump/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "off"
|
||||
else
|
||||
icon_state = "[on ? "on" : "off"]"
|
||||
|
||||
process()
|
||||
// ..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
/obj/machinery/atmospherics/binary/volume_pump/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
if(!on)
|
||||
return 0
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
add_underlay(T, node2, dir)
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/process()
|
||||
// ..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
// Pump mechanism just won't do anything if the pressure is too high/too low
|
||||
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
|
||||
if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000))
|
||||
return 1
|
||||
|
||||
var/transfer_ratio = max(1, transfer_rate/air1.volume)
|
||||
|
||||
var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
|
||||
|
||||
air2.merge(removed)
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
|
||||
if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000))
|
||||
return 1
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency)
|
||||
var/transfer_ratio = max(1, transfer_rate/air1.volume)
|
||||
|
||||
broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
air2.merge(removed)
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "APV",
|
||||
"power" = on,
|
||||
"transfer_rate" = transfer_rate,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
radio_connection.post_signal(src, signal)
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
return 1
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output flow: </b>
|
||||
[round(transfer_rate,1)]l/s | <a href='?src=\ref[src];set_transfer_rate=1'>Change</a>
|
||||
"}
|
||||
return 1
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
/obj/machinery/atmospherics/binary/volume_pump/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
initialize()
|
||||
..()
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "APV",
|
||||
"power" = on,
|
||||
"transfer_rate" = transfer_rate,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
set_frequency(frequency)
|
||||
return 1
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
/obj/machinery/atmospherics/binary/volume_pump/interact(mob/user as mob)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output flow: </b>
|
||||
[round(transfer_rate,1)]l/s | <a href='?src=\ref[src];set_transfer_rate=1'>Change</a>
|
||||
"}
|
||||
|
||||
if("power" in signal.data)
|
||||
on = text2num(signal.data["power"])
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_pump")
|
||||
onclose(user, "atmo_pump")
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
on = !on
|
||||
/obj/machinery/atmospherics/binary/volume_pump/initialize()
|
||||
..()
|
||||
set_frequency(frequency)
|
||||
|
||||
if("set_transfer_rate" in signal.data)
|
||||
transfer_rate = between(
|
||||
0,
|
||||
text2num(signal.data["set_transfer_rate"]),
|
||||
air1.volume
|
||||
)
|
||||
/obj/machinery/atmospherics/binary/volume_pump/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
if(signal.data["power"])
|
||||
on = text2num(signal.data["power"])
|
||||
|
||||
if(signal.data["power_toggle"])
|
||||
on = !on
|
||||
|
||||
if(signal.data["set_transfer_rate"])
|
||||
transfer_rate = between(
|
||||
0,
|
||||
text2num(signal.data["set_transfer_rate"]),
|
||||
air1.volume
|
||||
)
|
||||
|
||||
if(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_transfer_rate"])
|
||||
var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num
|
||||
src.transfer_rate = max(0, min(200, new_transfer_rate))
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
|
||||
attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
interact(user)
|
||||
return
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_transfer_rate"])
|
||||
var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num
|
||||
src.transfer_rate = max(0, min(200, new_transfer_rate))
|
||||
usr.set_machine(src)
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
@@ -11,33 +11,6 @@
|
||||
#define ATM_P 6 //Phoron
|
||||
#define ATM_N2O 7
|
||||
|
||||
//--------------------------------------------
|
||||
// Omni device cached icon list
|
||||
//--------------------------------------------
|
||||
var/global/list/omni_icons[]
|
||||
|
||||
/proc/gen_omni_icons()
|
||||
omni_icons = new()
|
||||
var/icon/omni = new('icons/obj/atmospherics/omni_devices.dmi')
|
||||
|
||||
for(var/state in omni.IconStates())
|
||||
if(!state || findtext(state, "map"))
|
||||
continue
|
||||
|
||||
var/image/I = image('icons/obj/atmospherics/omni_devices.dmi', icon_state = state)
|
||||
|
||||
if(findtext(state, "pipe"))
|
||||
for(var/pipe_color in pipe_colors)
|
||||
I = image('icons/obj/atmospherics/omni_devices.dmi', icon_state = state)
|
||||
I.color = pipe_colors[pipe_color]
|
||||
var/cache_name = state
|
||||
if(I.color)
|
||||
cache_name += "_[pipe_colors[pipe_color]]"
|
||||
omni_icons[cache_name] = I
|
||||
else
|
||||
omni_icons[state] = I
|
||||
|
||||
|
||||
//--------------------------------------------
|
||||
// Omni port datum
|
||||
//
|
||||
@@ -83,16 +56,6 @@ var/global/list/omni_icons[]
|
||||
// Need to find somewhere else for these
|
||||
//--------------------------------------------
|
||||
|
||||
#define PIPE_COLOR_RED "#ff0000"
|
||||
#define PIPE_COLOR_BLUE "#0000ff"
|
||||
#define PIPE_COLOR_CYAN "#00ffff"
|
||||
#define PIPE_COLOR_GREEN "#00ff00"
|
||||
#define PIPE_COLOR_YELLOW "#ffcc00"
|
||||
#define PIPE_COLOR_PURPLE "#5c1ec0"
|
||||
|
||||
var/global/list/pipe_colors = list("grey" = null, "red" = PIPE_COLOR_RED, "blue" = PIPE_COLOR_BLUE, "cyan" = PIPE_COLOR_CYAN, "green" = PIPE_COLOR_GREEN, "yellow" = PIPE_COLOR_YELLOW, "purple" = PIPE_COLOR_PURPLE)
|
||||
|
||||
|
||||
//returns a text string based on the direction flag input
|
||||
// if capitalize is true, it will return the string capitalized
|
||||
// otherwise it will return the direction string in lower case
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
|
||||
if(!input || !output)
|
||||
return
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
var/datum/gas_mixture/input_air = input.air // it's completely happy with them if they're in a loop though i.e. "P.air.return_pressure()"... *shrug*
|
||||
|
||||
var/output_pressure = output_air.return_pressure()
|
||||
|
||||
|
||||
if(output_pressure >= target_pressure)
|
||||
return
|
||||
for(var/datum/omni_port/P in filters)
|
||||
@@ -63,63 +63,60 @@
|
||||
|
||||
var/pressure_delta = target_pressure - output_pressure
|
||||
|
||||
if(input_air.return_temperature() > 0)
|
||||
input.transfer_moles = pressure_delta * output_air.volume / (input_air.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
if(input_air.temperature > 0)
|
||||
input.transfer_moles = pressure_delta * output_air.volume / (input_air.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
if(input.transfer_moles > 0)
|
||||
var/datum/gas_mixture/removed = input_air.remove(input.transfer_moles)
|
||||
|
||||
|
||||
if(!removed)
|
||||
return
|
||||
|
||||
|
||||
for(var/datum/omni_port/P in filters)
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.return_temperature()
|
||||
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
switch(P.mode)
|
||||
if(ATM_O2)
|
||||
filtered_out.oxygen = removed.oxygen
|
||||
removed.oxygen = 0
|
||||
filtered_out.gas["oxygen"] = removed.gas["oxygen"]
|
||||
removed.gas["oxygen"] = null
|
||||
if(ATM_N2)
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 0
|
||||
filtered_out.gas["nitrogen"] = removed.gas["nitrogen"]
|
||||
removed.gas["nitrogen"] = null
|
||||
if(ATM_CO2)
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
filtered_out.gas["carbon_dioxide"] = removed.gas["carbon_dioxide"]
|
||||
removed.gas["carbon_dioxide"] = null
|
||||
if(ATM_P)
|
||||
filtered_out.phoron = removed.phoron
|
||||
removed.phoron = 0
|
||||
filtered_out.gas["phoron"] = removed.gas["phoron"]
|
||||
removed.gas["phoron"] = null
|
||||
if(ATM_N2O)
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/sleeping_agent/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
filtered_out.gas["sleeping_agent"] = removed.gas["sleeping_agent"]
|
||||
removed.gas["sleeping_agent"] = null
|
||||
else
|
||||
filtered_out = null
|
||||
|
||||
|
||||
P.air.merge(filtered_out)
|
||||
if(P.network)
|
||||
P.network.update = 1
|
||||
|
||||
|
||||
output_air.merge(removed)
|
||||
if(output.network)
|
||||
output.network.update = 1
|
||||
|
||||
|
||||
input.transfer_moles = 0
|
||||
if(input.network)
|
||||
input.network.update = 1
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/omni/filter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/omni/filter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
usr.set_machine(src)
|
||||
|
||||
var/list/data = new()
|
||||
|
||||
data = build_uidata()
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "omni_filter.tmpl", "Omni Filter Control", 330, 330)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
var/datum/omni_port/output
|
||||
|
||||
//setup tags for initial concentration values (must be decimal)
|
||||
var/tag_north_con
|
||||
var/tag_north_con
|
||||
var/tag_south_con
|
||||
var/tag_east_con
|
||||
var/tag_west_con
|
||||
@@ -101,22 +101,22 @@
|
||||
var/pressure_delta = target_pressure - output_pressure
|
||||
|
||||
for(var/datum/omni_port/P in inputs)
|
||||
if(P.air.return_temperature() > 0)
|
||||
P.transfer_moles = (P.concentration * pressure_delta) * output_air.return_volume() / (P.air.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
if(P.air.temperature > 0)
|
||||
P.transfer_moles = (P.concentration * pressure_delta) * output_air.volume / (P.air.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/ratio_check = null
|
||||
|
||||
for(var/datum/omni_port/P in inputs)
|
||||
if(!P.transfer_moles)
|
||||
return
|
||||
if(P.air.total_moles() < P.transfer_moles)
|
||||
if(P.air.total_moles < P.transfer_moles)
|
||||
ratio_check = 1
|
||||
continue
|
||||
|
||||
if(ratio_check)
|
||||
var/list/ratio_list = new()
|
||||
for(var/datum/omni_port/P in inputs)
|
||||
ratio_list.Add(P.air.total_moles() / P.transfer_moles)
|
||||
ratio_list.Add(P.air.total_moles / P.transfer_moles)
|
||||
|
||||
var/ratio = min(ratio_list)
|
||||
|
||||
@@ -137,14 +137,14 @@
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/omni/mixer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/omni/mixer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
usr.set_machine(src)
|
||||
|
||||
var/list/data = new()
|
||||
|
||||
data = build_uidata()
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "omni_mixer.tmpl", "Omni Mixer Control", 360, 330)
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
//--------------------------------------------
|
||||
/obj/machinery/atmospherics/omni
|
||||
name = "omni device"
|
||||
icon = 'icons/obj/atmospherics/omni_devices.dmi'
|
||||
icon = 'icons/atmos/omni_devices.dmi'
|
||||
icon_state = "base"
|
||||
use_power = 1
|
||||
initialize_directions = 0
|
||||
level = 1
|
||||
|
||||
var/on = 0
|
||||
var/configuring = 0
|
||||
@@ -70,12 +71,6 @@
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/omni/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/pipe_painter)) //for updating the color of connected pipe ends
|
||||
for(var/datum/omni_port/P in ports)
|
||||
P.update = 1
|
||||
update_ports()
|
||||
return
|
||||
|
||||
if(!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
|
||||
@@ -106,8 +101,8 @@
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/omni/proc/build_icons()
|
||||
if(!omni_icons)
|
||||
gen_omni_icons()
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
var/core_icon = null
|
||||
if(istype(src, /obj/machinery/atmospherics/omni/mixer))
|
||||
@@ -119,13 +114,16 @@
|
||||
|
||||
//directional icons are layers 1-4, with the core icon on layer 5
|
||||
if(core_icon)
|
||||
overlays_off[5] = omni_icons[core_icon]
|
||||
overlays_on[5] = omni_icons[core_icon + "_glow"]
|
||||
overlays_off[5] = icon_manager.get_atmos_icon("omni", , , core_icon)
|
||||
overlays_on[5] = icon_manager.get_atmos_icon("omni", , , core_icon + "_glow")
|
||||
|
||||
overlays_error[1] = omni_icons[core_icon]
|
||||
overlays_error[2] = omni_icons["error"]
|
||||
overlays_error[1] = icon_manager.get_atmos_icon("omni", , , core_icon)
|
||||
overlays_error[2] = icon_manager.get_atmos_icon("omni", , , "error")
|
||||
|
||||
/obj/machinery/atmospherics/omni/proc/update_port_icons()
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
for(var/datum/omni_port/P in ports)
|
||||
if(P.update)
|
||||
var/ref_layer = 0
|
||||
@@ -145,11 +143,11 @@
|
||||
var/list/port_icons = select_port_icons(P)
|
||||
if(port_icons)
|
||||
if(P.node)
|
||||
underlays_current[ref_layer] = omni_icons[port_icons["pipe_icon"]]
|
||||
underlays_current[ref_layer] = port_icons["pipe_icon"]
|
||||
else
|
||||
underlays_current[ref_layer] = null
|
||||
overlays_off[ref_layer] = omni_icons[port_icons["off_icon"]]
|
||||
overlays_on[ref_layer] = omni_icons[port_icons["on_icon"]]
|
||||
overlays_off[ref_layer] = port_icons["off_icon"]
|
||||
overlays_on[ref_layer] = port_icons["on_icon"]
|
||||
else
|
||||
underlays_current[ref_layer] = null
|
||||
overlays_off[ref_layer] = null
|
||||
@@ -175,14 +173,29 @@
|
||||
if(ATM_O2 to ATM_N2O)
|
||||
ic_on += "_filter"
|
||||
ic_off += "_out"
|
||||
|
||||
var/pipe_state = ic_dir + "_pipe"
|
||||
if(P.node)
|
||||
if(P.node.color)
|
||||
pipe_state += "_[P.node.color]"
|
||||
|
||||
ic_on = icon_manager.get_atmos_icon("omni", , , ic_on)
|
||||
ic_off = icon_manager.get_atmos_icon("omni", , , ic_off)
|
||||
|
||||
var/pipe_state
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
if(T.intact && istype(P.node, /obj/machinery/atmospherics/pipe) && P.node.level == 1 )
|
||||
pipe_state = icon_manager.get_atmos_icon("underlay_down", P.dir, color_cache_name(P.node))
|
||||
else
|
||||
pipe_state = icon_manager.get_atmos_icon("underlay_intact", P.dir, color_cache_name(P.node))
|
||||
|
||||
return list("on_icon" = ic_on, "off_icon" = ic_off, "pipe_icon" = pipe_state)
|
||||
|
||||
/obj/machinery/atmospherics/omni/update_underlays()
|
||||
for(var/datum/omni_port/P in ports)
|
||||
P.update = 1
|
||||
update_ports()
|
||||
|
||||
/obj/machinery/atmospherics/omni/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/omni/proc/update_ports()
|
||||
sort_ports()
|
||||
update_port_icons()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/machinery/atmospherics/portables_connector
|
||||
icon = 'icons/obj/atmospherics/portables_connector.dmi'
|
||||
icon_state = "intact"
|
||||
icon = 'icons/atmos/connector.dmi'
|
||||
icon_state = "map_connector"
|
||||
|
||||
name = "Connector Port"
|
||||
desc = "For connecting portables devices related to atmospherics control."
|
||||
@@ -16,142 +16,139 @@
|
||||
|
||||
var/on = 0
|
||||
use_power = 0
|
||||
level = 0
|
||||
level = 1
|
||||
|
||||
|
||||
New()
|
||||
initialize_directions = dir
|
||||
..()
|
||||
/obj/machinery/atmospherics/portables_connector/New()
|
||||
initialize_directions = dir
|
||||
..()
|
||||
|
||||
update_icon()
|
||||
if(node)
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
|
||||
dir = get_dir(src, node)
|
||||
else
|
||||
icon_state = "exposed"
|
||||
/obj/machinery/atmospherics/portables_connector/update_icon()
|
||||
icon_state = "connector"
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node, dir)
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/process()
|
||||
..()
|
||||
if(!on)
|
||||
return
|
||||
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(node)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
|
||||
dir = get_dir(src, node)
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
return
|
||||
if(!connected_device)
|
||||
on = 0
|
||||
return
|
||||
if(network)
|
||||
network.update = 1
|
||||
return 1
|
||||
if(!connected_device)
|
||||
on = 0
|
||||
return
|
||||
if(network)
|
||||
network.update = 1
|
||||
return 1
|
||||
|
||||
// Housekeeping and pipe network stuff below
|
||||
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
if(reference == node)
|
||||
network = new_network
|
||||
/obj/machinery/atmospherics/portables_connector/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
if(reference == node)
|
||||
network = new_network
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
new_network.normal_members += src
|
||||
new_network.normal_members += src
|
||||
|
||||
return null
|
||||
return null
|
||||
|
||||
Del()
|
||||
loc = null
|
||||
/obj/machinery/atmospherics/portables_connector/Del()
|
||||
loc = null
|
||||
|
||||
if(connected_device)
|
||||
connected_device.disconnect()
|
||||
if(connected_device)
|
||||
connected_device.disconnect()
|
||||
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
del(network)
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
del(network)
|
||||
|
||||
node = null
|
||||
node = null
|
||||
|
||||
..()
|
||||
..()
|
||||
|
||||
initialize()
|
||||
if(node) return
|
||||
/obj/machinery/atmospherics/portables_connector/initialize()
|
||||
if(node) return
|
||||
|
||||
var/node_connect = dir
|
||||
var/node_connect = dir
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node = target
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/build_network()
|
||||
if(!network && node)
|
||||
network = new /datum/pipe_network()
|
||||
network.normal_members += src
|
||||
network.build_network(node, src)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
if(!network && node)
|
||||
network = new /datum/pipe_network()
|
||||
network.normal_members += src
|
||||
network.build_network(node, src)
|
||||
|
||||
if(reference==node)
|
||||
return network
|
||||
|
||||
if(reference==connected_device)
|
||||
return network
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network == old_network)
|
||||
network = new_network
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(connected_device)
|
||||
results += connected_device.air_contents
|
||||
|
||||
return results
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node)
|
||||
del(network)
|
||||
node = null
|
||||
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
|
||||
|
||||
return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node)
|
||||
return network
|
||||
|
||||
if(reference==connected_device)
|
||||
return network
|
||||
|
||||
return null
|
||||
|
||||
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network == old_network)
|
||||
network = new_network
|
||||
|
||||
/obj/machinery/atmospherics/portables_connector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (connected_device)
|
||||
user << "\red You cannot unwrench this [src], dettach [connected_device] first."
|
||||
return 1
|
||||
|
||||
return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(connected_device)
|
||||
results += connected_device.air_contents
|
||||
|
||||
return results
|
||||
|
||||
disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node)
|
||||
del(network)
|
||||
node = null
|
||||
|
||||
return null
|
||||
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (connected_device)
|
||||
user << "\red You cannot unwrench this [src], dettach [connected_device] first."
|
||||
return 1
|
||||
if (locate(/obj/machinery/portable_atmospherics, src.loc))
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
if (locate(/obj/machinery/portable_atmospherics, src.loc))
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
obj/machinery/atmospherics/trinary/filter
|
||||
icon = 'icons/obj/atmospherics/filter.dmi'
|
||||
icon_state = "intact_off"
|
||||
/obj/machinery/atmospherics/trinary/filter
|
||||
icon = 'icons/atmos/filter.dmi'
|
||||
icon_state = "map"
|
||||
density = 0
|
||||
level = 1
|
||||
|
||||
name = "Gas filter"
|
||||
|
||||
var/on = 0
|
||||
var/temp = null // -- TLE
|
||||
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
@@ -24,141 +24,152 @@ Filter types:
|
||||
var/frequency = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
/obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
|
||||
New()
|
||||
if(radio_controller)
|
||||
initialize()
|
||||
..()
|
||||
/* I don't know why this is here, but it's ugly, so I'm disabling it
|
||||
/obj/machinery/atmospherics/trinary/filter/New()
|
||||
..()
|
||||
if(radio_controller)
|
||||
initialize()
|
||||
*/
|
||||
/obj/machinery/atmospherics/trinary/filter/update_icon()
|
||||
if(istype(src, /obj/machinery/atmospherics/trinary/filter/m_filter))
|
||||
icon_state = "m"
|
||||
else
|
||||
icon_state = ""
|
||||
|
||||
update_icon()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "intact_off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
if(!powered())
|
||||
icon_state += "off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state += on ? "on" : "off"
|
||||
else
|
||||
icon_state += "off"
|
||||
on = 0
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
|
||||
if(istype(src, /obj/machinery/atmospherics/trinary/filter/m_filter))
|
||||
add_underlay(T, node2, turn(dir, 90))
|
||||
else
|
||||
icon_state = "intact_off"
|
||||
on = 0
|
||||
add_underlay(T, node2, turn(dir, -90))
|
||||
|
||||
return
|
||||
add_underlay(T, node3, dir)
|
||||
|
||||
power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
/obj/machinery/atmospherics/trinary/filter/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
/obj/machinery/atmospherics/trinary/filter/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
/obj/machinery/atmospherics/trinary/filter/process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
if(output_starting_pressure >= target_pressure || air2.return_pressure() >= target_pressure )
|
||||
//No need to mix if target is already full!
|
||||
return 1
|
||||
|
||||
//Calculate necessary moles to transfer using PV=nRT
|
||||
|
||||
var/pressure_delta = target_pressure - output_starting_pressure
|
||||
var/transfer_moles
|
||||
|
||||
if(air1.temperature > 0)
|
||||
transfer_moles = pressure_delta*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
//Actually transfer the gas
|
||||
|
||||
if(transfer_moles > 0)
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
|
||||
if(!removed)
|
||||
return
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
switch(filter_type)
|
||||
if(0) //removing hydrocarbons
|
||||
filtered_out.phoron = removed.phoron
|
||||
removed.phoron = 0
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
|
||||
if(1) //removing O2
|
||||
filtered_out.oxygen = removed.oxygen
|
||||
removed.oxygen = 0
|
||||
|
||||
if(2) //removing N2
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 0
|
||||
|
||||
if(3) //removing CO2
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
|
||||
if(4)//removing N2O
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/sleeping_agent))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
|
||||
else
|
||||
filtered_out = null
|
||||
|
||||
|
||||
air2.merge(filtered_out)
|
||||
air3.merge(removed)
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
|
||||
if(output_starting_pressure >= target_pressure || air2.return_pressure() >= target_pressure )
|
||||
//No need to mix if target is already full!
|
||||
return 1
|
||||
|
||||
initialize()
|
||||
set_frequency(frequency)
|
||||
..()
|
||||
//Calculate necessary moles to transfer using PV=nRT
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
var/pressure_delta = target_pressure - output_starting_pressure
|
||||
var/transfer_moles
|
||||
|
||||
if(air1.temperature > 0)
|
||||
transfer_moles = pressure_delta*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
//Actually transfer the gas
|
||||
|
||||
if(transfer_moles > 0)
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
|
||||
if(!removed)
|
||||
return
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
switch(filter_type)
|
||||
if(0) //removing hydrocarbons
|
||||
filtered_out.gas["phoron"] = removed.gas["phoron"]
|
||||
removed.gas["phoron"] = 0
|
||||
|
||||
filtered_out.gas["oxygen_agent_b"] = removed.gas["oxygen_agent_b"]
|
||||
removed.gas["oxygen_agent_b"] = 0
|
||||
|
||||
if(1) //removing O2
|
||||
filtered_out.gas["oxygen"] = removed.gas["oxygen"]
|
||||
removed.gas["oxygen"] = 0
|
||||
|
||||
if(2) //removing N2
|
||||
filtered_out.gas["nitrogen"] = removed.gas["nitrogen"]
|
||||
removed.gas["nitrogen"] = 0
|
||||
|
||||
if(3) //removing CO2
|
||||
filtered_out.gas["carbon_dioxide"] = removed.gas["carbon_dioxide"]
|
||||
removed.gas["carbon_dioxide"] = 0
|
||||
|
||||
if(4)//removing N2O
|
||||
filtered_out.gas["sleeping_agent"] = removed.gas["sleeping_agent"]
|
||||
removed.gas["sleeping_agent"] = 0
|
||||
|
||||
else
|
||||
filtered_out = null
|
||||
|
||||
air2.merge(filtered_out)
|
||||
air3.merge(removed)
|
||||
|
||||
if(network2)
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/initialize()
|
||||
set_frequency(frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
|
||||
obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
|
||||
/obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
|
||||
if(..())
|
||||
return
|
||||
|
||||
@@ -211,7 +222,7 @@ obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
|
||||
onclose(user, "atmo_filter")
|
||||
return
|
||||
|
||||
obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
|
||||
/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
@@ -234,9 +245,8 @@ obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
|
||||
*/
|
||||
return
|
||||
|
||||
obj/machinery/atmospherics/trinary/filter/m_filter
|
||||
icon = 'icons/obj/atmospherics/m_filter.dmi'
|
||||
icon_state = "intact_off"
|
||||
/obj/machinery/atmospherics/trinary/filter/m_filter
|
||||
icon_state = "mmap"
|
||||
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
@@ -253,7 +263,9 @@ obj/machinery/atmospherics/trinary/filter/m_filter/New()
|
||||
if(WEST)
|
||||
initialize_directions = WEST|SOUTH|EAST
|
||||
|
||||
obj/machinery/atmospherics/trinary/filter/m_filter/initialize()
|
||||
/obj/machinery/atmospherics/trinary/filter/m_filter/initialize()
|
||||
set_frequency(frequency)
|
||||
|
||||
if(node1 && node2 && node3) return
|
||||
|
||||
var/node1_connect = turn(dir, -180)
|
||||
@@ -276,3 +288,4 @@ obj/machinery/atmospherics/trinary/filter/m_filter/initialize()
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
@@ -1,169 +1,190 @@
|
||||
obj/machinery/atmospherics/trinary/mixer
|
||||
icon = 'icons/obj/atmospherics/mixer.dmi'
|
||||
icon_state = "intact_off"
|
||||
/obj/machinery/atmospherics/trinary/mixer
|
||||
icon = 'icons/atmos/mixer.dmi'
|
||||
icon_state = "map"
|
||||
density = 0
|
||||
level = 1
|
||||
|
||||
name = "Gas mixer"
|
||||
|
||||
var/on = 0
|
||||
|
||||
var/target_pressure = ONE_ATMOSPHERE
|
||||
var/node1_concentration = 0.5
|
||||
var/node2_concentration = 0.5
|
||||
|
||||
//node 3 is the outlet, nodes 1 & 2 are intakes
|
||||
|
||||
update_icon()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "intact_off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
/obj/machinery/atmospherics/trinary/mixer/update_icon(var/safety = 0)
|
||||
if(istype(src, /obj/machinery/atmospherics/trinary/mixer/m_mixer))
|
||||
icon_state = "m"
|
||||
else if(istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer))
|
||||
icon_state = "t"
|
||||
else
|
||||
icon_state = ""
|
||||
|
||||
if(!powered())
|
||||
icon_state += "off"
|
||||
else if(node2 && node3 && node1)
|
||||
icon_state += on ? "on" : "off"
|
||||
else
|
||||
icon_state += "off"
|
||||
on = 0
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
|
||||
if(istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer))
|
||||
add_underlay(T, node1, turn(dir, -90))
|
||||
else
|
||||
icon_state = "intact_off"
|
||||
on = 0
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
|
||||
return
|
||||
if(istype(src, /obj/machinery/atmospherics/trinary/mixer/m_mixer) || istype(src, /obj/machinery/atmospherics/trinary/mixer/t_mixer))
|
||||
add_underlay(T, node2, turn(dir, 90))
|
||||
else
|
||||
add_underlay(T, node2, turn(dir, -90))
|
||||
|
||||
power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
add_underlay(T, node3, dir)
|
||||
|
||||
New()
|
||||
..()
|
||||
air3.volume = 300
|
||||
/obj/machinery/atmospherics/trinary/mixer/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
/obj/machinery/atmospherics/trinary/mixer/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
/obj/machinery/atmospherics/trinary/mixer/New()
|
||||
..()
|
||||
air3.volume = 300
|
||||
|
||||
if(output_starting_pressure >= target_pressure)
|
||||
//No need to mix if target is already full!
|
||||
return 1
|
||||
/obj/machinery/atmospherics/trinary/mixer/process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
//Calculate necessary moles to transfer using PV=nRT
|
||||
|
||||
var/pressure_delta = target_pressure - output_starting_pressure
|
||||
var/transfer_moles1 = 0
|
||||
var/transfer_moles2 = 0
|
||||
|
||||
if(air1.temperature > 0)
|
||||
transfer_moles1 = (node1_concentration*pressure_delta)*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
if(air2.temperature > 0)
|
||||
transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/air1_moles = air1.total_moles()
|
||||
var/air2_moles = air2.total_moles()
|
||||
|
||||
if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
|
||||
if(!transfer_moles1 || !transfer_moles2) return
|
||||
var/ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2)
|
||||
|
||||
transfer_moles1 *= ratio
|
||||
transfer_moles2 *= ratio
|
||||
|
||||
//Actually transfer the gas
|
||||
|
||||
if(transfer_moles1 > 0)
|
||||
var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1)
|
||||
air3.merge(removed1)
|
||||
|
||||
if(transfer_moles2 > 0)
|
||||
var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2)
|
||||
air3.merge(removed2)
|
||||
|
||||
if(network1 && transfer_moles1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2 && transfer_moles2)
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
|
||||
if(output_starting_pressure >= target_pressure)
|
||||
//No need to mix if target is already full!
|
||||
return 1
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
//Calculate necessary moles to transfer using PV=nRT
|
||||
|
||||
attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[target_pressure]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
<br>
|
||||
<b>Node 1 Concentration:</b>
|
||||
<a href='?src=\ref[src];node1_c=-0.1'><b>-</b></a>
|
||||
<a href='?src=\ref[src];node1_c=-0.01'>-</a>
|
||||
[node1_concentration]([node1_concentration*100]%)
|
||||
<a href='?src=\ref[src];node1_c=0.01'><b>+</b></a>
|
||||
<a href='?src=\ref[src];node1_c=0.1'>+</a>
|
||||
<br>
|
||||
<b>Node 2 Concentration:</b>
|
||||
<a href='?src=\ref[src];node2_c=-0.1'><b>-</b></a>
|
||||
<a href='?src=\ref[src];node2_c=-0.01'>-</a>
|
||||
[node2_concentration]([node2_concentration*100]%)
|
||||
<a href='?src=\ref[src];node2_c=0.01'><b>+</b></a>
|
||||
<a href='?src=\ref[src];node2_c=0.1'>+</a>
|
||||
"}
|
||||
var/pressure_delta = target_pressure - output_starting_pressure
|
||||
var/transfer_moles1 = 0
|
||||
var/transfer_moles2 = 0
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_mixer")
|
||||
onclose(user, "atmo_mixer")
|
||||
if(air1.temperature > 0)
|
||||
transfer_moles1 = (node1_concentration*pressure_delta)*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
if(air2.temperature > 0)
|
||||
transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/air1_moles = air1.total_moles
|
||||
var/air2_moles = air2.total_moles
|
||||
|
||||
if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
|
||||
if(!transfer_moles1 || !transfer_moles2) return
|
||||
var/ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2)
|
||||
|
||||
transfer_moles1 *= ratio
|
||||
transfer_moles2 *= ratio
|
||||
|
||||
//Actually transfer the gas
|
||||
|
||||
if(transfer_moles1 > 0)
|
||||
var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1)
|
||||
air3.merge(removed1)
|
||||
|
||||
if(transfer_moles2 > 0)
|
||||
var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2)
|
||||
air3.merge(removed2)
|
||||
|
||||
if(network1 && transfer_moles1)
|
||||
network1.update = 1
|
||||
|
||||
if(network2 && transfer_moles2)
|
||||
network2.update = 1
|
||||
|
||||
if(network3)
|
||||
network3.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
|
||||
if(..())
|
||||
return
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_press"])
|
||||
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
|
||||
src.target_pressure = max(0, min(4500, new_pressure))
|
||||
if(href_list["node1_c"])
|
||||
var/value = text2num(href_list["node1_c"])
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration + value))
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration - value))
|
||||
if(href_list["node2_c"])
|
||||
var/value = text2num(href_list["node2_c"])
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration + value))
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration - value))
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
src.add_fingerprint(usr)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
usr.set_machine(src)
|
||||
var/dat = {"<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
|
||||
<b>Desirable output pressure: </b>
|
||||
[target_pressure]kPa | <a href='?src=\ref[src];set_press=1'>Change</a>
|
||||
<br>
|
||||
<b>Node 1 Concentration:</b>
|
||||
<a href='?src=\ref[src];node1_c=-0.1'><b>-</b></a>
|
||||
<a href='?src=\ref[src];node1_c=-0.01'>-</a>
|
||||
[node1_concentration]([node1_concentration*100]%)
|
||||
<a href='?src=\ref[src];node1_c=0.01'><b>+</b></a>
|
||||
<a href='?src=\ref[src];node1_c=0.1'>+</a>
|
||||
<br>
|
||||
<b>Node 2 Concentration:</b>
|
||||
<a href='?src=\ref[src];node2_c=-0.1'><b>-</b></a>
|
||||
<a href='?src=\ref[src];node2_c=-0.01'>-</a>
|
||||
[node2_concentration]([node2_concentration*100]%)
|
||||
<a href='?src=\ref[src];node2_c=0.01'><b>+</b></a>
|
||||
<a href='?src=\ref[src];node2_c=0.1'>+</a>
|
||||
"}
|
||||
|
||||
user << browse("<HEAD><TITLE>[src.name] control</TITLE></HEAD><TT>[dat]</TT>", "window=atmo_mixer")
|
||||
onclose(user, "atmo_mixer")
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
if(href_list["set_press"])
|
||||
var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
|
||||
src.target_pressure = max(0, min(4500, new_pressure))
|
||||
if(href_list["node1_c"])
|
||||
var/value = text2num(href_list["node1_c"])
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration + value))
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration - value))
|
||||
if(href_list["node2_c"])
|
||||
var/value = text2num(href_list["node2_c"])
|
||||
src.node2_concentration = max(0, min(1, src.node2_concentration + value))
|
||||
src.node1_concentration = max(0, min(1, src.node1_concentration - value))
|
||||
src.update_icon()
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
obj/machinery/atmospherics/trinary/mixer/t_mixer
|
||||
icon = 'icons/obj/atmospherics/t_mixer.dmi'
|
||||
icon_state = "intact_off"
|
||||
icon_state = "tmap"
|
||||
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|EAST|WEST
|
||||
@@ -205,10 +226,10 @@ obj/machinery/atmospherics/trinary/mixer/t_mixer/initialize()
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
obj/machinery/atmospherics/trinary/mixer/m_mixer
|
||||
icon = 'icons/obj/atmospherics/m_mixer.dmi'
|
||||
icon_state = "intact_off"
|
||||
icon_state = "mmap"
|
||||
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
@@ -249,4 +270,5 @@ obj/machinery/atmospherics/trinary/mixer/m_mixer/initialize()
|
||||
node3 = target
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
@@ -2,6 +2,8 @@ obj/machinery/atmospherics/trinary
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
use_power = 1
|
||||
|
||||
var/on = 0
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
@@ -94,6 +96,7 @@ obj/machinery/atmospherics/trinary
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
build_network()
|
||||
if(!network1 && node1)
|
||||
@@ -160,5 +163,7 @@ obj/machinery/atmospherics/trinary
|
||||
else if(reference==node3)
|
||||
del(network3)
|
||||
node3 = null
|
||||
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
@@ -1,10 +1,11 @@
|
||||
obj/machinery/atmospherics/tvalve
|
||||
icon = 'icons/obj/atmospherics/valve.dmi'
|
||||
icon_state = "tvalve0"
|
||||
/obj/machinery/atmospherics/tvalve
|
||||
icon = 'icons/atmos/tvalve.dmi'
|
||||
icon_state = "map_tvalve0"
|
||||
|
||||
name = "manual switching valve"
|
||||
desc = "A pipe valve"
|
||||
|
||||
level = 1
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
|
||||
@@ -19,415 +20,466 @@ obj/machinery/atmospherics/tvalve
|
||||
var/datum/pipe_network/network_node2
|
||||
var/datum/pipe_network/network_node3
|
||||
|
||||
update_icon(animation)
|
||||
if(animation)
|
||||
flick("tvalve[src.state][!src.state]",src)
|
||||
/obj/machinery/atmospherics/tvalve/bypass
|
||||
icon_state = "map_tvalve1"
|
||||
state = 1
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/update_icon(animation)
|
||||
if(animation)
|
||||
flick("tvalve[src.state][!src.state]",src)
|
||||
else
|
||||
icon_state = "tvalve[state]"
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
|
||||
if(istype(src, /obj/machinery/atmospherics/tvalve/mirrored))
|
||||
add_underlay(T, node2, turn(dir, 90))
|
||||
else
|
||||
icon_state = "tvalve[state]"
|
||||
add_underlay(T, node2, turn(dir, -90))
|
||||
|
||||
add_underlay(T, node3, dir)
|
||||
|
||||
New()
|
||||
initialize_directions()
|
||||
..()
|
||||
|
||||
proc/initialize_directions()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
if(SOUTH)
|
||||
initialize_directions = NORTH|SOUTH|WEST
|
||||
if(EAST)
|
||||
initialize_directions = WEST|EAST|SOUTH
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST|NORTH
|
||||
|
||||
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
if(reference == node1)
|
||||
network_node1 = new_network
|
||||
if(state)
|
||||
network_node2 = new_network
|
||||
else
|
||||
network_node3 = new_network
|
||||
else if(reference == node2)
|
||||
network_node2 = new_network
|
||||
if(state)
|
||||
network_node1 = new_network
|
||||
else if(reference == node3)
|
||||
network_node3 = new_network
|
||||
if(!state)
|
||||
network_node1 = new_network
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
new_network.normal_members += src
|
||||
|
||||
if(state)
|
||||
if(reference == node1)
|
||||
if(node2)
|
||||
return node2.network_expand(new_network, src)
|
||||
else if(reference == node2)
|
||||
if(node1)
|
||||
return node1.network_expand(new_network, src)
|
||||
else
|
||||
if(reference == node1)
|
||||
if(node3)
|
||||
return node3.network_expand(new_network, src)
|
||||
else if(reference == node3)
|
||||
if(node1)
|
||||
return node1.network_expand(new_network, src)
|
||||
|
||||
return null
|
||||
|
||||
Del()
|
||||
loc = null
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
del(network_node1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
del(network_node2)
|
||||
if(node3)
|
||||
node3.disconnect(src)
|
||||
del(network_node3)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
node3 = null
|
||||
|
||||
..()
|
||||
|
||||
proc/go_to_side()
|
||||
|
||||
if(state) return 0
|
||||
|
||||
state = 1
|
||||
update_icon()
|
||||
|
||||
if(network_node1)
|
||||
del(network_node1)
|
||||
if(network_node3)
|
||||
del(network_node3)
|
||||
build_network()
|
||||
|
||||
if(network_node1&&network_node2)
|
||||
network_node1.merge(network_node2)
|
||||
network_node2 = network_node1
|
||||
|
||||
if(network_node1)
|
||||
network_node1.update = 1
|
||||
else if(network_node2)
|
||||
network_node2.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
proc/go_straight()
|
||||
|
||||
if(!state)
|
||||
return 0
|
||||
|
||||
state = 0
|
||||
update_icon()
|
||||
|
||||
if(network_node1)
|
||||
del(network_node1)
|
||||
if(network_node2)
|
||||
del(network_node2)
|
||||
build_network()
|
||||
|
||||
if(network_node1&&network_node3)
|
||||
network_node1.merge(network_node3)
|
||||
network_node3 = network_node1
|
||||
|
||||
if(network_node1)
|
||||
network_node1.update = 1
|
||||
else if(network_node3)
|
||||
network_node3.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
attack_ai(mob/user as mob)
|
||||
return
|
||||
|
||||
attack_paw(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(usr)
|
||||
update_icon(1)
|
||||
sleep(10)
|
||||
if (src.state)
|
||||
src.go_straight()
|
||||
else
|
||||
src.go_to_side()
|
||||
|
||||
process()
|
||||
..()
|
||||
machines.Remove(src)
|
||||
|
||||
/* if(open && (!node1 || !node2))
|
||||
close()
|
||||
if(!node1)
|
||||
if(!nodealert)
|
||||
//world << "Missing node from [src] at [src.x],[src.y],[src.z]"
|
||||
nodealert = 1
|
||||
else if (!node2)
|
||||
if(!nodealert)
|
||||
//world << "Missing node from [src] at [src.x],[src.y],[src.z]"
|
||||
nodealert = 1
|
||||
else if (nodealert)
|
||||
nodealert = 0
|
||||
*/
|
||||
|
||||
return
|
||||
|
||||
initialize()
|
||||
var/node1_dir
|
||||
var/node2_dir
|
||||
var/node3_dir
|
||||
|
||||
node1_dir = turn(dir, 180)
|
||||
node2_dir = turn(dir, -90)
|
||||
node3_dir = dir
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node1 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node2 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node3 = target
|
||||
break
|
||||
|
||||
build_network()
|
||||
if(!network_node1 && node1)
|
||||
network_node1 = new /datum/pipe_network()
|
||||
network_node1.normal_members += src
|
||||
network_node1.build_network(node1, src)
|
||||
|
||||
if(!network_node2 && node2)
|
||||
network_node2 = new /datum/pipe_network()
|
||||
network_node2.normal_members += src
|
||||
network_node2.build_network(node2, src)
|
||||
|
||||
if(!network_node3 && node3)
|
||||
network_node3 = new /datum/pipe_network()
|
||||
network_node3.normal_members += src
|
||||
network_node3.build_network(node3, src)
|
||||
|
||||
|
||||
return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network_node1
|
||||
|
||||
if(reference==node2)
|
||||
return network_node2
|
||||
|
||||
if(reference==node3)
|
||||
return network_node3
|
||||
|
||||
return null
|
||||
|
||||
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network_node1 == old_network)
|
||||
network_node1 = new_network
|
||||
if(network_node2 == old_network)
|
||||
network_node2 = new_network
|
||||
if(network_node3 == old_network)
|
||||
network_node3 = new_network
|
||||
|
||||
return 1
|
||||
|
||||
return_network_air(datum/network/reference)
|
||||
return null
|
||||
|
||||
disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
del(network_node1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
del(network_node2)
|
||||
node2 = null
|
||||
|
||||
else if(reference==node3)
|
||||
del(network_node3)
|
||||
node2 = null
|
||||
|
||||
return null
|
||||
|
||||
digital // can be controlled by AI
|
||||
name = "digital switching valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon = 'icons/obj/atmospherics/digital_valve.dmi'
|
||||
|
||||
attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
..()
|
||||
|
||||
//Radio remote control
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
return 0
|
||||
|
||||
switch(signal.data["command"])
|
||||
if("valve_open")
|
||||
if(!state)
|
||||
go_to_side()
|
||||
|
||||
if("valve_close")
|
||||
if(state)
|
||||
go_straight()
|
||||
|
||||
if("valve_toggle")
|
||||
if(state)
|
||||
go_straight()
|
||||
else
|
||||
go_to_side()
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (istype(src, /obj/machinery/atmospherics/tvalve/digital))
|
||||
user << "\red You cannot unwrench this [src], it's too complicated."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
obj/machinery/atmospherics/tvalve/mirrored
|
||||
icon_state = "tvalvem0"
|
||||
/obj/machinery/atmospherics/tvalve/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/New()
|
||||
initialize_directions()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
if(SOUTH)
|
||||
initialize_directions = NORTH|SOUTH|EAST
|
||||
if(EAST)
|
||||
initialize_directions = WEST|EAST|NORTH
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST|SOUTH
|
||||
..()
|
||||
|
||||
initialize()
|
||||
var/node1_dir
|
||||
var/node2_dir
|
||||
var/node3_dir
|
||||
/obj/machinery/atmospherics/tvalve/proc/initialize_directions()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = SOUTH|NORTH|EAST
|
||||
if(SOUTH)
|
||||
initialize_directions = NORTH|SOUTH|WEST
|
||||
if(EAST)
|
||||
initialize_directions = WEST|EAST|SOUTH
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST|NORTH
|
||||
|
||||
node1_dir = turn(dir, 180)
|
||||
node2_dir = turn(dir, 90)
|
||||
node3_dir = dir
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node1 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node2 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node3 = target
|
||||
break
|
||||
|
||||
update_icon(animation)
|
||||
if(animation)
|
||||
flick("tvalvem[src.state][!src.state]",src)
|
||||
/obj/machinery/atmospherics/tvalve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
if(reference == node1)
|
||||
network_node1 = new_network
|
||||
if(state)
|
||||
network_node2 = new_network
|
||||
else
|
||||
icon_state = "tvalvem[state]"
|
||||
network_node3 = new_network
|
||||
else if(reference == node2)
|
||||
network_node2 = new_network
|
||||
if(state)
|
||||
network_node1 = new_network
|
||||
else if(reference == node3)
|
||||
network_node3 = new_network
|
||||
if(!state)
|
||||
network_node1 = new_network
|
||||
|
||||
digital // can be controlled by AI
|
||||
name = "digital switching valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon = 'icons/obj/atmospherics/digital_valve.dmi'
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
new_network.normal_members += src
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
..()
|
||||
if(state)
|
||||
if(reference == node1)
|
||||
if(node2)
|
||||
return node2.network_expand(new_network, src)
|
||||
else if(reference == node2)
|
||||
if(node1)
|
||||
return node1.network_expand(new_network, src)
|
||||
else
|
||||
if(reference == node1)
|
||||
if(node3)
|
||||
return node3.network_expand(new_network, src)
|
||||
else if(reference == node3)
|
||||
if(node1)
|
||||
return node1.network_expand(new_network, src)
|
||||
|
||||
//Radio remote control -eh?
|
||||
return null
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
/obj/machinery/atmospherics/tvalve/Del()
|
||||
loc = null
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
del(network_node1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
del(network_node2)
|
||||
if(node3)
|
||||
node3.disconnect(src)
|
||||
del(network_node3)
|
||||
|
||||
initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
node1 = null
|
||||
node2 = null
|
||||
node3 = null
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
return 0
|
||||
..()
|
||||
|
||||
switch(signal.data["command"])
|
||||
if("valve_open")
|
||||
if(!state)
|
||||
go_to_side()
|
||||
/obj/machinery/atmospherics/tvalve/proc/go_to_side()
|
||||
|
||||
if("valve_close")
|
||||
if(state)
|
||||
go_straight()
|
||||
if(state) return 0
|
||||
|
||||
if("valve_toggle")
|
||||
if(state)
|
||||
go_straight()
|
||||
else
|
||||
go_to_side()
|
||||
state = 1
|
||||
update_icon()
|
||||
|
||||
if(network_node1)
|
||||
del(network_node1)
|
||||
if(network_node3)
|
||||
del(network_node3)
|
||||
build_network()
|
||||
|
||||
if(network_node1&&network_node2)
|
||||
network_node1.merge(network_node2)
|
||||
network_node2 = network_node1
|
||||
|
||||
if(network_node1)
|
||||
network_node1.update = 1
|
||||
else if(network_node2)
|
||||
network_node2.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/proc/go_straight()
|
||||
|
||||
if(!state)
|
||||
return 0
|
||||
|
||||
state = 0
|
||||
update_icon()
|
||||
|
||||
if(network_node1)
|
||||
del(network_node1)
|
||||
if(network_node2)
|
||||
del(network_node2)
|
||||
build_network()
|
||||
|
||||
if(network_node1&&network_node3)
|
||||
network_node1.merge(network_node3)
|
||||
network_node3 = network_node1
|
||||
|
||||
if(network_node1)
|
||||
network_node1.update = 1
|
||||
else if(network_node3)
|
||||
network_node3.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/attack_ai(mob/user as mob)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/attack_paw(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(usr)
|
||||
update_icon(1)
|
||||
sleep(10)
|
||||
if (src.state)
|
||||
src.go_straight()
|
||||
else
|
||||
src.go_to_side()
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/process()
|
||||
..()
|
||||
. = PROCESS_KILL
|
||||
//machines.Remove(src)
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/initialize()
|
||||
var/node1_dir
|
||||
var/node2_dir
|
||||
var/node3_dir
|
||||
|
||||
node1_dir = turn(dir, 180)
|
||||
node2_dir = turn(dir, -90)
|
||||
node3_dir = dir
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node1 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node2 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node3 = target
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/build_network()
|
||||
if(!network_node1 && node1)
|
||||
network_node1 = new /datum/pipe_network()
|
||||
network_node1.normal_members += src
|
||||
network_node1.build_network(node1, src)
|
||||
|
||||
if(!network_node2 && node2)
|
||||
network_node2 = new /datum/pipe_network()
|
||||
network_node2.normal_members += src
|
||||
network_node2.build_network(node2, src)
|
||||
|
||||
if(!network_node3 && node3)
|
||||
network_node3 = new /datum/pipe_network()
|
||||
network_node3.normal_members += src
|
||||
network_node3.build_network(node3, src)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network_node1
|
||||
|
||||
if(reference==node2)
|
||||
return network_node2
|
||||
|
||||
if(reference==node3)
|
||||
return network_node3
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network_node1 == old_network)
|
||||
network_node1 = new_network
|
||||
if(network_node2 == old_network)
|
||||
network_node2 = new_network
|
||||
if(network_node3 == old_network)
|
||||
network_node3 = new_network
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/return_network_air(datum/network/reference)
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
del(network_node1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
del(network_node2)
|
||||
node2 = null
|
||||
|
||||
else if(reference==node3)
|
||||
del(network_node3)
|
||||
node2 = null
|
||||
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital // can be controlled by AI
|
||||
name = "digital switching valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon = 'icons/atmos/digital_tvalve.dmi'
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/bypass
|
||||
icon_state = "map_tvalve1"
|
||||
state = 1
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/update_icon()
|
||||
..()
|
||||
if(!powered())
|
||||
icon_state = "tvalvenopower"
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/attack_hand(mob/user as mob)
|
||||
if(!powered())
|
||||
return
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
..()
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/digital/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
return 0
|
||||
|
||||
switch(signal.data["command"])
|
||||
if("valve_open")
|
||||
if(!state)
|
||||
go_to_side()
|
||||
|
||||
if("valve_close")
|
||||
if(state)
|
||||
go_straight()
|
||||
|
||||
if("valve_toggle")
|
||||
if(state)
|
||||
go_straight()
|
||||
else
|
||||
go_to_side()
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (istype(src, /obj/machinery/atmospherics/tvalve/digital))
|
||||
user << "\red You cannot unwrench this [src], it's too complicated."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored
|
||||
icon_state = "map_tvalvem0"
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/bypass
|
||||
icon_state = "map_tvalvem1"
|
||||
state = 1
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/initialize_directions()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
if(SOUTH)
|
||||
initialize_directions = NORTH|SOUTH|EAST
|
||||
if(EAST)
|
||||
initialize_directions = WEST|EAST|NORTH
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST|SOUTH
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/initialize()
|
||||
var/node1_dir
|
||||
var/node2_dir
|
||||
var/node3_dir
|
||||
|
||||
node1_dir = turn(dir, 180)
|
||||
node2_dir = turn(dir, 90)
|
||||
node3_dir = dir
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node1 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node2 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node3_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node3 = target
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/update_icon(animation)
|
||||
if(animation)
|
||||
flick("tvalvem[src.state][!src.state]",src)
|
||||
else
|
||||
icon_state = "tvalvem[state]"
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital // can be controlled by AI
|
||||
name = "digital switching valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon = 'icons/atmos/digital_tvalve.dmi'
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/bypass
|
||||
icon_state = "map_tvalvem1"
|
||||
state = 1
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/update_icon()
|
||||
..()
|
||||
if(!powered())
|
||||
icon_state = "tvalvemnopower"
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/attack_hand(mob/user as mob)
|
||||
if(!powered())
|
||||
return
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
..()
|
||||
|
||||
//Radio remote control -eh?
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/tvalve/mirrored/digital/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
return 0
|
||||
|
||||
switch(signal.data["command"])
|
||||
if("valve_open")
|
||||
if(!state)
|
||||
go_to_side()
|
||||
|
||||
if("valve_close")
|
||||
if(state)
|
||||
go_straight()
|
||||
|
||||
if("valve_toggle")
|
||||
if(state)
|
||||
go_straight()
|
||||
else
|
||||
go_to_side()
|
||||
@@ -1,7 +1,8 @@
|
||||
/obj/machinery/atmospherics/unary/outlet_injector
|
||||
icon = 'icons/obj/atmospherics/outlet_injector.dmi'
|
||||
icon_state = "off"
|
||||
icon = 'icons/atmos/injector.dmi'
|
||||
icon_state = "map_injector"
|
||||
use_power = 1
|
||||
layer = 3
|
||||
|
||||
name = "Air Injector"
|
||||
desc = "Has a valve and pump attached to it"
|
||||
@@ -17,131 +18,122 @@
|
||||
|
||||
level = 1
|
||||
|
||||
update_icon()
|
||||
if(node)
|
||||
if(on && !(stat & NOPOWER))
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
|
||||
else
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
on = 0
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "off"
|
||||
else
|
||||
icon_state = "[on ? "on" : "off"]"
|
||||
|
||||
return
|
||||
|
||||
power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
|
||||
process()
|
||||
..()
|
||||
injecting = 0
|
||||
|
||||
if(!on || stat & NOPOWER)
|
||||
return 0
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
proc/inject()
|
||||
if(on || injecting)
|
||||
return 0
|
||||
|
||||
injecting = 1
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
flick("inject", src)
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency)
|
||||
|
||||
broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AO",
|
||||
"power" = on,
|
||||
"volume_rate" = volume_rate,
|
||||
//"timestamp" = world.time,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
return 1
|
||||
|
||||
initialize()
|
||||
..()
|
||||
|
||||
set_frequency(frequency)
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
if("power" in signal.data)
|
||||
on = text2num(signal.data["power"])
|
||||
|
||||
if("power_toggle" in signal.data)
|
||||
on = !on
|
||||
|
||||
if("inject" in signal.data)
|
||||
spawn inject()
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node, dir)
|
||||
|
||||
if("set_volume_rate" in signal.data)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
volume_rate = between(0, number, air_contents.volume)
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: outlet_injector/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
||||
//return
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(node)
|
||||
if(on)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]exposed"
|
||||
on = 0
|
||||
return
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/process()
|
||||
..()
|
||||
injecting = 0
|
||||
|
||||
if(!on || stat & NOPOWER)
|
||||
return 0
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/proc/inject()
|
||||
if(on || injecting)
|
||||
return 0
|
||||
|
||||
injecting = 1
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
flick("inject", src)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"device" = "AO",
|
||||
"power" = on,
|
||||
"volume_rate" = volume_rate,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/initialize()
|
||||
..()
|
||||
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
if(signal.data["power"])
|
||||
on = text2num(signal.data["power"])
|
||||
|
||||
if(signal.data["power_toggle"])
|
||||
on = !on
|
||||
|
||||
if(signal.data["inject"])
|
||||
spawn inject()
|
||||
return
|
||||
|
||||
if(signal.data["set_volume_rate"])
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
volume_rate = between(0, number, air_contents.volume)
|
||||
|
||||
if(signal.data["status"])
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: outlet_injector/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
||||
//return
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/hide(var/i)
|
||||
update_underlays()
|
||||
@@ -33,7 +33,7 @@ obj/machinery/atmospherics/unary/oxygen_generator
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/total_moles = air_contents.total_moles()
|
||||
var/total_moles = air_contents.total_moles
|
||||
|
||||
if(total_moles < oxygen_content)
|
||||
var/current_heat_capacity = air_contents.heat_capacity()
|
||||
@@ -41,7 +41,7 @@ obj/machinery/atmospherics/unary/oxygen_generator
|
||||
var/added_oxygen = oxygen_content - total_moles
|
||||
|
||||
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
|
||||
air_contents.oxygen += added_oxygen
|
||||
air_contents.adjust_gas("oxygen", added_oxygen)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
break
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
build_network()
|
||||
if(!network && node)
|
||||
@@ -85,4 +86,7 @@
|
||||
del(network)
|
||||
node = null
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
return null
|
||||
@@ -4,8 +4,8 @@
|
||||
#undefine
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump
|
||||
icon = 'icons/obj/atmospherics/vent_pump.dmi'
|
||||
icon_state = "off"
|
||||
icon = 'icons/atmos/vent_pump.dmi'
|
||||
icon_state = "map_vent"
|
||||
|
||||
name = "Air Vent"
|
||||
desc = "Has a valve and pump attached to it"
|
||||
@@ -40,316 +40,329 @@
|
||||
var/radio_filter_out
|
||||
var/radio_filter_in
|
||||
|
||||
on
|
||||
on = 1
|
||||
icon_state = "out"
|
||||
/obj/machinery/atmospherics/unary/vent_pump/on
|
||||
on = 1
|
||||
icon_state = "map_vent_out"
|
||||
|
||||
siphon
|
||||
pump_direction = 0
|
||||
icon_state = "off"
|
||||
/obj/machinery/atmospherics/unary/vent_pump/siphon
|
||||
pump_direction = 0
|
||||
|
||||
on
|
||||
on = 1
|
||||
icon_state = "in"
|
||||
/obj/machinery/atmospherics/unary/vent_pump/siphon/on
|
||||
on = 1
|
||||
icon_state = "map_vent_in"
|
||||
|
||||
New()
|
||||
initial_loc = get_area(loc)
|
||||
if (initial_loc.master)
|
||||
initial_loc = initial_loc.master
|
||||
area_uid = initial_loc.uid
|
||||
if (!id_tag)
|
||||
assign_uid()
|
||||
id_tag = num2text(uid)
|
||||
if(ticker && ticker.current_state == 3)//if the game is running
|
||||
src.initialize()
|
||||
src.broadcast_status()
|
||||
..()
|
||||
/obj/machinery/atmospherics/unary/vent_pump/New()
|
||||
icon = null
|
||||
initial_loc = get_area(loc)
|
||||
if (initial_loc.master)
|
||||
initial_loc = initial_loc.master
|
||||
area_uid = initial_loc.uid
|
||||
if (!id_tag)
|
||||
assign_uid()
|
||||
id_tag = num2text(uid)
|
||||
if(ticker && ticker.current_state == 3)//if the game is running
|
||||
src.initialize()
|
||||
src.broadcast_status()
|
||||
..()
|
||||
|
||||
high_volume
|
||||
name = "Large Air Vent"
|
||||
power_channel = EQUIP
|
||||
New()
|
||||
..()
|
||||
air_contents.volume = 1000
|
||||
/obj/machinery/atmospherics/unary/vent_pump/high_volume
|
||||
name = "Large Air Vent"
|
||||
power_channel = EQUIP
|
||||
|
||||
update_icon()
|
||||
if(welded)
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld"
|
||||
return
|
||||
if(on && !(stat & (NOPOWER|BROKEN)))
|
||||
if(pump_direction)
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
|
||||
else
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
|
||||
else
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
/obj/machinery/atmospherics/unary/vent_pump/high_volume/New()
|
||||
..()
|
||||
air_contents.volume = 1000
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/update_icon(var/safety = 0)
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
process()
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
overlays.Cut()
|
||||
|
||||
var/vent_icon = "vent"
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
|
||||
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
||||
vent_icon += "h"
|
||||
|
||||
if(welded)
|
||||
vent_icon += "weld"
|
||||
else if(!powered())
|
||||
vent_icon += "off"
|
||||
else
|
||||
vent_icon += "[on ? "[pump_direction ? "out" : "in"]" : "off"]"
|
||||
|
||||
overlays += icon_manager.get_atmos_icon("device", , , vent_icon)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
if (!node)
|
||||
on = 0
|
||||
//broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
if(welded)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
|
||||
if(pump_direction) //internal -> external
|
||||
var/pressure_delta = 10000
|
||||
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||
if(pressure_checks&2)
|
||||
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
|
||||
|
||||
if(pressure_delta > 0.5)
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
else //external -> internal
|
||||
var/pressure_delta = 10000
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||
if(pressure_checks&2)
|
||||
pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
|
||||
|
||||
if(pressure_delta > 0.5)
|
||||
if(environment.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
if (isnull(removed)) //in space
|
||||
return
|
||||
|
||||
air_contents.merge(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
//Radio remote control
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
|
||||
|
||||
broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"area" = src.area_uid,
|
||||
"tag" = src.id_tag,
|
||||
"device" = "AVP",
|
||||
"power" = on,
|
||||
"direction" = pump_direction?("release"):("siphon"),
|
||||
"checks" = pressure_checks,
|
||||
"internal" = internal_pressure_bound,
|
||||
"external" = external_pressure_bound,
|
||||
"timestamp" = world.time,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
if(!initial_loc.air_vent_names[id_tag])
|
||||
var/new_name = "[initial_loc.name] Vent Pump #[initial_loc.air_vent_names.len+1]"
|
||||
initial_loc.air_vent_names[id_tag] = new_name
|
||||
src.name = new_name
|
||||
initial_loc.air_vent_info[id_tag] = signal.data
|
||||
|
||||
radio_connection.post_signal(src, signal, radio_filter_out)
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
initialize()
|
||||
..()
|
||||
|
||||
//some vents work his own spesial way
|
||||
radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
|
||||
radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
||||
return
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
else
|
||||
add_underlay(T, node, dir)
|
||||
|
||||
if(signal.data["purge"] != null)
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
/obj/machinery/atmospherics/unary/vent_pump/hide()
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
if(signal.data["stabalize"] != null)
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
/obj/machinery/atmospherics/unary/vent_pump/process()
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
on = 0
|
||||
//broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
if(signal.data["power"] != null)
|
||||
on = text2num(signal.data["power"])
|
||||
if(welded)
|
||||
return 0
|
||||
|
||||
if(signal.data["power_toggle"] != null)
|
||||
on = !on
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
|
||||
if(signal.data["checks"] != null)
|
||||
if (signal.data["checks"] == "default")
|
||||
pressure_checks = pressure_checks_default
|
||||
else
|
||||
pressure_checks = text2num(signal.data["checks"])
|
||||
if(pump_direction) //internal -> external
|
||||
var/pressure_delta = 10000
|
||||
|
||||
if(signal.data["checks_toggle"] != null)
|
||||
pressure_checks = (pressure_checks?0:3)
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||
if(pressure_checks&2)
|
||||
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
|
||||
|
||||
if(signal.data["direction"] != null)
|
||||
pump_direction = text2num(signal.data["direction"])
|
||||
if(pressure_delta > 0.5)
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
if(signal.data["set_internal_pressure"] != null)
|
||||
if (signal.data["set_internal_pressure"] == "default")
|
||||
internal_pressure_bound = internal_pressure_bound_default
|
||||
else
|
||||
internal_pressure_bound = between(
|
||||
0,
|
||||
text2num(signal.data["set_internal_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||
|
||||
if(signal.data["set_external_pressure"] != null)
|
||||
if (signal.data["set_external_pressure"] == "default")
|
||||
external_pressure_bound = external_pressure_bound_default
|
||||
else
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(signal.data["adjust_internal_pressure"] != null)
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
else //external -> internal
|
||||
var/pressure_delta = 10000
|
||||
if(pressure_checks&1)
|
||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||
if(pressure_checks&2)
|
||||
pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
|
||||
|
||||
if(pressure_delta > 0.5)
|
||||
if(environment.temperature > 0)
|
||||
var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
if (isnull(removed)) //in space
|
||||
return
|
||||
|
||||
air_contents.merge(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"area" = src.area_uid,
|
||||
"tag" = src.id_tag,
|
||||
"device" = "AVP",
|
||||
"power" = on,
|
||||
"direction" = pump_direction?("release"):("siphon"),
|
||||
"checks" = pressure_checks,
|
||||
"internal" = internal_pressure_bound,
|
||||
"external" = external_pressure_bound,
|
||||
"timestamp" = world.time,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
if(!initial_loc.air_vent_names[id_tag])
|
||||
var/new_name = "[initial_loc.name] Vent Pump #[initial_loc.air_vent_names.len+1]"
|
||||
initial_loc.air_vent_names[id_tag] = new_name
|
||||
src.name = new_name
|
||||
initial_loc.air_vent_info[id_tag] = signal.data
|
||||
|
||||
radio_connection.post_signal(src, signal, radio_filter_out)
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/initialize()
|
||||
..()
|
||||
|
||||
//some vents work his own spesial way
|
||||
radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
|
||||
radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
if(signal.data["purge"] != null)
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
|
||||
if(signal.data["stabalize"] != null)
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
|
||||
if(signal.data["power"] != null)
|
||||
on = text2num(signal.data["power"])
|
||||
|
||||
if(signal.data["power_toggle"] != null)
|
||||
on = !on
|
||||
|
||||
if(signal.data["checks"] != null)
|
||||
if (signal.data["checks"] == "default")
|
||||
pressure_checks = pressure_checks_default
|
||||
else
|
||||
pressure_checks = text2num(signal.data["checks"])
|
||||
|
||||
if(signal.data["checks_toggle"] != null)
|
||||
pressure_checks = (pressure_checks?0:3)
|
||||
|
||||
if(signal.data["direction"] != null)
|
||||
pump_direction = text2num(signal.data["direction"])
|
||||
|
||||
if(signal.data["set_internal_pressure"] != null)
|
||||
if (signal.data["set_internal_pressure"] == "default")
|
||||
internal_pressure_bound = internal_pressure_bound_default
|
||||
else
|
||||
internal_pressure_bound = between(
|
||||
0,
|
||||
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
|
||||
text2num(signal.data["set_internal_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if(signal.data["adjust_external_pressure"] != null)
|
||||
|
||||
|
||||
if(signal.data["set_external_pressure"] != null)
|
||||
if (signal.data["set_external_pressure"] == "default")
|
||||
external_pressure_bound = external_pressure_bound_default
|
||||
else
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if(signal.data["init"] != null)
|
||||
name = signal.data["init"]
|
||||
return
|
||||
if(signal.data["adjust_internal_pressure"] != null)
|
||||
internal_pressure_bound = between(
|
||||
0,
|
||||
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if(signal.data["status"] != null)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
if(signal.data["adjust_external_pressure"] != null)
|
||||
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
||||
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if(signal.data["init"] != null)
|
||||
name = signal.data["init"]
|
||||
return
|
||||
|
||||
if(signal.data["status"] != null)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
return //do not update_icon
|
||||
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(welded)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld"
|
||||
return
|
||||
if(on&&node)
|
||||
if(pump_direction)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
on = 0
|
||||
return
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.remove_fuel(0,user))
|
||||
user << "\blue Now welding the vent."
|
||||
if(do_after(user, 20))
|
||||
if(!src || !WT.isOn()) return
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
||||
if(!welded)
|
||||
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
|
||||
welded = 1
|
||||
update_icon()
|
||||
else
|
||||
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
|
||||
welded = 0
|
||||
update_icon()
|
||||
/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.remove_fuel(0,user))
|
||||
user << "\blue Now welding the vent."
|
||||
if(do_after(user, 20))
|
||||
if(!src || !WT.isOn()) return
|
||||
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
||||
if(!welded)
|
||||
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
|
||||
welded = 1
|
||||
update_icon()
|
||||
else
|
||||
user << "\blue The welding tool needs to be on to start this task."
|
||||
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
|
||||
welded = 0
|
||||
update_icon()
|
||||
else
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return 1
|
||||
examine()
|
||||
set src in oview(1)
|
||||
..()
|
||||
if(welded)
|
||||
usr << "It seems welded shut."
|
||||
|
||||
power_change()
|
||||
if(powered(power_channel))
|
||||
stat &= ~NOPOWER
|
||||
user << "\blue The welding tool needs to be on to start this task."
|
||||
else
|
||||
stat |= NOPOWER
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return 1
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/examine()
|
||||
set src in oview(1)
|
||||
..()
|
||||
if(welded)
|
||||
usr << "It seems welded shut."
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
/obj/machinery/atmospherics/unary/vent_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (node && node.level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/Del()
|
||||
if(initial_loc)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber
|
||||
icon = 'icons/obj/atmospherics/vent_scrubber.dmi'
|
||||
icon_state = "off"
|
||||
icon = 'icons/atmos/vent_scrubber.dmi'
|
||||
icon_state = "map_scrubber"
|
||||
|
||||
name = "Air Scrubber"
|
||||
desc = "Has a valve and pump attached to it"
|
||||
@@ -25,245 +25,252 @@
|
||||
var/area_uid
|
||||
var/radio_filter_out
|
||||
var/radio_filter_in
|
||||
New()
|
||||
initial_loc = get_area(loc)
|
||||
if (initial_loc.master)
|
||||
initial_loc = initial_loc.master
|
||||
area_uid = initial_loc.uid
|
||||
if (!id_tag)
|
||||
assign_uid()
|
||||
id_tag = num2text(uid)
|
||||
if(ticker && ticker.current_state == 3)//if the game is running
|
||||
src.initialize()
|
||||
src.broadcast_status()
|
||||
..()
|
||||
|
||||
update_icon()
|
||||
if(node && on && !(stat & (NOPOWER|BROKEN)))
|
||||
if(scrubbing)
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
|
||||
else
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
|
||||
else
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/New()
|
||||
icon = null
|
||||
initial_loc = get_area(loc)
|
||||
if (initial_loc.master)
|
||||
initial_loc = initial_loc.master
|
||||
area_uid = initial_loc.uid
|
||||
if (!id_tag)
|
||||
assign_uid()
|
||||
id_tag = num2text(uid)
|
||||
if(ticker && ticker.current_state == 3)//if the game is running
|
||||
src.initialize()
|
||||
src.broadcast_status()
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/update_icon(var/safety = 0)
|
||||
if(!check_icon_cache())
|
||||
return
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = radio_controller.add_object(src, frequency, radio_filter_in)
|
||||
overlays.Cut()
|
||||
|
||||
broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
var/scrubber_icon = "scrubber"
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
signal.data = list(
|
||||
"area" = area_uid,
|
||||
"tag" = id_tag,
|
||||
"device" = "AScr",
|
||||
"timestamp" = world.time,
|
||||
"power" = on,
|
||||
"scrubbing" = scrubbing,
|
||||
"panic" = panic,
|
||||
"filter_co2" = scrub_CO2,
|
||||
"filter_phoron" = scrub_Toxins,
|
||||
"filter_n2o" = scrub_N2O,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
if(!initial_loc.air_scrub_names[id_tag])
|
||||
var/new_name = "[initial_loc.name] Air Scrubber #[initial_loc.air_scrub_names.len+1]"
|
||||
initial_loc.air_scrub_names[id_tag] = new_name
|
||||
src.name = new_name
|
||||
initial_loc.air_scrub_info[id_tag] = signal.data
|
||||
radio_connection.post_signal(src, signal, radio_filter_out)
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
|
||||
return 1
|
||||
if(!powered())
|
||||
scrubber_icon += "off"
|
||||
else
|
||||
scrubber_icon += "[on ? "[scrubbing ? "on" : "in"]" : "off"]"
|
||||
|
||||
initialize()
|
||||
..()
|
||||
radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
|
||||
radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
|
||||
if (frequency)
|
||||
set_frequency(frequency)
|
||||
overlays += icon_manager.get_atmos_icon("device", , , scrubber_icon)
|
||||
|
||||
process()
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
if (!node)
|
||||
on = 0
|
||||
//broadcast_status()
|
||||
if(!on)
|
||||
return 0
|
||||
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
||||
return
|
||||
else
|
||||
add_underlay(T, node, dir)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = radio_controller.add_object(src, frequency, radio_filter_in)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
signal.data = list(
|
||||
"area" = area_uid,
|
||||
"tag" = id_tag,
|
||||
"device" = "AScr",
|
||||
"timestamp" = world.time,
|
||||
"power" = on,
|
||||
"scrubbing" = scrubbing,
|
||||
"panic" = panic,
|
||||
"filter_co2" = scrub_CO2,
|
||||
"filter_phoron" = scrub_Toxins,
|
||||
"filter_n2o" = scrub_N2O,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
if(!initial_loc.air_scrub_names[id_tag])
|
||||
var/new_name = "[initial_loc.name] Air Scrubber #[initial_loc.air_scrub_names.len+1]"
|
||||
initial_loc.air_scrub_names[id_tag] = new_name
|
||||
src.name = new_name
|
||||
initial_loc.air_scrub_info[id_tag] = signal.data
|
||||
radio_connection.post_signal(src, signal, radio_filter_out)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/initialize()
|
||||
..()
|
||||
radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
|
||||
radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
|
||||
if (frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/process()
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
on = 0
|
||||
//broadcast_status()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
if(scrubbing)
|
||||
if((environment.phoron>0.001) || (environment.carbon_dioxide>0.001) || (environment.trace_gases.len>0))
|
||||
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
|
||||
if(scrubbing)
|
||||
if((environment.gas["phoron"]>0.001) || (environment.gas["carbon_dioxide"]>0.001) || (environment.gas["oxygen_agent_b"]>0.001) || (environment.gas["sleeping_agent"]>0.001))
|
||||
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles
|
||||
|
||||
//Take a gas sample
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
if (isnull(removed)) //in space
|
||||
return
|
||||
|
||||
//Filter it
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.temperature
|
||||
if(scrub_Toxins)
|
||||
filtered_out.phoron = removed.phoron
|
||||
removed.phoron = 0
|
||||
if(scrub_CO2)
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
|
||||
|
||||
//Remix the resulting gases
|
||||
air_contents.merge(filtered_out)
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
else //Just siphoning all air
|
||||
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
|
||||
//Take a gas sample
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
if (isnull(removed)) //in space
|
||||
return
|
||||
|
||||
var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume)
|
||||
//Filter it
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.temperature
|
||||
if(scrub_Toxins)
|
||||
filtered_out.gas["phoron"] = removed.gas["phoron"]
|
||||
removed.gas["phoron"] = 0
|
||||
if(scrub_CO2)
|
||||
filtered_out.gas["carbon_dioxide"] = removed.gas["carbon_dioxide"]
|
||||
removed.gas["carbon_dioxide"] = 0
|
||||
if(scrub_N2O)
|
||||
filtered_out.gas["sleeping_agent"] = removed.gas["sleeping_agent"]
|
||||
removed.gas["sleeping_agent"] = 0
|
||||
if(removed.gas["oxygen_agent_b"])
|
||||
filtered_out.gas["oxygen_agent_b"] = removed.gas["oxygen_agent_b"]
|
||||
removed.gas["oxygen_agent_b"] = 0
|
||||
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
//Remix the resulting gases
|
||||
air_contents.merge(filtered_out)
|
||||
|
||||
air_contents.merge(removed)
|
||||
loc.assume_air(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
/* //unused piece of code
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(on&&node)
|
||||
if(scrubbing)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
on = 0
|
||||
else //Just siphoning all air
|
||||
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
|
||||
return
|
||||
|
||||
var/transfer_moles = environment.total_moles*(volume_rate/environment.volume)
|
||||
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
|
||||
air_contents.merge(removed)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
*/
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
if(signal.data["power"] != null)
|
||||
on = text2num(signal.data["power"])
|
||||
if(signal.data["power_toggle"] != null)
|
||||
on = !on
|
||||
|
||||
if(signal.data["power"] != null)
|
||||
on = text2num(signal.data["power"])
|
||||
if(signal.data["power_toggle"] != null)
|
||||
on = !on
|
||||
if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing
|
||||
panic = text2num(signal.data["panic_siphon"] != null)
|
||||
if(panic)
|
||||
on = 1
|
||||
scrubbing = 0
|
||||
volume_rate = 2000
|
||||
else
|
||||
scrubbing = 1
|
||||
volume_rate = initial(volume_rate)
|
||||
if(signal.data["toggle_panic_siphon"] != null)
|
||||
panic = !panic
|
||||
if(panic)
|
||||
on = 1
|
||||
scrubbing = 0
|
||||
volume_rate = 2000
|
||||
else
|
||||
scrubbing = 1
|
||||
volume_rate = initial(volume_rate)
|
||||
|
||||
if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing
|
||||
panic = text2num(signal.data["panic_siphon"] != null)
|
||||
if(panic)
|
||||
on = 1
|
||||
scrubbing = 0
|
||||
volume_rate = 2000
|
||||
else
|
||||
scrubbing = 1
|
||||
volume_rate = initial(volume_rate)
|
||||
if(signal.data["toggle_panic_siphon"] != null)
|
||||
panic = !panic
|
||||
if(panic)
|
||||
on = 1
|
||||
scrubbing = 0
|
||||
volume_rate = 2000
|
||||
else
|
||||
scrubbing = 1
|
||||
volume_rate = initial(volume_rate)
|
||||
if(signal.data["scrubbing"] != null)
|
||||
scrubbing = text2num(signal.data["scrubbing"])
|
||||
if(signal.data["toggle_scrubbing"])
|
||||
scrubbing = !scrubbing
|
||||
|
||||
if(signal.data["scrubbing"] != null)
|
||||
scrubbing = text2num(signal.data["scrubbing"])
|
||||
if(signal.data["toggle_scrubbing"])
|
||||
scrubbing = !scrubbing
|
||||
if(signal.data["co2_scrub"] != null)
|
||||
scrub_CO2 = text2num(signal.data["co2_scrub"])
|
||||
if(signal.data["toggle_co2_scrub"])
|
||||
scrub_CO2 = !scrub_CO2
|
||||
|
||||
if(signal.data["co2_scrub"] != null)
|
||||
scrub_CO2 = text2num(signal.data["co2_scrub"])
|
||||
if(signal.data["toggle_co2_scrub"])
|
||||
scrub_CO2 = !scrub_CO2
|
||||
if(signal.data["tox_scrub"] != null)
|
||||
scrub_Toxins = text2num(signal.data["tox_scrub"])
|
||||
if(signal.data["toggle_tox_scrub"])
|
||||
scrub_Toxins = !scrub_Toxins
|
||||
|
||||
if(signal.data["tox_scrub"] != null)
|
||||
scrub_Toxins = text2num(signal.data["tox_scrub"])
|
||||
if(signal.data["toggle_tox_scrub"])
|
||||
scrub_Toxins = !scrub_Toxins
|
||||
if(signal.data["n2o_scrub"] != null)
|
||||
scrub_N2O = text2num(signal.data["n2o_scrub"])
|
||||
if(signal.data["toggle_n2o_scrub"])
|
||||
scrub_N2O = !scrub_N2O
|
||||
|
||||
if(signal.data["n2o_scrub"] != null)
|
||||
scrub_N2O = text2num(signal.data["n2o_scrub"])
|
||||
if(signal.data["toggle_n2o_scrub"])
|
||||
scrub_N2O = !scrub_N2O
|
||||
if(signal.data["init"] != null)
|
||||
name = signal.data["init"]
|
||||
return
|
||||
|
||||
if(signal.data["init"] != null)
|
||||
name = signal.data["init"]
|
||||
return
|
||||
|
||||
if(signal.data["status"] != null)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
||||
if(signal.data["status"] != null)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
return //do not update_icon
|
||||
|
||||
power_change()
|
||||
if(powered(power_channel))
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
stat |= NOPOWER
|
||||
// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (node && node.level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/Del()
|
||||
if(initial_loc)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
obj/machinery/atmospherics/valve
|
||||
icon = 'icons/obj/atmospherics/valve.dmi'
|
||||
icon_state = "valve0"
|
||||
/obj/machinery/atmospherics/valve
|
||||
icon = 'icons/atmos/valve.dmi'
|
||||
icon_state = "map_valve0"
|
||||
|
||||
name = "manual valve"
|
||||
desc = "A pipe valve"
|
||||
|
||||
level = 1
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH
|
||||
|
||||
@@ -17,322 +18,297 @@ obj/machinery/atmospherics/valve
|
||||
var/datum/pipe_network/network_node1
|
||||
var/datum/pipe_network/network_node2
|
||||
|
||||
open
|
||||
open = 1
|
||||
icon_state = "valve1"
|
||||
/obj/machinery/atmospherics/valve/open
|
||||
open = 1
|
||||
icon_state = "map_valve1"
|
||||
|
||||
update_icon(animation)
|
||||
if(animation)
|
||||
flick("valve[src.open][!src.open]",src)
|
||||
else
|
||||
icon_state = "valve[open]"
|
||||
/obj/machinery/atmospherics/valve/update_icon(animation)
|
||||
if(animation)
|
||||
flick("valve[src.open][!src.open]",src)
|
||||
else
|
||||
icon_state = "valve[open]"
|
||||
|
||||
New()
|
||||
switch(dir)
|
||||
if(NORTH || SOUTH)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
if(EAST || WEST)
|
||||
initialize_directions = EAST|WEST
|
||||
..()
|
||||
/obj/machinery/atmospherics/valve/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node1, get_dir(src, node1))
|
||||
add_underlay(T, node2, get_dir(src, node2))
|
||||
|
||||
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
/obj/machinery/atmospherics/valve/hide(var/i)
|
||||
update_underlays()
|
||||
|
||||
/obj/machinery/atmospherics/valve/New()
|
||||
switch(dir)
|
||||
if(NORTH || SOUTH)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
if(EAST || WEST)
|
||||
initialize_directions = EAST|WEST
|
||||
..()
|
||||
|
||||
if(reference == node1)
|
||||
network_node1 = new_network
|
||||
if(open)
|
||||
network_node2 = new_network
|
||||
else if(reference == node2)
|
||||
network_node2 = new_network
|
||||
if(open)
|
||||
network_node1 = new_network
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
new_network.normal_members += src
|
||||
|
||||
/obj/machinery/atmospherics/valve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||
if(reference == node1)
|
||||
network_node1 = new_network
|
||||
if(open)
|
||||
if(reference == node1)
|
||||
if(node2)
|
||||
return node2.network_expand(new_network, src)
|
||||
else if(reference == node2)
|
||||
if(node1)
|
||||
return node1.network_expand(new_network, src)
|
||||
network_node2 = new_network
|
||||
else if(reference == node2)
|
||||
network_node2 = new_network
|
||||
if(open)
|
||||
network_node1 = new_network
|
||||
|
||||
return null
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
|
||||
Del()
|
||||
loc = null
|
||||
new_network.normal_members += src
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
del(network_node1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
del(network_node2)
|
||||
if(open)
|
||||
if(reference == node1)
|
||||
if(node2)
|
||||
return node2.network_expand(new_network, src)
|
||||
else if(reference == node2)
|
||||
if(node1)
|
||||
return node1.network_expand(new_network, src)
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/valve/Del()
|
||||
loc = null
|
||||
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
del(network_node1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
del(network_node2)
|
||||
|
||||
node1 = null
|
||||
node2 = null
|
||||
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/valve/proc/open()
|
||||
if(open) return 0
|
||||
|
||||
open = 1
|
||||
update_icon()
|
||||
|
||||
if(network_node1&&network_node2)
|
||||
network_node1.merge(network_node2)
|
||||
network_node2 = network_node1
|
||||
|
||||
if(network_node1)
|
||||
network_node1.update = 1
|
||||
else if(network_node2)
|
||||
network_node2.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/valve/proc/close()
|
||||
if(!open)
|
||||
return 0
|
||||
|
||||
open = 0
|
||||
update_icon()
|
||||
|
||||
if(network_node1)
|
||||
del(network_node1)
|
||||
if(network_node2)
|
||||
del(network_node2)
|
||||
|
||||
build_network()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/valve/proc/normalize_dir()
|
||||
if(dir==3)
|
||||
dir = 1
|
||||
else if(dir==12)
|
||||
dir = 4
|
||||
|
||||
/obj/machinery/atmospherics/valve/attack_ai(mob/user as mob)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/valve/attack_paw(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/valve/attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(usr)
|
||||
update_icon(1)
|
||||
sleep(10)
|
||||
if (src.open)
|
||||
src.close()
|
||||
else
|
||||
src.open()
|
||||
|
||||
/obj/machinery/atmospherics/valve/process()
|
||||
..()
|
||||
. = PROCESS_KILL
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/valve/initialize()
|
||||
normalize_dir()
|
||||
|
||||
var/node1_dir
|
||||
var/node2_dir
|
||||
|
||||
for(var/direction in cardinal)
|
||||
if(direction&initialize_directions)
|
||||
if (!node1_dir)
|
||||
node1_dir = direction
|
||||
else if (!node2_dir)
|
||||
node2_dir = direction
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node1 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node2 = target
|
||||
break
|
||||
|
||||
build_network()
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
if(openDuringInit)
|
||||
close()
|
||||
open()
|
||||
openDuringInit = 0
|
||||
|
||||
/obj/machinery/atmospherics/valve/build_network()
|
||||
if(!network_node1 && node1)
|
||||
network_node1 = new /datum/pipe_network()
|
||||
network_node1.normal_members += src
|
||||
network_node1.build_network(node1, src)
|
||||
|
||||
if(!network_node2 && node2)
|
||||
network_node2 = new /datum/pipe_network()
|
||||
network_node2.normal_members += src
|
||||
network_node2.build_network(node2, src)
|
||||
|
||||
/obj/machinery/atmospherics/valve/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network_node1
|
||||
|
||||
if(reference==node2)
|
||||
return network_node2
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/valve/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network_node1 == old_network)
|
||||
network_node1 = new_network
|
||||
if(network_node2 == old_network)
|
||||
network_node2 = new_network
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/valve/return_network_air(datum/network/reference)
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/valve/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
del(network_node1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
del(network_node2)
|
||||
node2 = null
|
||||
|
||||
..()
|
||||
update_underlays()
|
||||
|
||||
proc/open()
|
||||
return null
|
||||
|
||||
if(open) return 0
|
||||
/obj/machinery/atmospherics/valve/digital // can be controlled by AI
|
||||
name = "digital valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon = 'icons/atmos/digital_valve.dmi'
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
open = 1
|
||||
/obj/machinery/atmospherics/valve/digital/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/valve/digital/attack_hand(mob/user as mob)
|
||||
if(!powered())
|
||||
return
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/valve/digital/open
|
||||
open = 1
|
||||
icon_state = "map_valve1"
|
||||
|
||||
/obj/machinery/atmospherics/valve/digital/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
if(network_node1&&network_node2)
|
||||
network_node1.merge(network_node2)
|
||||
network_node2 = network_node1
|
||||
/obj/machinery/atmospherics/valve/digital/update_icon()
|
||||
..()
|
||||
if(!powered())
|
||||
icon_state = "valve[open]nopower"
|
||||
|
||||
if(network_node1)
|
||||
network_node1.update = 1
|
||||
else if(network_node2)
|
||||
network_node2.update = 1
|
||||
/obj/machinery/atmospherics/valve/digital/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
|
||||
return 1
|
||||
/obj/machinery/atmospherics/valve/digital/initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
proc/close()
|
||||
/obj/machinery/atmospherics/valve/digital/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
return 0
|
||||
|
||||
if(!open)
|
||||
return 0
|
||||
switch(signal.data["command"])
|
||||
if("valve_open")
|
||||
if(!open)
|
||||
open()
|
||||
|
||||
open = 0
|
||||
update_icon()
|
||||
if("valve_close")
|
||||
if(open)
|
||||
close()
|
||||
|
||||
if(network_node1)
|
||||
del(network_node1)
|
||||
if(network_node2)
|
||||
del(network_node2)
|
||||
|
||||
build_network()
|
||||
|
||||
return 1
|
||||
|
||||
proc/normalize_dir()
|
||||
if(dir==3)
|
||||
dir = 1
|
||||
else if(dir==12)
|
||||
dir = 4
|
||||
|
||||
attack_ai(mob/user as mob)
|
||||
return
|
||||
|
||||
attack_paw(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(usr)
|
||||
update_icon(1)
|
||||
sleep(10)
|
||||
if (src.open)
|
||||
src.close()
|
||||
else
|
||||
src.open()
|
||||
|
||||
process()
|
||||
..()
|
||||
. = PROCESS_KILL
|
||||
|
||||
/* if(open && (!node1 || !node2))
|
||||
close()
|
||||
if(!node1)
|
||||
if(!nodealert)
|
||||
//world << "Missing node from [src] at [src.x],[src.y],[src.z]"
|
||||
nodealert = 1
|
||||
else if (!node2)
|
||||
if(!nodealert)
|
||||
//world << "Missing node from [src] at [src.x],[src.y],[src.z]"
|
||||
nodealert = 1
|
||||
else if (nodealert)
|
||||
nodealert = 0
|
||||
*/
|
||||
|
||||
return
|
||||
|
||||
initialize()
|
||||
normalize_dir()
|
||||
|
||||
var/node1_dir
|
||||
var/node2_dir
|
||||
|
||||
for(var/direction in cardinal)
|
||||
if(direction&initialize_directions)
|
||||
if (!node1_dir)
|
||||
node1_dir = direction
|
||||
else if (!node2_dir)
|
||||
node2_dir = direction
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node1 = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node2 = target
|
||||
break
|
||||
|
||||
build_network()
|
||||
|
||||
if(openDuringInit)
|
||||
close()
|
||||
open()
|
||||
openDuringInit = 0
|
||||
|
||||
/*
|
||||
var/connect_directions
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
connect_directions = NORTH|SOUTH
|
||||
if(SOUTH)
|
||||
connect_directions = NORTH|SOUTH
|
||||
if(EAST)
|
||||
connect_directions = EAST|WEST
|
||||
if(WEST)
|
||||
connect_directions = EAST|WEST
|
||||
if("valve_toggle")
|
||||
if(open)
|
||||
close()
|
||||
else
|
||||
connect_directions = dir
|
||||
|
||||
for(var/direction in cardinal)
|
||||
if(direction&connect_directions)
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
connect_directions &= ~direction
|
||||
node1 = target
|
||||
break
|
||||
if(node1)
|
||||
break
|
||||
|
||||
for(var/direction in cardinal)
|
||||
if(direction&connect_directions)
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,direction))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node2 = target
|
||||
break
|
||||
if(node1)
|
||||
break
|
||||
*/
|
||||
build_network()
|
||||
if(!network_node1 && node1)
|
||||
network_node1 = new /datum/pipe_network()
|
||||
network_node1.normal_members += src
|
||||
network_node1.build_network(node1, src)
|
||||
|
||||
if(!network_node2 && node2)
|
||||
network_node2 = new /datum/pipe_network()
|
||||
network_node2.normal_members += src
|
||||
network_node2.build_network(node2, src)
|
||||
|
||||
|
||||
return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
if(reference==node1)
|
||||
return network_node1
|
||||
|
||||
if(reference==node2)
|
||||
return network_node2
|
||||
|
||||
return null
|
||||
|
||||
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network_node1 == old_network)
|
||||
network_node1 = new_network
|
||||
if(network_node2 == old_network)
|
||||
network_node2 = new_network
|
||||
open()
|
||||
|
||||
/obj/machinery/atmospherics/valve/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (istype(src, /obj/machinery/atmospherics/valve/digital))
|
||||
user << "\red You cannot unwrench this [src], it's too complicated."
|
||||
return 1
|
||||
|
||||
return_network_air(datum/network/reference)
|
||||
return null
|
||||
|
||||
disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node1)
|
||||
del(network_node1)
|
||||
node1 = null
|
||||
|
||||
else if(reference==node2)
|
||||
del(network_node2)
|
||||
node2 = null
|
||||
|
||||
return null
|
||||
|
||||
digital // can be controlled by AI
|
||||
name = "digital valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon = 'icons/obj/atmospherics/digital_valve.dmi'
|
||||
|
||||
attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(!src.allowed(user))
|
||||
user << "\red Access denied."
|
||||
return
|
||||
..()
|
||||
|
||||
//Radio remote control
|
||||
|
||||
proc
|
||||
set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
initialize()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
return 0
|
||||
|
||||
switch(signal.data["command"])
|
||||
if("valve_open")
|
||||
if(!open)
|
||||
open()
|
||||
|
||||
if("valve_close")
|
||||
if(open)
|
||||
close()
|
||||
|
||||
if("valve_toggle")
|
||||
if(open)
|
||||
close()
|
||||
else
|
||||
open()
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (istype(src, /obj/machinery/atmospherics/valve/digital))
|
||||
user << "\red You cannot unwrench this [src], it's too complicated."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
@@ -8,10 +8,10 @@ datum/pipe_network
|
||||
//membership roster to go through for updates and what not
|
||||
|
||||
var/update = 1
|
||||
var/datum/gas_mixture/air_transient = null
|
||||
//var/datum/gas_mixture/air_transient = null
|
||||
|
||||
New()
|
||||
air_transient = new()
|
||||
//air_transient = new()
|
||||
|
||||
..()
|
||||
|
||||
@@ -70,135 +70,4 @@ datum/pipe_network
|
||||
gases += line_member.air
|
||||
|
||||
proc/reconcile_air()
|
||||
//Perfectly equalize all gases members instantly
|
||||
|
||||
//Calculate totals from individual components
|
||||
var/total_thermal_energy = 0
|
||||
var/total_heat_capacity = 0
|
||||
|
||||
air_transient.volume = 0
|
||||
|
||||
air_transient.oxygen = 0
|
||||
air_transient.nitrogen = 0
|
||||
air_transient.phoron = 0
|
||||
air_transient.carbon_dioxide = 0
|
||||
|
||||
|
||||
air_transient.trace_gases = list()
|
||||
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
air_transient.volume += gas.volume
|
||||
var/temp_heatcap = gas.heat_capacity()
|
||||
total_thermal_energy += gas.temperature*temp_heatcap
|
||||
total_heat_capacity += temp_heatcap
|
||||
|
||||
air_transient.oxygen += gas.oxygen
|
||||
air_transient.nitrogen += gas.nitrogen
|
||||
air_transient.phoron += gas.phoron
|
||||
air_transient.carbon_dioxide += gas.carbon_dioxide
|
||||
|
||||
if(gas.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in gas.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in air_transient.trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
air_transient.trace_gases += corresponding
|
||||
|
||||
corresponding.moles += trace_gas.moles
|
||||
|
||||
if(air_transient.volume > 0)
|
||||
|
||||
if(total_heat_capacity > 0)
|
||||
air_transient.temperature = total_thermal_energy/total_heat_capacity
|
||||
|
||||
//Allow air mixture to react
|
||||
if(air_transient.react())
|
||||
update = 1
|
||||
|
||||
else
|
||||
air_transient.temperature = 0
|
||||
|
||||
//Update individual gas_mixtures by volume ratio
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
gas.oxygen = air_transient.oxygen*gas.volume/air_transient.volume
|
||||
gas.nitrogen = air_transient.nitrogen*gas.volume/air_transient.volume
|
||||
gas.phoron = air_transient.phoron*gas.volume/air_transient.volume
|
||||
gas.carbon_dioxide = air_transient.carbon_dioxide*gas.volume/air_transient.volume
|
||||
|
||||
gas.temperature = air_transient.temperature
|
||||
|
||||
if(air_transient.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in air_transient.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
gas.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles*gas.volume/air_transient.volume
|
||||
gas.update_values()
|
||||
air_transient.update_values()
|
||||
return 1
|
||||
|
||||
proc/equalize_gases(datum/gas_mixture/list/gases)
|
||||
//Perfectly equalize all gases members instantly
|
||||
|
||||
//Calculate totals from individual components
|
||||
var/total_volume = 0
|
||||
var/total_thermal_energy = 0
|
||||
var/total_heat_capacity = 0
|
||||
|
||||
var/total_oxygen = 0
|
||||
var/total_nitrogen = 0
|
||||
var/total_phoron = 0
|
||||
var/total_carbon_dioxide = 0
|
||||
|
||||
var/list/total_trace_gases = list()
|
||||
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
total_volume += gas.volume
|
||||
var/temp_heatcap = gas.heat_capacity()
|
||||
total_thermal_energy += gas.temperature*temp_heatcap
|
||||
total_heat_capacity += temp_heatcap
|
||||
|
||||
total_oxygen += gas.oxygen
|
||||
total_nitrogen += gas.nitrogen
|
||||
total_phoron += gas.phoron
|
||||
total_carbon_dioxide += gas.carbon_dioxide
|
||||
|
||||
if(gas.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in gas.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in total_trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
total_trace_gases += corresponding
|
||||
|
||||
corresponding.moles += trace_gas.moles
|
||||
|
||||
if(total_volume > 0)
|
||||
|
||||
//Calculate temperature
|
||||
var/temperature = 0
|
||||
|
||||
if(total_heat_capacity > 0)
|
||||
temperature = total_thermal_energy/total_heat_capacity
|
||||
|
||||
//Update individual gas_mixtures by volume ratio
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
gas.oxygen = total_oxygen*gas.volume/total_volume
|
||||
gas.nitrogen = total_nitrogen*gas.volume/total_volume
|
||||
gas.phoron = total_phoron*gas.volume/total_volume
|
||||
gas.carbon_dioxide = total_carbon_dioxide*gas.volume/total_volume
|
||||
|
||||
gas.temperature = temperature
|
||||
|
||||
if(total_trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in total_trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
gas.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles*gas.volume/total_volume
|
||||
gas.update_values()
|
||||
|
||||
return 1
|
||||
equalize_gases(gases)
|
||||
|
||||
@@ -37,22 +37,9 @@ datum/pipeline
|
||||
|
||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||
member.air_temporary = new
|
||||
member.air_temporary.copy_from(air)
|
||||
member.air_temporary.volume = member.volume
|
||||
|
||||
member.air_temporary.oxygen = air.oxygen*member.volume/air.volume
|
||||
member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume
|
||||
member.air_temporary.phoron = air.phoron*member.volume/air.volume
|
||||
member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume
|
||||
|
||||
member.air_temporary.temperature = air.temperature
|
||||
|
||||
if(air.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in air.trace_gases)
|
||||
var/datum/gas/corresponding = new trace_gas.type()
|
||||
member.air_temporary.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles*member.volume/air.volume
|
||||
member.air_temporary.update_values()
|
||||
member.air_temporary.multiply(member.volume / air.volume)
|
||||
|
||||
proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
|
||||
air = new
|
||||
@@ -213,7 +200,7 @@ datum/pipeline
|
||||
air.temperature -= heat/total_heat_capacity
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
|
||||
proc/radiate_heat(surface, thermal_conductivity)
|
||||
var/total_heat_capacity = air.heat_capacity()
|
||||
var/heat = STEFAN_BOLTZMANN_CONSTANT * surface * air.temperature ** 4 * thermal_conductivity
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
client/verb/discon_pipes()
|
||||
set name = "Show Disconnected Pipes"
|
||||
set category = "Debug"
|
||||
|
||||
for(var/obj/machinery/atmospherics/pipe/simple/P in world)
|
||||
if(!P.node1 || !P.node2)
|
||||
usr << "[P], [P.x], [P.y], [P.z], [P.loc.loc]"
|
||||
|
||||
for(var/obj/machinery/atmospherics/pipe/manifold/P in world)
|
||||
if(!P.node1 || !P.node2 || !P.node3)
|
||||
usr << "[P], [P.x], [P.y], [P.z], [P.loc.loc]"
|
||||
|
||||
for(var/obj/machinery/atmospherics/pipe/manifold4w/P in world)
|
||||
if(!P.node1 || !P.node2 || !P.node3 || !P.node4)
|
||||
usr << "[P], [P.x], [P.y], [P.z], [P.loc.loc]"
|
||||
//With thanks to mini. Check before use, uncheck after. Do Not Use on a live server.
|
||||
+447
-456
File diff suppressed because it is too large
Load Diff
@@ -140,20 +140,19 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
//the amount of phoron pulled in each update is relative to the field strength, with 50T (max field strength) = 100% of area covered by the field
|
||||
//at minimum strength, 0.25% of the field volume is pulled in per update (?)
|
||||
//have a max of 1000 moles suspended
|
||||
if(held_phoron.phoron < transfer_ratio * 1000)
|
||||
if(held_phoron.gas["phoron"] < transfer_ratio * 1000)
|
||||
var/moles_covered = environment.return_pressure()*volume_covered/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||
//world << "\blue moles_covered: [moles_covered]"
|
||||
//
|
||||
var/datum/gas_mixture/gas_covered = environment.remove(moles_covered)
|
||||
var/datum/gas_mixture/phoron_captured = new /datum/gas_mixture()
|
||||
//
|
||||
phoron_captured.phoron = round(gas_covered.phoron * transfer_ratio)
|
||||
phoron_captured.gas["phoron"] = round(gas_covered.gas["phoron"] * transfer_ratio)
|
||||
//world << "\blue[phoron_captured.phoron] moles of phoron captured"
|
||||
phoron_captured.temperature = gas_covered.temperature
|
||||
phoron_captured.update_values()
|
||||
//
|
||||
gas_covered.phoron -= phoron_captured.phoron
|
||||
gas_covered.update_values()
|
||||
gas_covered.adjust_gas("phoron", -phoron_captured.gas["phoron"])
|
||||
//
|
||||
held_phoron.merge(phoron_captured)
|
||||
//
|
||||
@@ -171,7 +170,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
|
||||
//change held phoron temp according to energy levels
|
||||
//SPECIFIC_HEAT_TOXIN
|
||||
if(mega_energy > 0 && held_phoron.phoron)
|
||||
if(mega_energy > 0 && held_phoron.gas["phoron"])
|
||||
var/heat_capacity = held_phoron.heat_capacity()//200 * number of phoron moles
|
||||
if(heat_capacity > 0.0003) //formerly MINIMUM_HEAT_CAPACITY
|
||||
held_phoron.temperature = (heat_capacity + mega_energy * 35000)/heat_capacity
|
||||
@@ -179,7 +178,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
//if there is too much phoron in the field, lose some
|
||||
/*if( held_phoron.phoron > (MOLES_CELLSTANDARD * 7) * (50 / field_strength) )
|
||||
LosePhoron()*/
|
||||
if(held_phoron.phoron > 1)
|
||||
if(held_phoron.gas["phoron"] > 1)
|
||||
//lose a random amount of phoron back into the air, increased by the field strength (want to switch this over to frequency eventually)
|
||||
var/loss_ratio = rand() * (0.05 + (0.05 * 50 / field_strength))
|
||||
//world << "lost [loss_ratio*100]% of held phoron"
|
||||
@@ -187,16 +186,16 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
var/datum/gas_mixture/phoron_lost = new
|
||||
phoron_lost.temperature = held_phoron.temperature
|
||||
//
|
||||
phoron_lost.phoron = held_phoron.phoron * loss_ratio
|
||||
phoron_lost.gas["phoron"] = held_phoron.gas["phoron"] * loss_ratio
|
||||
//phoron_lost.update_values()
|
||||
held_phoron.phoron -= held_phoron.phoron * loss_ratio
|
||||
held_phoron.gas["phoron"] -= held_phoron.gas["phoron"] * loss_ratio
|
||||
//held_phoron.update_values()
|
||||
//
|
||||
environment.merge(phoron_lost)
|
||||
radiation += loss_ratio * mega_energy * 0.1
|
||||
mega_energy -= loss_ratio * mega_energy * 0.1
|
||||
else
|
||||
held_phoron.phoron = 0
|
||||
held_phoron.gas["phoron"] = null
|
||||
//held_phoron.update_values()
|
||||
|
||||
//handle some reactants formatting
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/computer/engines/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/computer/engines/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(!linked)
|
||||
return
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
data["engines_info"] = enginfo
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "engines_control.tmpl", "[linked.name] Engines Control", 380, 530)
|
||||
ui.set_initial_data(data)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/computer/helm/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/computer/helm/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(!linked)
|
||||
return
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
|
||||
data["locations"] = locations
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "helm.tmpl", "[linked.name] Helm Control", 380, 530)
|
||||
ui.set_initial_data(data)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
|
||||
return shuttle && destination && get_dist(home, destination) <= shuttle.range
|
||||
|
||||
/obj/machinery/computer/shuttle_control/explore/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/computer/shuttle_control/explore/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
|
||||
if (!istype(shuttle))
|
||||
@@ -103,7 +103,7 @@
|
||||
"can_force" = can_go && shuttle.can_force(),
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "shuttle_control_console_exploration.tmpl", "[shuttle_tag] Shuttle Control", 470, 310)
|
||||
|
||||
@@ -83,9 +83,9 @@ proc/assign_sec_to_department(var/mob/living/carbon/human/H)
|
||||
else
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/handcuffs(H), slot_in_backpack)
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
|
||||
implant_loyalty(H)
|
||||
|
||||
return 1
|
||||
|
||||
/obj/item/device/radio/headset/headset_sec/department/New()
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/gun/energy/taser(H), slot_s_store)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/handcuffs(H), slot_in_backpack)
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
|
||||
H.implant_loyalty(src) // Will not do so if config is set to disallow.
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
H.equip_to_slot_or_del(new /obj/item/device/flash(H), slot_l_store)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/handcuffs(H), slot_in_backpack)
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
|
||||
H.implant_loyalty(src) // // Will not do so if config is set to disallow.
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -89,9 +89,7 @@
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/evidence(H), slot_in_backpack)
|
||||
H.equip_to_slot_or_del(new /obj/item/device/detective_scanner(H), slot_in_backpack)
|
||||
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
H.implant_loyalty(src) // Will not do so if config is set to disallow.
|
||||
return 1
|
||||
|
||||
|
||||
@@ -118,9 +116,9 @@
|
||||
H.equip_to_slot_or_del(new /obj/item/device/flash(H), slot_l_store)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/handcuffs(H), slot_in_backpack)
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
|
||||
H.implant_loyalty(src) // Will not do so if config is set to disallow.
|
||||
|
||||
return 1
|
||||
|
||||
/datum/job/hop
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
new /obj/item/weapon/storage/backpack/satchel_sec(src)
|
||||
new /obj/item/weapon/cartridge/hos(src)
|
||||
new /obj/item/device/radio/headset/heads/hos(src)
|
||||
new /obj/item/weapon/storage/lockbox/loyalty(src)
|
||||
if (config.use_loyalty_implants) new /obj/item/weapon/storage/lockbox/loyalty(src)
|
||||
new /obj/item/weapon/storage/flashbang_kit(src)
|
||||
new /obj/item/weapon/storage/belt/security(src)
|
||||
new /obj/item/device/flash(src)
|
||||
|
||||
@@ -231,9 +231,7 @@ var/global/admin_emergency_team = 0 // Used for admin-spawned response teams
|
||||
// equip_to_slot_or_del(new /obj/item/weapon/storage/firstaid/regular(src), slot_in_backpack) // Regular medkit
|
||||
|
||||
// Loyalty implants
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(src)
|
||||
L.imp_in = src
|
||||
L.implanted = 1
|
||||
implant_loyalty(src)
|
||||
|
||||
// ID cards
|
||||
var/obj/item/weapon/card/id/E = new(src)
|
||||
|
||||
+4
-193
@@ -86,7 +86,8 @@ Class Procs:
|
||||
/connection_edge/proc/tick()
|
||||
|
||||
/connection_edge/proc/flow(list/movable, differential, repelled)
|
||||
for(var/atom/movable/M in movable)
|
||||
for(var/i = 1; i <= movable.len; i++)
|
||||
var/atom/movable/M = movable[i]
|
||||
|
||||
//If they're already being tossed, don't do it again.
|
||||
if(M.last_airflow > world.time - vsc.airflow_delay) continue
|
||||
@@ -156,7 +157,7 @@ Class Procs:
|
||||
return
|
||||
|
||||
//air_master.equalize(A, B)
|
||||
ShareRatio(A.air,B.air,coefficient)
|
||||
A.air.share_ratio(B.air, coefficient)
|
||||
air_master.mark_zone_update(A)
|
||||
air_master.mark_zone_update(B)
|
||||
//world << "equalized."
|
||||
@@ -215,7 +216,7 @@ Class Procs:
|
||||
return
|
||||
//world << "[id]: Tick [air_master.current_cycle]: To [B]!"
|
||||
//A.air.mimic(B, coefficient)
|
||||
ShareSpace(A.air,air,dbg_out)
|
||||
A.air.share_space(air, dbg_out)
|
||||
air_master.mark_zone_update(A)
|
||||
|
||||
var/differential = A.air.return_pressure() - air.return_pressure()
|
||||
@@ -224,196 +225,6 @@ Class Procs:
|
||||
var/list/attracted = A.movables()
|
||||
flow(attracted, abs(differential), differential < 0)
|
||||
|
||||
var/list/sharing_lookup_table = list(0.30, 0.40, 0.48, 0.54, 0.60, 0.66)
|
||||
|
||||
proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles)
|
||||
//Shares a specific ratio of gas between mixtures using simple weighted averages.
|
||||
var
|
||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
||||
ratio = sharing_lookup_table[6]
|
||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
||||
|
||||
size = max(1,A.group_multiplier)
|
||||
share_size = max(1,B.group_multiplier)
|
||||
|
||||
full_oxy = A.oxygen * size
|
||||
full_nitro = A.nitrogen * size
|
||||
full_co2 = A.carbon_dioxide * size
|
||||
full_phoron = A.phoron * size
|
||||
|
||||
full_heat_capacity = A.heat_capacity() * size
|
||||
|
||||
s_full_oxy = B.oxygen * share_size
|
||||
s_full_nitro = B.nitrogen * share_size
|
||||
s_full_co2 = B.carbon_dioxide * share_size
|
||||
s_full_phoron = B.phoron * share_size
|
||||
|
||||
s_full_heat_capacity = B.heat_capacity() * share_size
|
||||
|
||||
oxy_avg = (full_oxy + s_full_oxy) / (size + share_size)
|
||||
nit_avg = (full_nitro + s_full_nitro) / (size + share_size)
|
||||
co2_avg = (full_co2 + s_full_co2) / (size + share_size)
|
||||
phoron_avg = (full_phoron + s_full_phoron) / (size + share_size)
|
||||
|
||||
temp_avg = (A.temperature * full_heat_capacity + B.temperature * s_full_heat_capacity) / (full_heat_capacity + s_full_heat_capacity)
|
||||
|
||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
||||
if(sharing_lookup_table.len >= connecting_tiles) //6 or more interconnecting tiles will max at 42% of air moved per tick.
|
||||
ratio = sharing_lookup_table[connecting_tiles]
|
||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
||||
|
||||
A.oxygen = max(0, (A.oxygen - oxy_avg) * (1-ratio) + oxy_avg )
|
||||
A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1-ratio) + nit_avg )
|
||||
A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg )
|
||||
A.phoron = max(0, (A.phoron - phoron_avg) * (1-ratio) + phoron_avg )
|
||||
|
||||
A.temperature = max(0, (A.temperature - temp_avg) * (1-ratio) + temp_avg )
|
||||
|
||||
B.oxygen = max(0, (B.oxygen - oxy_avg) * (1-ratio) + oxy_avg )
|
||||
B.nitrogen = max(0, (B.nitrogen - nit_avg) * (1-ratio) + nit_avg )
|
||||
B.carbon_dioxide = max(0, (B.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg )
|
||||
B.phoron = max(0, (B.phoron - phoron_avg) * (1-ratio) + phoron_avg )
|
||||
|
||||
B.temperature = max(0, (B.temperature - temp_avg) * (1-ratio) + temp_avg )
|
||||
|
||||
for(var/datum/gas/G in A.trace_gases)
|
||||
var/datum/gas/H = locate(G.type) in B.trace_gases
|
||||
if(H)
|
||||
var/G_avg = (G.moles*size + H.moles*share_size) / (size+share_size)
|
||||
G.moles = (G.moles - G_avg) * (1-ratio) + G_avg
|
||||
|
||||
H.moles = (H.moles - G_avg) * (1-ratio) + G_avg
|
||||
else
|
||||
H = new G.type
|
||||
B.trace_gases += H
|
||||
var/G_avg = (G.moles*size) / (size+share_size)
|
||||
G.moles = (G.moles - G_avg) * (1-ratio) + G_avg
|
||||
H.moles = (H.moles - G_avg) * (1-ratio) + G_avg
|
||||
|
||||
for(var/datum/gas/G in B.trace_gases)
|
||||
var/datum/gas/H = locate(G.type) in A.trace_gases
|
||||
if(!H)
|
||||
H = new G.type
|
||||
A.trace_gases += H
|
||||
var/G_avg = (G.moles*size) / (size+share_size)
|
||||
G.moles = (G.moles - G_avg) * (1-ratio) + G_avg
|
||||
H.moles = (H.moles - G_avg) * (1-ratio) + G_avg
|
||||
|
||||
A.update_values()
|
||||
B.update_values()
|
||||
|
||||
if(A.compare(B)) return 1
|
||||
else return 0
|
||||
|
||||
proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output)
|
||||
//A modified version of ShareRatio for spacing gas at the same rate as if it were going into a large airless room.
|
||||
if(!unsimulated_tiles)
|
||||
return 0
|
||||
|
||||
var
|
||||
unsim_oxygen = 0
|
||||
unsim_nitrogen = 0
|
||||
unsim_co2 = 0
|
||||
unsim_phoron = 0
|
||||
unsim_heat_capacity = 0
|
||||
unsim_temperature = 0
|
||||
|
||||
size = max(1,A.group_multiplier)
|
||||
|
||||
var/tileslen
|
||||
var/share_size
|
||||
|
||||
if(istype(unsimulated_tiles, /datum/gas_mixture))
|
||||
var/datum/gas_mixture/avg_unsim = unsimulated_tiles
|
||||
unsim_oxygen = avg_unsim.oxygen
|
||||
unsim_co2 = avg_unsim.carbon_dioxide
|
||||
unsim_nitrogen = avg_unsim.nitrogen
|
||||
unsim_phoron = avg_unsim.phoron
|
||||
unsim_temperature = avg_unsim.temperature
|
||||
share_size = max(1, max(size + 3, 1) + avg_unsim.group_multiplier)
|
||||
tileslen = avg_unsim.group_multiplier
|
||||
|
||||
if(dbg_output)
|
||||
world << "O2: [unsim_oxygen] N2: [unsim_nitrogen] Size: [share_size] Tiles: [tileslen]"
|
||||
|
||||
else if(istype(unsimulated_tiles, /list))
|
||||
if(!unsimulated_tiles.len)
|
||||
return 0
|
||||
// We use the same size for the potentially single space tile
|
||||
// as we use for the entire room. Why is this?
|
||||
// Short answer: We do not want larger rooms to depressurize more
|
||||
// slowly than small rooms, preserving our good old "hollywood-style"
|
||||
// oh-shit effect when large rooms get breached, but still having small
|
||||
// rooms remain pressurized for long enough to make escape possible.
|
||||
share_size = max(1, max(size + 3, 1) + unsimulated_tiles.len)
|
||||
var/correction_ratio = share_size / unsimulated_tiles.len
|
||||
|
||||
for(var/turf/T in unsimulated_tiles)
|
||||
unsim_oxygen += T.oxygen
|
||||
unsim_co2 += T.carbon_dioxide
|
||||
unsim_nitrogen += T.nitrogen
|
||||
unsim_phoron += T.phoron
|
||||
unsim_temperature += T.temperature/unsimulated_tiles.len
|
||||
|
||||
//These values require adjustment in order to properly represent a room of the specified size.
|
||||
unsim_oxygen *= correction_ratio
|
||||
unsim_co2 *= correction_ratio
|
||||
unsim_nitrogen *= correction_ratio
|
||||
unsim_phoron *= correction_ratio
|
||||
tileslen = unsimulated_tiles.len
|
||||
|
||||
else //invalid input type
|
||||
return 0
|
||||
|
||||
unsim_heat_capacity = HEAT_CAPACITY_CALCULATION(unsim_oxygen, unsim_co2, unsim_nitrogen, unsim_phoron)
|
||||
|
||||
var
|
||||
ratio = sharing_lookup_table[6]
|
||||
|
||||
old_pressure = A.return_pressure()
|
||||
|
||||
full_oxy = A.oxygen * size
|
||||
full_nitro = A.nitrogen * size
|
||||
full_co2 = A.carbon_dioxide * size
|
||||
full_phoron = A.phoron * size
|
||||
|
||||
full_heat_capacity = A.heat_capacity() * size
|
||||
|
||||
oxy_avg = (full_oxy + unsim_oxygen*share_size) / (size + share_size)
|
||||
nit_avg = (full_nitro + unsim_nitrogen*share_size) / (size + share_size)
|
||||
co2_avg = (full_co2 + unsim_co2*share_size) / (size + share_size)
|
||||
phoron_avg = (full_phoron + unsim_phoron*share_size) / (size + share_size)
|
||||
|
||||
temp_avg = 0
|
||||
|
||||
if((full_heat_capacity + unsim_heat_capacity) > 0)
|
||||
temp_avg = (A.temperature * full_heat_capacity + unsim_temperature * unsim_heat_capacity) / (full_heat_capacity + unsim_heat_capacity)
|
||||
|
||||
if(sharing_lookup_table.len >= tileslen) //6 or more interconnecting tiles will max at 42% of air moved per tick.
|
||||
ratio = sharing_lookup_table[tileslen]
|
||||
|
||||
if(dbg_output)
|
||||
world << "Ratio: [ratio]"
|
||||
world << "Avg O2: [oxy_avg] N2: [nit_avg]"
|
||||
|
||||
A.oxygen = max(0, (A.oxygen - oxy_avg) * (1 - ratio) + oxy_avg )
|
||||
A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1 - ratio) + nit_avg )
|
||||
A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1 - ratio) + co2_avg )
|
||||
A.phoron = max(0, (A.phoron - phoron_avg) * (1 - ratio) + phoron_avg )
|
||||
|
||||
A.temperature = max(TCMB, (A.temperature - temp_avg) * (1 - ratio) + temp_avg )
|
||||
|
||||
for(var/datum/gas/G in A.trace_gases)
|
||||
var/G_avg = (G.moles * size) / (size + share_size)
|
||||
G.moles = (G.moles - G_avg) * (1 - ratio) + G_avg
|
||||
|
||||
A.update_values()
|
||||
|
||||
if(dbg_output) world << "Result: [abs(old_pressure - A.return_pressure())] kPa"
|
||||
|
||||
return abs(old_pressure - A.return_pressure())
|
||||
|
||||
|
||||
proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles)
|
||||
//This implements a simplistic version of the Stefan-Boltzmann law.
|
||||
var/energy_delta = ((A.temperature - B.temperature) ** 4) * 5.6704e-8 * connecting_tiles * 2.5
|
||||
|
||||
+10
-2
@@ -73,6 +73,7 @@ Class Procs:
|
||||
//Geometry updates lists
|
||||
/datum/controller/air_system/var/list/tiles_to_update = list()
|
||||
/datum/controller/air_system/var/list/zones_to_update = list()
|
||||
/datum/controller/air_system/var/list/active_fire_zones = list()
|
||||
/datum/controller/air_system/var/list/active_hotspots = list()
|
||||
|
||||
/datum/controller/air_system/var/active_zones = 0
|
||||
@@ -171,9 +172,16 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
|
||||
for(var/connection_edge/edge in edges)
|
||||
edge.tick()
|
||||
|
||||
//Process fires.
|
||||
//Process fire zones.
|
||||
if(.)
|
||||
tick_progress = "processing fire"
|
||||
tick_progress = "processing fire zones"
|
||||
|
||||
for(var/zone/Z in active_fire_zones)
|
||||
Z.process_fire()
|
||||
|
||||
//Process hotspots.
|
||||
if(.)
|
||||
tick_progress = "processing hotspots"
|
||||
|
||||
for(var/obj/fire/fire in active_hotspots)
|
||||
fire.process()
|
||||
|
||||
@@ -19,7 +19,8 @@ client/proc/Zone_Info(turf/T as null|turf)
|
||||
mob << "No zone here."
|
||||
var/datum/gas_mixture/mix = T.return_air()
|
||||
mob << "[mix.return_pressure()] kPa [mix.temperature]C"
|
||||
mob << "O2: [mix.oxygen] N2: [mix.nitrogen] CO2: [mix.carbon_dioxide] TX: [mix.phoron]"
|
||||
for(var/g in mix.gas)
|
||||
mob << "[g]: [mix.gas[g]]\n"
|
||||
else
|
||||
if(zone_debug_images)
|
||||
for(var/zone in zone_debug_images)
|
||||
|
||||
+131
-131
@@ -10,6 +10,7 @@ Attach to transfer valve and open. BOOM.
|
||||
|
||||
*/
|
||||
|
||||
/turf/var/obj/fire/fire = null
|
||||
|
||||
//Some legacy definitions so fires can be started.
|
||||
atom/proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
@@ -34,12 +35,54 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
if(air_contents.check_combustability(liquid))
|
||||
igniting = 1
|
||||
|
||||
if(! (locate(/obj/fire) in src))
|
||||
|
||||
new /obj/fire(src,1000)
|
||||
|
||||
create_fire(1000)
|
||||
return igniting
|
||||
|
||||
/zone/proc/process_fire()
|
||||
if(!air.check_combustability())
|
||||
for(var/turf/simulated/T in fire_tiles)
|
||||
if(istype(T.fire))
|
||||
T.fire.RemoveFire()
|
||||
T.fire = null
|
||||
fire_tiles.Cut()
|
||||
|
||||
if(!fire_tiles.len)
|
||||
air_master.active_fire_zones.Remove(src)
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/burn_gas = air.remove_ratio(vsc.fire_consuption_rate, fire_tiles.len)
|
||||
var/gm = burn_gas.group_multiplier
|
||||
|
||||
burn_gas.group_multiplier = 1
|
||||
burn_gas.zburn(force_burn = 1, no_check = 1)
|
||||
burn_gas.group_multiplier = gm
|
||||
|
||||
air.merge(burn_gas)
|
||||
|
||||
var/firelevel = air.calculate_firelevel()
|
||||
|
||||
for(var/turf/T in fire_tiles)
|
||||
if(T.fire)
|
||||
T.fire.firelevel = firelevel
|
||||
else
|
||||
fire_tiles -= T
|
||||
|
||||
/turf/proc/create_fire(fl)
|
||||
return 0
|
||||
|
||||
/turf/simulated/create_fire(fl)
|
||||
if(fire)
|
||||
fire.firelevel = max(fl, fire.firelevel)
|
||||
return 1
|
||||
|
||||
if(!zone)
|
||||
return 1
|
||||
|
||||
fire = new(src, fl)
|
||||
zone.fire_tiles |= src
|
||||
air_master.active_fire_zones |= zone
|
||||
return 0
|
||||
|
||||
/obj/fire
|
||||
//Icon for fire on turfs.
|
||||
|
||||
@@ -58,41 +101,14 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
/obj/fire/process()
|
||||
. = 1
|
||||
|
||||
//get location and check if it is in a proper ZAS zone
|
||||
var/turf/simulated/S = loc
|
||||
|
||||
if(!istype(S))
|
||||
del src
|
||||
return
|
||||
|
||||
if(!S.zone)
|
||||
del src
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/air_contents = S.return_air()
|
||||
//get liquid fuels on the ground.
|
||||
var/obj/effect/decal/cleanable/liquid_fuel/liquid = locate() in S
|
||||
//and the volatile stuff from the air
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in air_contents.trace_gases
|
||||
|
||||
//since the air is processed in fractions, we need to make sure not to have any minuscle residue or
|
||||
//the amount of moles might get to low for some functions to catch them and thus result in wonky behaviour
|
||||
if(air_contents.oxygen < 0.1)
|
||||
air_contents.oxygen = 0
|
||||
if(air_contents.phoron < 0.1)
|
||||
air_contents.phoron = 0
|
||||
if(fuel)
|
||||
if(fuel.moles < 0.1)
|
||||
air_contents.trace_gases.Remove(fuel)
|
||||
|
||||
//check if there is something to combust
|
||||
if(!air_contents.check_combustability(liquid))
|
||||
//del src
|
||||
var/turf/simulated/my_tile = loc
|
||||
if(!istype(my_tile) || !my_tile.zone)
|
||||
if(my_tile.fire == src)
|
||||
my_tile.fire = null
|
||||
RemoveFire()
|
||||
return
|
||||
return 1
|
||||
|
||||
//get a firelevel and set the icon
|
||||
firelevel = air_contents.calculate_firelevel(liquid)
|
||||
var/datum/gas_mixture/air_contents = my_tile.return_air()
|
||||
|
||||
if(firelevel > 6)
|
||||
icon_state = "3"
|
||||
@@ -106,21 +122,26 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
|
||||
//im not sure how to implement a version that works for every creature so for now monkeys are firesafe
|
||||
for(var/mob/living/carbon/human/M in loc)
|
||||
M.FireBurn(firelevel, air_contents.temperature, air_contents.return_pressure() ) //Burn the humans!
|
||||
M.FireBurn(firelevel, air_contents.temperature, air_contents.return_pressure()) //Burn the humans!
|
||||
|
||||
loc.fire_act(air_contents, air_contents.temperature, air_contents.return_volume())
|
||||
loc.fire_act(air_contents, air_contents.temperature, air_contents.volume)
|
||||
for(var/atom/A in loc)
|
||||
A.fire_act(air_contents, air_contents.temperature, air_contents.return_volume())
|
||||
A.fire_act(air_contents, air_contents.temperature, air_contents.volume)
|
||||
|
||||
//spread
|
||||
for(var/direction in cardinal)
|
||||
var/turf/simulated/enemy_tile = get_step(S, direction)
|
||||
var/turf/simulated/enemy_tile = get_step(my_tile, direction)
|
||||
|
||||
if(istype(enemy_tile))
|
||||
if(S.open_directions & direction) //Grab all valid bordering tiles
|
||||
var/datum/gas_mixture/acs = enemy_tile.return_air()
|
||||
var/obj/effect/decal/cleanable/liquid_fuel/liq = locate() in enemy_tile
|
||||
if(!acs) continue
|
||||
if(!acs.check_combustability(liq)) continue
|
||||
if(my_tile.open_directions & direction) //Grab all valid bordering tiles
|
||||
if(!enemy_tile.zone || enemy_tile.fire)
|
||||
continue
|
||||
|
||||
if(!enemy_tile.zone.fire_tiles.len)
|
||||
var/datum/gas_mixture/acs = enemy_tile.return_air()
|
||||
if(!acs || !acs.check_combustability())
|
||||
continue
|
||||
|
||||
//If extinguisher mist passed over the turf it's trying to spread to, don't spread and
|
||||
//reduce firelevel.
|
||||
if(enemy_tile.fire_protection > world.time-30)
|
||||
@@ -128,26 +149,11 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
continue
|
||||
|
||||
//Spread the fire.
|
||||
if(!(locate(/obj/fire) in enemy_tile))
|
||||
if( prob( 50 + 50 * (firelevel/vsc.fire_firelevel_multiplier) ) && S.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, S, 0,0))
|
||||
new/obj/fire(enemy_tile,firelevel)
|
||||
if(prob( 50 + 50 * (firelevel/vsc.fire_firelevel_multiplier) ) && my_tile.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, my_tile, 0,0))
|
||||
enemy_tile.create_fire(firelevel)
|
||||
|
||||
else
|
||||
enemy_tile.adjacent_fire_act(loc, air_contents, air_contents.temperature, air_contents.return_volume())
|
||||
|
||||
//seperate part of the present gas
|
||||
//this is done to prevent the fire burning all gases in a single pass
|
||||
var/datum/gas_mixture/flow = air_contents.remove_ratio(vsc.fire_consuption_rate)
|
||||
///////////////////////////////// FLOW HAS BEEN CREATED /// DONT DELETE THE FIRE UNTIL IT IS MERGED BACK OR YOU WILL DELETE AIR ///////////////////////////////////////////////
|
||||
|
||||
if(flow)
|
||||
//burn baby burn!
|
||||
flow.zburn(liquid,1)
|
||||
//merge the air back
|
||||
S.assume_air(flow)
|
||||
|
||||
///////////////////////////////// FLOW HAS BEEN REMERGED /// feel free to delete the fire again from here on //////////////////////////////////////////////////////////////////
|
||||
|
||||
enemy_tile.adjacent_fire_act(loc, air_contents, air_contents.temperature, air_contents.volume)
|
||||
|
||||
/obj/fire/New(newLoc,fl)
|
||||
..()
|
||||
@@ -171,31 +177,29 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh)
|
||||
..()
|
||||
|
||||
/obj/fire/proc/RemoveFire()
|
||||
if (istype(loc, /turf/simulated))
|
||||
if (istype(loc, /turf))
|
||||
SetLuminosity(0)
|
||||
loc = null
|
||||
air_master.active_hotspots.Remove(src)
|
||||
|
||||
|
||||
|
||||
turf/simulated/var/fire_protection = 0 //Protects newly extinguished tiles from being overrun again.
|
||||
turf/proc/apply_fire_protection()
|
||||
turf/simulated/apply_fire_protection()
|
||||
fire_protection = world.time
|
||||
|
||||
|
||||
datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid, force_burn)
|
||||
var/value = 0
|
||||
|
||||
if((temperature > PHORON_MINIMUM_BURN_TEMPERATURE || force_burn) && check_recombustability(liquid))
|
||||
datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid, force_burn, no_check = 0)
|
||||
. = 0
|
||||
if((temperature > PHORON_MINIMUM_BURN_TEMPERATURE || force_burn) && (no_check ||check_recombustability(liquid)))
|
||||
var/total_fuel = 0
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
var/total_oxidizers = 0
|
||||
|
||||
total_fuel += phoron
|
||||
|
||||
if(fuel)
|
||||
//Volatile Fuel
|
||||
total_fuel += fuel.moles
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & XGM_GAS_FUEL)
|
||||
total_fuel += gas[g]
|
||||
if(gas_data.flags[g] & XGM_GAS_OXIDIZER)
|
||||
total_oxidizers += gas[g]
|
||||
|
||||
if(liquid)
|
||||
//Liquid Fuel
|
||||
@@ -208,36 +212,29 @@ datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid, forc
|
||||
return 0
|
||||
|
||||
//Calculate the firelevel.
|
||||
var/firelevel = calculate_firelevel(liquid)
|
||||
var/firelevel = calculate_firelevel(liquid, total_fuel, total_oxidizers, force = 1)
|
||||
|
||||
//get the current inner energy of the gas mix
|
||||
//this must be taken here to prevent the addition or deletion of energy by a changing heat capacity
|
||||
var/starting_energy = temperature * heat_capacity()
|
||||
|
||||
//determine the amount of oxygen used
|
||||
var/total_oxygen = min(oxygen, 2 * total_fuel)
|
||||
var/used_oxidizers = min(total_oxidizers, 2 * total_fuel)
|
||||
|
||||
//determine the amount of fuel actually used
|
||||
var/used_fuel_ratio = min(oxygen / 2 , total_fuel) / total_fuel
|
||||
var/used_fuel_ratio = min(total_oxidizers / 2 , total_fuel) / total_fuel
|
||||
total_fuel = total_fuel * used_fuel_ratio
|
||||
|
||||
var/total_reactants = total_fuel + total_oxygen
|
||||
var/total_reactants = total_fuel + used_oxidizers
|
||||
|
||||
//determine the amount of reactants actually reacting
|
||||
var/used_reactants_ratio = min( max(total_reactants * firelevel / vsc.fire_firelevel_multiplier, 0.2), total_reactants) / total_reactants
|
||||
var/used_reactants_ratio = min(max(total_reactants * firelevel / vsc.fire_firelevel_multiplier, 0.2), total_reactants) / total_reactants
|
||||
|
||||
//remove and add gasses as calculated
|
||||
oxygen -= min(oxygen, total_oxygen * used_reactants_ratio )
|
||||
remove_by_flag(XGM_GAS_OXIDIZER, used_oxidizers * used_reactants_ratio)
|
||||
remove_by_flag(XGM_GAS_FUEL, total_fuel * used_reactants_ratio * 3)
|
||||
|
||||
phoron -= min(phoron, (phoron * used_fuel_ratio * used_reactants_ratio ) * 3)
|
||||
if(phoron < 0)
|
||||
phoron = 0
|
||||
|
||||
carbon_dioxide += max(2 * total_fuel, 0)
|
||||
|
||||
if(fuel)
|
||||
fuel.moles -= (fuel.moles * used_fuel_ratio * used_reactants_ratio) * 5 //Fuel burns 5 times as quick
|
||||
if(fuel.moles <= 0) del fuel
|
||||
adjust_gas("carbon_dioxide", max(2 * total_fuel, 0))
|
||||
|
||||
if(liquid)
|
||||
liquid.amount -= (liquid.amount * used_fuel_ratio * used_reactants_ratio) * 5 // liquid fuel burns 5 times as quick
|
||||
@@ -248,64 +245,67 @@ datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid, forc
|
||||
temperature = (starting_energy + vsc.fire_fuel_energy_release * total_fuel) / heat_capacity()
|
||||
|
||||
update_values()
|
||||
value = total_reactants * used_reactants_ratio
|
||||
return value
|
||||
. = total_reactants * used_reactants_ratio
|
||||
|
||||
datum/gas_mixture/proc/check_recombustability(obj/effect/decal/cleanable/liquid_fuel/liquid)
|
||||
//this is a copy proc to continue a fire after its been started.
|
||||
. = 0
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & XGM_GAS_OXIDIZER && gas[g] >= 0.1)
|
||||
. = 1
|
||||
break
|
||||
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
if(!.)
|
||||
return 0
|
||||
|
||||
if(oxygen && (phoron || fuel || liquid))
|
||||
if(liquid)
|
||||
return 1
|
||||
if(phoron >= 0.1)
|
||||
return 1
|
||||
if(fuel && fuel.moles >= 0.1)
|
||||
return 1
|
||||
if(liquid)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
. = 0
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & XGM_GAS_FUEL && gas[g] >= 0.1)
|
||||
. = 1
|
||||
break
|
||||
|
||||
datum/gas_mixture/proc/check_combustability(obj/effect/decal/cleanable/liquid_fuel/liquid)
|
||||
//this check comes up very often and is thus centralized here to ease adding stuff
|
||||
. = 0
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & XGM_GAS_OXIDIZER && QUANTIZE(gas[g] * vsc.fire_consuption_rate) >= 0.1)
|
||||
. = 1
|
||||
break
|
||||
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
if(!.)
|
||||
return 0
|
||||
|
||||
if(oxygen && (phoron || fuel || liquid))
|
||||
if(liquid)
|
||||
return 1
|
||||
if(QUANTIZE(phoron * vsc.fire_consuption_rate) >= 0.1)
|
||||
return 1
|
||||
if(fuel && QUANTIZE(fuel.moles * vsc.fire_consuption_rate) >= 0.1)
|
||||
return 1
|
||||
if(liquid)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
. = 0
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & XGM_GAS_FUEL && QUANTIZE(gas[g] * vsc.fire_consuption_rate) >= 0.1)
|
||||
. = 1
|
||||
break
|
||||
|
||||
datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fuel/liquid)
|
||||
datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fuel/liquid, total_fuel = null, total_oxidizers = null, force = 0)
|
||||
//Calculates the firelevel based on one equation instead of having to do this multiple times in different areas.
|
||||
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
var/total_fuel = 0
|
||||
var/firelevel = 0
|
||||
|
||||
if(check_recombustability(liquid))
|
||||
if(force || check_recombustability(liquid))
|
||||
if(isnull(total_fuel))
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & XGM_GAS_FUEL)
|
||||
total_fuel += gas[g]
|
||||
if(gas_data.flags[g] & XGM_GAS_OXIDIZER)
|
||||
total_oxidizers += gas[g]
|
||||
if(liquid)
|
||||
total_fuel += liquid.amount
|
||||
|
||||
total_fuel += phoron
|
||||
|
||||
if(liquid)
|
||||
total_fuel += liquid.amount
|
||||
|
||||
if(fuel)
|
||||
total_fuel += fuel.moles
|
||||
|
||||
var/total_combustables = (total_fuel + oxygen)
|
||||
|
||||
if(total_fuel > 0 && oxygen > 0)
|
||||
var/total_combustables = (total_fuel + total_oxidizers)
|
||||
|
||||
if(total_combustables > 0)
|
||||
//slows down the burning when the concentration of the reactants is low
|
||||
var/dampening_multiplier = total_combustables / (total_combustables + nitrogen + carbon_dioxide)
|
||||
var/dampening_multiplier = total_combustables / total_moles
|
||||
//calculates how close the mixture of the reactants is to the optimum
|
||||
var/mix_multiplier = 1 / (1 + (5 * ((oxygen / total_combustables) ** 2)))
|
||||
var/mix_multiplier = 1 / (1 + (5 * ((total_oxidizers / total_combustables) ** 2)))
|
||||
//toss everything together
|
||||
firelevel = vsc.fire_firelevel_multiplier * mix_multiplier * dampening_multiplier
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/xgm_gas/oxygen
|
||||
id = "oxygen"
|
||||
name = "Oxygen"
|
||||
specific_heat = 20
|
||||
|
||||
flags = XGM_GAS_OXIDIZER
|
||||
|
||||
/xgm_gas/nitrogen
|
||||
id = "nitrogen"
|
||||
name = "Nitrogen"
|
||||
specific_heat = 20
|
||||
|
||||
/xgm_gas/carbon_dioxide
|
||||
id = "carbon_dioxide"
|
||||
name = "Carbon Dioxide"
|
||||
specific_heat = 30
|
||||
|
||||
/xgm_gas/phoron
|
||||
id = "phoron"
|
||||
name = "Phoron"
|
||||
specific_heat = 200
|
||||
|
||||
tile_overlay = "phoron"
|
||||
overlay_limit = 0.7
|
||||
flags = XGM_GAS_FUEL | XGM_GAS_CONTAMINANT
|
||||
|
||||
/xgm_gas/volatile_fuel
|
||||
id = "volatile_fuel"
|
||||
name = "Volatile Fuel"
|
||||
specific_heat = 30
|
||||
|
||||
flags = XGM_GAS_FUEL
|
||||
|
||||
/xgm_gas/sleeping_agent
|
||||
id = "sleeping_agent"
|
||||
name = "Sleeping Agent"
|
||||
specific_heat = 40
|
||||
|
||||
tile_overlay = "sleeping_agent"
|
||||
overlay_limit = 1
|
||||
|
||||
/xgm_gas/oxygen_agent_b
|
||||
id = "oxygen_agent_b"
|
||||
name = "Oxygen Agent-B"
|
||||
specific_heat = 300
|
||||
+6
-5
@@ -111,7 +111,7 @@ obj/var/contaminated = 0
|
||||
if(vsc.plc.GENETIC_CORRUPTION)
|
||||
if(rand(1,10000) < vsc.plc.GENETIC_CORRUPTION)
|
||||
randmutb(src)
|
||||
src << "\red High levels of phoron cause you to spontaneously mutate."
|
||||
src << "\red High levels of toxins cause you to spontaneously mutate."
|
||||
domutcheck(src,null)
|
||||
|
||||
|
||||
@@ -155,10 +155,11 @@ obj/var/contaminated = 0
|
||||
turf/Entered(obj/item/I)
|
||||
. = ..()
|
||||
//Items that are in phoron, but not on a mob, can still be contaminated.
|
||||
if(istype(I) && vsc.plc.CLOTH_CONTAMINATION)
|
||||
if(istype(I) && vsc.plc.CLOTH_CONTAMINATION && I.can_contaminate())
|
||||
var/datum/gas_mixture/env = return_air(1)
|
||||
if(!env)
|
||||
return
|
||||
if(env.phoron > MOLES_PHORON_VISIBLE + 1)
|
||||
if(I.can_contaminate())
|
||||
I.contaminate()
|
||||
for(var/g in env.gas)
|
||||
if(gas_data.flags[g] & XGM_GAS_CONTAMINANT && env.gas[g] > gas_data.overlay_limit[g] + 1)
|
||||
I.contaminate()
|
||||
break
|
||||
|
||||
+23
-17
@@ -6,12 +6,10 @@
|
||||
/turf/var/datum/gas_mixture/air
|
||||
|
||||
/turf/simulated/proc/set_graphic(new_graphic)
|
||||
if(isnum(new_graphic))
|
||||
if(new_graphic == 1) new_graphic = plmaster
|
||||
else if(new_graphic == 2) new_graphic = slmaster
|
||||
if(gas_graphic) overlays -= gas_graphic
|
||||
if(new_graphic) overlays += new_graphic
|
||||
gas_graphic = new_graphic
|
||||
overlays.Cut()
|
||||
for(var/i in gas_graphic)
|
||||
overlays += i
|
||||
|
||||
/turf/proc/update_air_properties()
|
||||
var/block = c_airblock(src)
|
||||
@@ -185,17 +183,15 @@
|
||||
/turf/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air
|
||||
return 0
|
||||
|
||||
/turf/proc/assume_gas(gasid, moles, temp = 0)
|
||||
return 0
|
||||
|
||||
/turf/return_air()
|
||||
//Create gas mixture to hold data for passing
|
||||
var/datum/gas_mixture/GM = new
|
||||
|
||||
GM.oxygen = oxygen
|
||||
GM.carbon_dioxide = carbon_dioxide
|
||||
GM.nitrogen = nitrogen
|
||||
GM.phoron = phoron
|
||||
|
||||
GM.adjust_multi("oxygen", oxygen, "carbon_dioxide", carbon_dioxide, "nitrogen", nitrogen, "phoron", phoron)
|
||||
GM.temperature = temperature
|
||||
GM.update_values()
|
||||
|
||||
return GM
|
||||
|
||||
@@ -204,10 +200,10 @@
|
||||
|
||||
var/sum = oxygen + carbon_dioxide + nitrogen + phoron
|
||||
if(sum>0)
|
||||
GM.oxygen = (oxygen/sum)*amount
|
||||
GM.carbon_dioxide = (carbon_dioxide/sum)*amount
|
||||
GM.nitrogen = (nitrogen/sum)*amount
|
||||
GM.phoron = (phoron/sum)*amount
|
||||
GM.gas["oxygen"] = (oxygen/sum)*amount
|
||||
GM.gas["carbon_dioxide"] = (carbon_dioxide/sum)*amount
|
||||
GM.gas["nitrogen"] = (nitrogen/sum)*amount
|
||||
GM.gas["phoron"] = (phoron/sum)*amount
|
||||
|
||||
GM.temperature = temperature
|
||||
GM.update_values()
|
||||
@@ -218,6 +214,16 @@
|
||||
var/datum/gas_mixture/my_air = return_air()
|
||||
my_air.merge(giver)
|
||||
|
||||
/turf/simulated/assume_gas(gasid, moles, temp = null)
|
||||
var/datum/gas_mixture/my_air = return_air()
|
||||
|
||||
if(isnull(temp))
|
||||
my_air.adjust_gas(gasid, moles)
|
||||
else
|
||||
my_air.adjust_gas_temp(gasid, moles, temp)
|
||||
|
||||
return 1
|
||||
|
||||
/turf/simulated/remove_air(amount as num)
|
||||
var/datum/gas_mixture/my_air = return_air()
|
||||
return my_air.remove(amount)
|
||||
@@ -240,11 +246,11 @@
|
||||
/turf/proc/make_air()
|
||||
air = new/datum/gas_mixture
|
||||
air.temperature = temperature
|
||||
air.adjust(oxygen, carbon_dioxide, nitrogen, phoron)
|
||||
air.adjust_multi("oxygen", oxygen, "carbon_dioxide", carbon_dioxide, "nitrogen", nitrogen, "phoron", phoron)
|
||||
air.group_multiplier = 1
|
||||
air.volume = CELL_VOLUME
|
||||
|
||||
/turf/simulated/proc/c_copy_air()
|
||||
if(!air) air = new/datum/gas_mixture
|
||||
air.copy_from(zone.air)
|
||||
air.group_multiplier = 1
|
||||
air.group_multiplier = 1
|
||||
|
||||
+8
-3
@@ -43,6 +43,7 @@ Class Procs:
|
||||
/zone/var/name
|
||||
/zone/var/invalid = 0
|
||||
/zone/var/list/contents = list()
|
||||
/zone/var/list/fire_tiles = list()
|
||||
|
||||
/zone/var/needs_update = 0
|
||||
|
||||
@@ -67,6 +68,9 @@ Class Procs:
|
||||
add_tile_air(turf_air)
|
||||
T.zone = src
|
||||
contents.Add(T)
|
||||
if(T.fire)
|
||||
fire_tiles.Add(T)
|
||||
air_master.active_fire_zones.Add(src)
|
||||
T.set_graphic(air.graphic)
|
||||
|
||||
/zone/proc/remove(turf/simulated/T)
|
||||
@@ -77,6 +81,7 @@ Class Procs:
|
||||
soft_assert(T in contents, "Lists are weird broseph")
|
||||
#endif
|
||||
contents.Remove(T)
|
||||
fire_tiles.Remove(T)
|
||||
T.zone = null
|
||||
T.set_graphic(0)
|
||||
if(contents.len)
|
||||
@@ -123,16 +128,16 @@ Class Procs:
|
||||
air.group_multiplier = contents.len+1
|
||||
|
||||
/zone/proc/tick()
|
||||
air.archive()
|
||||
if(air.check_tile_graphic())
|
||||
for(var/turf/simulated/T in contents)
|
||||
T.set_graphic(air.graphic)
|
||||
|
||||
/zone/proc/dbg_data(mob/M)
|
||||
M << name
|
||||
M << "O2: [air.oxygen] N2: [air.nitrogen] CO2: [air.carbon_dioxide] P: [air.phoron]"
|
||||
for(var/g in air.gas)
|
||||
M << "[gas_data.name[g]]: [air.gas[g]]"
|
||||
M << "P: [air.return_pressure()] kPa V: [air.volume]L T: [air.temperature]°K ([air.temperature - T0C]°C)"
|
||||
M << "O2 per N2: [(air.nitrogen ? air.oxygen/air.nitrogen : "N/A")] Moles: [air.total_moles]"
|
||||
M << "O2 per N2: [(air.gas["nitrogen"] ? air.gas["oxygen"]/air.gas["nitrogen"] : "N/A")] Moles: [air.total_moles]"
|
||||
M << "Simulated: [contents.len] ([air.group_multiplier])"
|
||||
//M << "Unsimulated: [unsimulated_contents.len]"
|
||||
//M << "Edges: [edges.len]"
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
#define QUANTIZE(variable) (round(variable,0.0001))
|
||||
|
||||
/datum/gas_mixture
|
||||
//Associative list of gas moles.
|
||||
//Gases with 0 moles are not tracked and are pruned by update_values()
|
||||
var/list/gas = list()
|
||||
//Temperature in Kelvin of this gas mix.
|
||||
var/temperature = 0
|
||||
|
||||
//Sum of all the gas moles in this mix. Updated by update_values()
|
||||
var/total_moles = 0
|
||||
//Volume of this mix.
|
||||
var/volume = CELL_VOLUME
|
||||
//Size of the group this gas_mixture is representing. 1 for singletons.
|
||||
var/group_multiplier = 1
|
||||
|
||||
//List of active tile overlays for this gas_mixture. Updated by check_tile_graphic()
|
||||
var/list/graphic = list()
|
||||
|
||||
//Takes a gas string, and the amount of moles to adjust by. Calls update_values() if update isn't 0.
|
||||
/datum/gas_mixture/proc/adjust_gas(gasid, moles, update = 1)
|
||||
if(moles == 0)
|
||||
return
|
||||
|
||||
gas[gasid] += moles
|
||||
|
||||
if(update)
|
||||
update_values()
|
||||
|
||||
//Same as adjust_gas(), but takes a temperature which is mixed in with the gas.
|
||||
/datum/gas_mixture/proc/adjust_gas_temp(gasid, moles, temp, update = 1)
|
||||
if(moles == 0)
|
||||
return
|
||||
|
||||
if(moles > 0 && abs(temperature - temp) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||
var/self_heat_capacity = heat_capacity()*group_multiplier
|
||||
var/giver_heat_capacity = gas_data.specific_heat[gasid] * moles
|
||||
var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity
|
||||
if(combined_heat_capacity != 0)
|
||||
temperature = (temp * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
|
||||
|
||||
gas[gasid] += moles
|
||||
|
||||
if(update)
|
||||
update_values()
|
||||
|
||||
//Variadic version of adjust_gas(). Takes any number of gas and mole pairs, and applies them.
|
||||
/datum/gas_mixture/proc/adjust_multi()
|
||||
ASSERT(!(args.len % 2))
|
||||
|
||||
for(var/i = 1; i < args.len; i += 2)
|
||||
adjust_gas(args[i], args[i+1], update = 0)
|
||||
|
||||
update_values()
|
||||
|
||||
//Variadic version of adjust_gas_temp(). Takes any number of gas, mole, and temperature tuples, and applies them.
|
||||
/datum/gas_mixture/proc/adjust_multi_temp()
|
||||
ASSERT(!(args.len % 3))
|
||||
|
||||
for(var/i = 1; i < args.len; i += 3)
|
||||
adjust_gas_temp(args[i], args[i + 1], args[i + 2], update = 0)
|
||||
|
||||
update_values()
|
||||
|
||||
//Merges all the gas from another mixture into this one. Respects group_multiplies and adjusts temperature correctly.
|
||||
/datum/gas_mixture/proc/merge(datum/gas_mixture/giver)
|
||||
if(!giver)
|
||||
return
|
||||
|
||||
if(abs(temperature-giver.temperature)>MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||
var/self_heat_capacity = heat_capacity()*group_multiplier
|
||||
var/giver_heat_capacity = giver.heat_capacity()*giver.group_multiplier
|
||||
var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity
|
||||
if(combined_heat_capacity != 0)
|
||||
temperature = (giver.temperature*giver_heat_capacity + temperature*self_heat_capacity)/combined_heat_capacity
|
||||
|
||||
if((group_multiplier != 1)||(giver.group_multiplier != 1))
|
||||
for(var/g in giver.gas)
|
||||
gas[g] += giver.gas[g] * giver.group_multiplier / group_multiplier
|
||||
else
|
||||
for(var/g in giver.gas)
|
||||
gas[g] += giver.gas[g]
|
||||
|
||||
update_values()
|
||||
|
||||
//Returns the heat capacity of the gas mix based on the specific heat of the gases.
|
||||
/datum/gas_mixture/proc/heat_capacity()
|
||||
. = 0
|
||||
for(var/g in gas)
|
||||
. += gas_data.specific_heat[g] * gas[g]
|
||||
|
||||
//Updates the total_moles count and trims any empty gases.
|
||||
/datum/gas_mixture/proc/update_values()
|
||||
total_moles = 0
|
||||
for(var/g in gas)
|
||||
if(gas[g] <= 0)
|
||||
gas -= g
|
||||
else
|
||||
total_moles += gas[g]
|
||||
|
||||
//Returns the pressure of the gas mix. Only accurate if there have been no gas modifications since update_values() has been called.
|
||||
/datum/gas_mixture/proc/return_pressure()
|
||||
if(volume)
|
||||
return total_moles * R_IDEAL_GAS_EQUATION * temperature / volume
|
||||
return 0
|
||||
|
||||
//Removes moles from the gas mixture and returns a gas_mixture containing the removed air.
|
||||
/datum/gas_mixture/proc/remove(amount)
|
||||
var/sum = total_moles
|
||||
amount = min(amount, sum) //Can not take more air than tile has!
|
||||
if(amount <= 0)
|
||||
return null
|
||||
|
||||
var/datum/gas_mixture/removed = new
|
||||
|
||||
for(var/g in gas)
|
||||
removed.gas[g] = QUANTIZE((gas[g] / sum) * amount)
|
||||
gas[g] -= removed.gas[g] / group_multiplier
|
||||
|
||||
removed.temperature = temperature
|
||||
update_values()
|
||||
removed.update_values()
|
||||
|
||||
return removed
|
||||
|
||||
//Removes a ratio of gas from the mixture and returns a gas_mixture containing the removed air.
|
||||
/datum/gas_mixture/proc/remove_ratio(ratio, out_group_multiplier = 1)
|
||||
if(ratio <= 0)
|
||||
return null
|
||||
out_group_multiplier = max(1, min(group_multiplier, out_group_multiplier))
|
||||
|
||||
ratio = min(ratio, 1)
|
||||
|
||||
var/datum/gas_mixture/removed = new
|
||||
removed.group_multiplier = out_group_multiplier
|
||||
|
||||
for(var/g in gas)
|
||||
removed.gas[g] = QUANTIZE(gas[g] * ratio)
|
||||
gas[g] = ((gas[g] * group_multiplier) - (removed.gas[g] * out_group_multiplier)) / group_multiplier
|
||||
|
||||
removed.temperature = temperature
|
||||
update_values()
|
||||
removed.update_values()
|
||||
|
||||
return removed
|
||||
|
||||
//Removes moles from the gas mixture, limited by a given flag. Returns a gax_mixture containing the removed air.
|
||||
/datum/gas_mixture/proc/remove_by_flag(flag, amount)
|
||||
if(!flag || amount <= 0)
|
||||
return
|
||||
|
||||
var/sum = 0
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & flag)
|
||||
sum += gas[g]
|
||||
|
||||
var/datum/gas_mixture/removed = new
|
||||
|
||||
for(var/g in gas)
|
||||
if(gas_data.flags[g] & flag)
|
||||
removed.gas[g] = QUANTIZE((gas[g] / sum) * amount)
|
||||
gas[g] -= removed.gas[g] / group_multiplier
|
||||
|
||||
removed.temperature = temperature
|
||||
update_values()
|
||||
removed.update_values()
|
||||
|
||||
return removed
|
||||
|
||||
//Copies gas and temperature from another gas_mixture.
|
||||
/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample)
|
||||
gas = sample.gas.Copy()
|
||||
temperature = sample.temperature
|
||||
|
||||
update_values()
|
||||
|
||||
return 1
|
||||
|
||||
//Checks if we are within acceptable range of another gas_mixture to suspend processing.
|
||||
/datum/gas_mixture/proc/compare(datum/gas_mixture/sample)
|
||||
if(!sample) return 0
|
||||
|
||||
var/list/marked = list()
|
||||
for(var/g in gas)
|
||||
if((abs(gas[g] - sample.gas[g]) > MINIMUM_AIR_TO_SUSPEND) && \
|
||||
((gas[g] < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.gas[g]) || \
|
||||
(gas[g] > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.gas[g])))
|
||||
return 0
|
||||
marked[g] = 1
|
||||
|
||||
for(var/g in sample.gas)
|
||||
if(!marked[g])
|
||||
if((abs(gas[g] - sample.gas[g]) > MINIMUM_AIR_TO_SUSPEND) && \
|
||||
((gas[g] < (1 - MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.gas[g]) || \
|
||||
(gas[g] > (1 + MINIMUM_AIR_RATIO_TO_SUSPEND) * sample.gas[g])))
|
||||
return 0
|
||||
|
||||
if(total_moles > MINIMUM_AIR_TO_SUSPEND)
|
||||
if((abs(temperature - sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \
|
||||
((temperature < (1 - MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || \
|
||||
(temperature > (1 + MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature)))
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
/datum/gas_mixture/proc/react(atom/dump_location)
|
||||
zburn(null)
|
||||
|
||||
//Rechecks the gas_mixture and adjusts the graphic list if needed.
|
||||
/datum/gas_mixture/proc/check_tile_graphic()
|
||||
//List of new overlays that weren't valid before.
|
||||
var/list/graphic_add = null
|
||||
//List of overlays that need to be removed now that they're not valid.
|
||||
var/list/graphic_remove = null
|
||||
|
||||
for(var/g in gas_data.overlay_limit)
|
||||
if(graphic.Find(gas_data.tile_overlay[g]))
|
||||
//Overlay is already applied for this gas, check if it's still valid.
|
||||
if(gas[g] <= gas_data.overlay_limit[g])
|
||||
if(!graphic_remove)
|
||||
graphic_remove = list()
|
||||
graphic_remove += gas_data.tile_overlay[g]
|
||||
else
|
||||
//Overlay isn't applied for this gas, check if it's valid and needs to be added.
|
||||
if(gas[g] > gas_data.overlay_limit[g])
|
||||
if(!graphic_add)
|
||||
graphic_add = list()
|
||||
graphic_add += gas_data.tile_overlay[g]
|
||||
|
||||
. = 0
|
||||
//Apply changes
|
||||
if(graphic_add && graphic_add.len)
|
||||
graphic += graphic_add
|
||||
. = 1
|
||||
if(graphic_remove && graphic_remove.len)
|
||||
graphic -= graphic_remove
|
||||
. = 1
|
||||
|
||||
//Simpler version of merge(), adjusts gas amounts directly and doesn't account for temperature or group_multiplier.
|
||||
/datum/gas_mixture/proc/add(datum/gas_mixture/right_side)
|
||||
for(var/g in right_side.gas)
|
||||
gas[g] += right_side.gas[g]
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
|
||||
//Simpler version of remove(), adjusts gas amounts directly and doesn't account for group_multiplier.
|
||||
/datum/gas_mixture/proc/subtract(datum/gas_mixture/right_side)
|
||||
for(var/g in right_side.gas)
|
||||
gas[g] -= right_side.gas[g]
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
|
||||
//Multiply all gas amounts by a factor.
|
||||
/datum/gas_mixture/proc/multiply(factor)
|
||||
for(var/g in gas)
|
||||
gas[g] *= factor
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
|
||||
//Divide all gas amounts by a factor.
|
||||
/datum/gas_mixture/proc/divide(factor)
|
||||
for(var/g in gas)
|
||||
gas[g] /= factor
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
|
||||
//Shares gas with another gas_mixture based on the amount of connecting tiles and a fixed lookup table.
|
||||
/datum/gas_mixture/proc/share_ratio(datum/gas_mixture/other, connecting_tiles, share_size = null)
|
||||
var/static/list/sharing_lookup_table = list(0.30, 0.40, 0.48, 0.54, 0.60, 0.66)
|
||||
//Shares a specific ratio of gas between mixtures using simple weighted averages.
|
||||
var/ratio = sharing_lookup_table[6]
|
||||
|
||||
var/size = max(1, group_multiplier)
|
||||
if(isnull(share_size)) share_size = max(1, other.group_multiplier)
|
||||
|
||||
var/list/full_gas = list()
|
||||
for(var/g in gas)
|
||||
full_gas[g] = gas[g] * size
|
||||
|
||||
var/full_heat_capacity = heat_capacity() * size
|
||||
|
||||
var/list/s_full_gas = list()
|
||||
for(var/g in other.gas)
|
||||
s_full_gas[g] = other.gas[g] * share_size
|
||||
|
||||
var/s_full_heat_capacity = other.heat_capacity() * share_size
|
||||
|
||||
var/list/avg_gas = list()
|
||||
|
||||
for(var/g in full_gas)
|
||||
avg_gas[g] = (full_gas[g] + s_full_gas[g]) / (size + share_size)
|
||||
|
||||
for(var/g in s_full_gas)
|
||||
if(avg_gas[g] == null)
|
||||
avg_gas[g] = (full_gas[g] + s_full_gas[g]) / (size + share_size)
|
||||
|
||||
var/temp_avg = 0
|
||||
if(full_heat_capacity + s_full_heat_capacity)
|
||||
temp_avg = (temperature * full_heat_capacity + other.temperature * s_full_heat_capacity) / (full_heat_capacity + s_full_heat_capacity)
|
||||
|
||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD.
|
||||
if(sharing_lookup_table.len >= connecting_tiles) //6 or more interconnecting tiles will max at 42% of air moved per tick.
|
||||
ratio = sharing_lookup_table[connecting_tiles]
|
||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
||||
|
||||
for(var/g in avg_gas)
|
||||
gas[g] = max(0, (gas[g] - avg_gas[g]) * (1 - ratio) + avg_gas[g])
|
||||
other.gas[g] = max(0, (other.gas[g] - avg_gas[g]) * (1 - ratio) + avg_gas[g])
|
||||
|
||||
temperature = max(0, (temperature - temp_avg) * (1-ratio) + temp_avg)
|
||||
other.temperature = max(0, (other.temperature - temp_avg) * (1-ratio) + temp_avg)
|
||||
|
||||
update_values()
|
||||
other.update_values()
|
||||
|
||||
if(compare(other)) return 1
|
||||
else return 0
|
||||
|
||||
//A wrapper around share_ratio for spacing gas at the same rate as if it were going into a large airless room.
|
||||
/datum/gas_mixture/proc/share_space(datum/gas_mixture/unsim_air)
|
||||
if(!unsim_air)
|
||||
return 0
|
||||
|
||||
var/old_pressure = return_pressure()
|
||||
|
||||
share_ratio(unsim_air, unsim_air.group_multiplier, max(1, max(group_multiplier + 3, 1) + unsim_air.group_multiplier))
|
||||
|
||||
return abs(old_pressure - return_pressure())
|
||||
|
||||
//Equalizes a list of gas mixtures. Used for pipe networks.
|
||||
/proc/equalize_gases(datum/gas_mixture/list/gases)
|
||||
//Calculate totals from individual components
|
||||
var/total_volume = 0
|
||||
var/total_thermal_energy = 0
|
||||
var/total_heat_capacity = 0
|
||||
|
||||
var/list/total_gas = list()
|
||||
for(var/datum/gas_mixture/gasmix in gases)
|
||||
total_volume += gasmix.volume
|
||||
var/temp_heatcap = gasmix.heat_capacity()
|
||||
total_thermal_energy += gasmix.temperature * temp_heatcap
|
||||
total_heat_capacity += temp_heatcap
|
||||
for(var/g in gasmix.gas)
|
||||
total_gas[g] += gasmix.gas[g]
|
||||
|
||||
if(total_volume > 0)
|
||||
//Average out the gases
|
||||
for(var/g in total_gas)
|
||||
total_gas[g] /= total_volume
|
||||
|
||||
//Calculate temperature
|
||||
var/temperature = 0
|
||||
|
||||
if(total_heat_capacity > 0)
|
||||
temperature = total_thermal_energy / total_heat_capacity
|
||||
|
||||
//Update individual gas_mixtures
|
||||
for(var/datum/gas_mixture/gasmix in gases)
|
||||
gasmix.gas = total_gas.Copy()
|
||||
gasmix.temperature = temperature
|
||||
gasmix.multiply(gasmix.volume)
|
||||
|
||||
return 1
|
||||
@@ -0,0 +1,42 @@
|
||||
/var/xgm_gas_data/gas_data
|
||||
|
||||
/xgm_gas_data
|
||||
//Simple list of all the gas IDs.
|
||||
var/list/gases = list()
|
||||
//The friendly, human-readable name for the gas.
|
||||
var/list/name = list()
|
||||
//Specific heat of the gas. Used for calculating heat capacity.
|
||||
var/list/specific_heat = list()
|
||||
//Tile overlays. /images, created from references to 'icons/effects/tile_effects.dmi'
|
||||
var/list/tile_overlay = list()
|
||||
//Overlay limits. There must be at least this many moles for the overlay to appear.
|
||||
var/list/overlay_limit = list()
|
||||
//Flags.
|
||||
var/list/flags = list()
|
||||
|
||||
/xgm_gas
|
||||
var/id = ""
|
||||
var/name = "Unnamed Gas"
|
||||
var/specific_heat = 20
|
||||
|
||||
var/tile_overlay = null
|
||||
var/overlay_limit = null
|
||||
|
||||
var/flags = 0
|
||||
|
||||
/hook/startup/proc/generateGasData()
|
||||
gas_data = new
|
||||
for(var/p in (typesof(/xgm_gas) - /xgm_gas))
|
||||
var/xgm_gas/gas = new p
|
||||
|
||||
if(gas.id in gas_data.gases)
|
||||
error("Duplicate gas id `[gas.id]` in `[p]`")
|
||||
|
||||
gas_data.gases += gas.id
|
||||
gas_data.name[gas.id] = gas.name
|
||||
gas_data.specific_heat[gas.id] = gas.specific_heat
|
||||
if(gas.tile_overlay) gas_data.tile_overlay[gas.id] = image('icons/effects/tile_effects.dmi', gas.tile_overlay, FLY_LAYER)
|
||||
if(gas.overlay_limit) gas_data.overlay_limit[gas.id] = gas.overlay_limit
|
||||
gas_data.flags[gas.id] = gas.flags
|
||||
|
||||
return 1
|
||||
+32
-6
@@ -81,12 +81,15 @@
|
||||
than anything else in the game, atoms have separate procs
|
||||
for AI shift, ctrl, and alt clicking.
|
||||
*/
|
||||
|
||||
/mob/living/silicon/ai/ShiftClickOn(var/atom/A)
|
||||
A.AIShiftClick(src)
|
||||
/mob/living/silicon/ai/CtrlClickOn(var/atom/A)
|
||||
A.AICtrlClick(src)
|
||||
/mob/living/silicon/ai/AltClickOn(var/atom/A)
|
||||
A.AIAltClick(src)
|
||||
/mob/living/silicon/ai/MiddleClickOn(var/atom/A)
|
||||
A.AIMiddleClick(src)
|
||||
|
||||
/*
|
||||
The following criminally helpful code is just the previous code cleaned up;
|
||||
@@ -103,7 +106,6 @@
|
||||
Topic("aiDisable=7", list("aiDisable"="7"), 1)
|
||||
return
|
||||
|
||||
|
||||
/atom/proc/AICtrlClick()
|
||||
return
|
||||
|
||||
@@ -113,18 +115,42 @@
|
||||
else
|
||||
Topic("aiDisable=4", list("aiDisable"="4"), 1)
|
||||
|
||||
/obj/machinery/power/apc/AICtrlClick() // turns off APCs.
|
||||
/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs.
|
||||
Topic("breaker=1", list("breaker"="1"), 0) // 0 meaning no window (consistency! wait...)
|
||||
|
||||
/obj/machinery/turretid/AICtrlClick() //turns off/on Turrets
|
||||
src.enabled = !src.enabled
|
||||
src.updateTurrets()
|
||||
|
||||
/atom/proc/AIAltClick()
|
||||
return
|
||||
|
||||
/obj/machinery/door/airlock/AIAltClick() // Eletrifies doors.
|
||||
/obj/machinery/door/airlock/AIAltClick() // Electrifies doors.
|
||||
if(!secondsElectrified)
|
||||
// permenant shock
|
||||
// permanent shock
|
||||
Topic("aiEnable=6", list("aiEnable"="6"), 1) // 1 meaning no window (consistency!)
|
||||
else
|
||||
// disable/6 is not in Topic; disable/5 disables both temporary and permenant shock
|
||||
// disable/6 is not in Topic; disable/5 disables both temporary and permanent shock
|
||||
Topic("aiDisable=5", list("aiDisable"="5"), 1)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets
|
||||
src.lethal = !src.lethal
|
||||
src.updateTurrets()
|
||||
|
||||
/atom/proc/AIMiddleClick()
|
||||
return
|
||||
|
||||
/obj/machinery/door/airlock/AIMiddleClick() // Toggles door bolt lights.
|
||||
if(!src.lights)
|
||||
Topic("aiEnable=10", list("aiEnable"="10"), 1) // 1 meaning no window (consistency!)
|
||||
else
|
||||
Topic("aiDisable=10", list("aiDisable"="10"), 1)
|
||||
return
|
||||
|
||||
//
|
||||
// Override AdjacentQuick for AltClicking
|
||||
//
|
||||
|
||||
/mob/living/silicon/ai/TurfAdjacent(var/turf/T)
|
||||
return (cameranet && cameranet.checkTurfVis(T))
|
||||
|
||||
@@ -249,14 +249,17 @@
|
||||
|
||||
/atom/proc/AltClick(var/mob/user)
|
||||
var/turf/T = get_turf(src)
|
||||
if(T && T.AdjacentQuick(user))
|
||||
if(user.listed_turf == T)
|
||||
if(T && user.TurfAdjacent(T))
|
||||
if(user. == T)
|
||||
user.listed_turf = null
|
||||
else
|
||||
user.listed_turf = T
|
||||
user.client.statpanel = T.name
|
||||
return
|
||||
|
||||
/mob/proc/TurfAdjacent(var/turf/T)
|
||||
return T.AdjacentQuick(src)
|
||||
|
||||
/*
|
||||
Misc helpers
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@
|
||||
var/list/nicename = null
|
||||
var/list/tankcheck = null
|
||||
var/breathes = "oxygen" //default, we'll check later
|
||||
var/list/contents = list()
|
||||
var/list/contents = list()
|
||||
|
||||
if(ishuman(C))
|
||||
var/mob/living/carbon/human/H = C
|
||||
@@ -284,7 +284,7 @@
|
||||
nicename = list ("suit", "back", "belt", "right hand", "left hand", "left pocket", "right pocket")
|
||||
tankcheck = list (H.s_store, C.back, H.belt, C.r_hand, C.l_hand, H.l_store, H.r_store)
|
||||
|
||||
else
|
||||
else
|
||||
|
||||
nicename = list("Right Hand", "Left Hand", "Back")
|
||||
tankcheck = list(C.r_hand, C.l_hand, C.back)
|
||||
@@ -295,30 +295,30 @@
|
||||
if (!isnull(t.manipulated_by) && t.manipulated_by != C.real_name && findtext(t.desc,breathes))
|
||||
contents.Add(t.air_contents.total_moles) //Someone messed with the tank and put unknown gasses
|
||||
continue //in it, so we're going to believe the tank is what it says it is
|
||||
switch(breathes)
|
||||
switch(breathes)
|
||||
//These tanks we're sure of their contents
|
||||
if("nitrogen") //So we're a bit more picky about them.
|
||||
|
||||
if(t.air_contents.nitrogen && !t.air_contents.oxygen)
|
||||
contents.Add(t.air_contents.nitrogen)
|
||||
|
||||
if(t.air_contents.gas["nitrogen"] && !t.air_contents.gas["oxygen"])
|
||||
contents.Add(t.air_contents.gas["nitrogen"])
|
||||
else
|
||||
contents.Add(0)
|
||||
contents.Add(0)
|
||||
|
||||
if ("oxygen")
|
||||
if(t.air_contents.oxygen && !t.air_contents.phoron)
|
||||
contents.Add(t.air_contents.oxygen)
|
||||
if(t.air_contents.gas["oxygen"] && !t.air_contents.gas["phoron"])
|
||||
contents.Add(t.air_contents.gas["oxygen"])
|
||||
else
|
||||
contents.Add(0)
|
||||
|
||||
// No races breath this, but never know about downstream servers.
|
||||
if ("carbon dioxide")
|
||||
if(t.air_contents.carbon_dioxide && !t.air_contents.phoron)
|
||||
contents.Add(t.air_contents.carbon_dioxide)
|
||||
if(t.air_contents.gas["carbon_dioxide"] && !t.air_contents.gas["phoron"])
|
||||
contents.Add(t.air_contents.gas["carbon_dioxide"])
|
||||
else
|
||||
contents.Add(0)
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
else
|
||||
//no tank so we set contents to 0
|
||||
contents.Add(0)
|
||||
|
||||
@@ -328,19 +328,19 @@
|
||||
var/bestcontents = 0
|
||||
for(var/i=1, i < contents.len + 1 , ++i)
|
||||
if(!contents[i])
|
||||
continue
|
||||
continue
|
||||
if(contents[i] > bestcontents)
|
||||
best = i
|
||||
bestcontents = contents[i]
|
||||
|
||||
|
||||
|
||||
|
||||
//We've determined the best container now we set it as our internals
|
||||
|
||||
if(best)
|
||||
C << "<span class='notice'>You are now running on internals from [tankcheck[best]] on your [nicename[best]].</span>"
|
||||
C.internal = tankcheck[best]
|
||||
|
||||
|
||||
|
||||
|
||||
if(C.internal)
|
||||
if(C.internals)
|
||||
C.internals.icon_state = "internal1"
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
slime.Discipline = 0
|
||||
|
||||
if(power >= 3)
|
||||
if(istype(slime, /mob/living/carbon/slime/adult))
|
||||
if(slime.is_adult)
|
||||
if(prob(5 + round(power/2)))
|
||||
|
||||
if(slime.Victim)
|
||||
|
||||
@@ -112,6 +112,8 @@
|
||||
var/revival_cloning = 1
|
||||
var/revival_brain_life = -1
|
||||
|
||||
var/use_loyalty_implants = 0
|
||||
|
||||
//Used for modifying movement speed for mobs.
|
||||
//Unversal modifiers
|
||||
var/run_speed = 0
|
||||
@@ -521,10 +523,21 @@
|
||||
config.revival_cloning = value
|
||||
if("revival_brain_life")
|
||||
config.revival_brain_life = value
|
||||
if("organ_health_multiplier")
|
||||
config.organ_health_multiplier = value / 100
|
||||
if("organ_regeneration_multiplier")
|
||||
config.organ_regeneration_multiplier = value / 100
|
||||
if("bones_can_break")
|
||||
config.bones_can_break = value
|
||||
if("limbs_can_break")
|
||||
config.limbs_can_break = value
|
||||
|
||||
|
||||
if("run_speed")
|
||||
config.run_speed = value
|
||||
if("walk_speed")
|
||||
config.walk_speed = value
|
||||
|
||||
if("human_delay")
|
||||
config.human_delay = value
|
||||
if("robot_delay")
|
||||
@@ -537,14 +550,11 @@
|
||||
config.slime_delay = value
|
||||
if("animal_delay")
|
||||
config.animal_delay = value
|
||||
if("organ_health_multiplier")
|
||||
config.organ_health_multiplier = value / 100
|
||||
if("organ_regeneration_multiplier")
|
||||
config.organ_regeneration_multiplier = value / 100
|
||||
if("bones_can_break")
|
||||
config.bones_can_break = value
|
||||
if("limbs_can_break")
|
||||
config.limbs_can_break = value
|
||||
|
||||
|
||||
if("use_loyalty_implants")
|
||||
config.use_loyalty_implants = 1
|
||||
|
||||
else
|
||||
log_misc("Unknown setting in configuration: '[name]'")
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ datum/controller/lighting
|
||||
var/list/changed_turfs = list()
|
||||
var/changed_turfs_workload_max = 0
|
||||
|
||||
var/list/changed_areas = list()
|
||||
|
||||
datum/controller/lighting/New()
|
||||
lighting_states = max( 0, length(icon_states(LIGHTING_ICON))-1 )
|
||||
if(lighting_controller != src)
|
||||
@@ -53,9 +55,18 @@ datum/controller/lighting/proc/process()
|
||||
for(var/i=1, i<=changed_turfs.len, i++)
|
||||
var/turf/T = changed_turfs[i]
|
||||
if(T && T.lighting_changed)
|
||||
changed_areas |= T.loc
|
||||
T.shift_to_subarea()
|
||||
changed_turfs.Cut() // reset the changed list
|
||||
|
||||
for(var/i = 1; i <= changed_areas.len, i++)
|
||||
var/area/A = changed_areas[i]
|
||||
if(A.master != A && !A.contents.len)
|
||||
A.related -= A
|
||||
active_areas -= A
|
||||
all_areas -= A
|
||||
changed_areas.Cut()
|
||||
|
||||
process_cost = (world.timeofday - started)
|
||||
|
||||
sleep(processing_interval)
|
||||
|
||||
@@ -292,7 +292,8 @@ datum/controller/game_controller/proc/process_machines_power()
|
||||
var/area/A = active_areas[i]
|
||||
if(A.powerupdate && A.master == A)
|
||||
A.powerupdate -= 1
|
||||
for(var/area/SubArea in A.related)
|
||||
for(var/j = 1; j <= A.related.len; j++)
|
||||
var/area/SubArea = A.related[j]
|
||||
for(var/obj/machinery/M in SubArea)
|
||||
if(M)
|
||||
if(M.use_power)
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
|
||||
return
|
||||
|
||||
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller"))
|
||||
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller", "Gas Data"))
|
||||
set category = "Debug"
|
||||
set name = "Debug Controller"
|
||||
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
|
||||
@@ -100,5 +100,8 @@
|
||||
if("Transfer Controller")
|
||||
debug_variables(transfer_controller)
|
||||
feedback_add_details("admin_verb","DAutovoter")
|
||||
if("Gas Data")
|
||||
debug_variables(gas_data)
|
||||
feedback_add_details("admin_verv","DGasdata")
|
||||
message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.")
|
||||
return
|
||||
|
||||
+4
-7
@@ -510,14 +510,9 @@ datum/mind
|
||||
I.Del()
|
||||
break
|
||||
H << "\blue <Font size =3><B>Your loyalty implant has been deactivated.</B></FONT>"
|
||||
if("add")
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
var/datum/organ/external/affected = H.organs_by_name["head"]
|
||||
affected.implants += L
|
||||
L.part = affected
|
||||
|
||||
if("add")
|
||||
H.implant_loyalty(H, override = TRUE)
|
||||
H << "\red <Font size =3><B>You somehow have become the recepient of a loyalty transplant, and it just activated!</B></FONT>"
|
||||
if(src in ticker.mode.revolutionaries)
|
||||
special_role = null
|
||||
@@ -541,6 +536,8 @@ datum/mind
|
||||
special_role = null
|
||||
current << "\red <FONT size = 3><B>The nanobots in the loyalty implant remove all thoughts about being a traitor to Nanotrasen. Have a nice day!</B></FONT>"
|
||||
log_admin("[key_name_admin(usr)] has de-traitor'ed [current].")
|
||||
else
|
||||
|
||||
|
||||
else if (href_list["revolution"])
|
||||
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
|
||||
|
||||
@@ -697,14 +697,6 @@ var/list/all_supply_groups = list("Operations","Security","Hospitality","Enginee
|
||||
access = access_armory
|
||||
group = "Security"
|
||||
|
||||
/datum/supply_packs/loyalty
|
||||
name = "Loyalty implant crate"
|
||||
contains = list (/obj/item/weapon/storage/lockbox/loyalty)
|
||||
cost = 60
|
||||
containertype = /obj/structure/closet/crate/secure
|
||||
containername = "Loyalty implant crate"
|
||||
access = access_armory
|
||||
group = "Security"
|
||||
|
||||
/datum/supply_packs/ballistic
|
||||
name = "Ballistic gear crate"
|
||||
@@ -741,6 +733,17 @@ var/list/all_supply_groups = list("Operations","Security","Hospitality","Enginee
|
||||
access = access_armory
|
||||
group = "Security"
|
||||
|
||||
/*
|
||||
/datum/supply_packs/loyalty
|
||||
name = "Loyalty implant crate"
|
||||
contains = list (/obj/item/weapon/storage/lockbox/loyalty)
|
||||
cost = 60
|
||||
containertype = /obj/structure/closet/crate/secure
|
||||
containername = "Loyalty implant crate"
|
||||
access = access_armory
|
||||
group = "Security"
|
||||
*/
|
||||
|
||||
/datum/supply_packs/expenergy
|
||||
name = "Experimental energy gear crate"
|
||||
contains = list(/obj/item/clothing/suit/armor/laserproof,
|
||||
|
||||
@@ -52,8 +52,10 @@
|
||||
icon_state = "soapnt"
|
||||
|
||||
/obj/item/weapon/soap/deluxe
|
||||
desc = "A deluxe Waffle Co. brand bar of soap. Smells of condoms."
|
||||
icon_state = "soapdeluxe"
|
||||
|
||||
/obj/item/weapon/soap/deluxe/New()
|
||||
desc = "A deluxe Waffle Co. brand bar of soap. Smells of [pick("lavender", "vanilla", "strawberry", "chocolate" ,"space")]."
|
||||
|
||||
/obj/item/weapon/soap/syndie
|
||||
desc = "An untrustworthy bar of soap. Smells of fear."
|
||||
@@ -162,7 +164,7 @@
|
||||
icon_state = "beartrap[armed]"
|
||||
user << "<span class='notice'>[src] is now [armed ? "armed" : "disarmed"]</span>"
|
||||
|
||||
/obj/item/weapon/legcuffs/beartrap/HasEntered(AM as mob|obj)
|
||||
/obj/item/weapon/legcuffs/beartrap/Crossed(AM as mob|obj)
|
||||
if(armed)
|
||||
if(ishuman(AM))
|
||||
if(isturf(src.loc))
|
||||
|
||||
@@ -35,6 +35,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
var/debug = 0
|
||||
var/powerupdate = 10 //We give everything 10 ticks to settle out it's power usage.
|
||||
var/requires_power = 1
|
||||
var/unlimited_power = 0
|
||||
var/always_unpowered = 0 //this gets overriden to 1 for space in area/New()
|
||||
|
||||
var/power_equip = 1
|
||||
@@ -364,6 +365,7 @@ var/list/ghostteleportlocs = list()
|
||||
name = "\improper Syndicate Mothership"
|
||||
icon_state = "syndie-ship"
|
||||
requires_power = 0
|
||||
unlimited_power = 1
|
||||
|
||||
/area/syndicate_mothership/control
|
||||
name = "\improper Syndicate Control Room"
|
||||
@@ -436,6 +438,7 @@ var/list/ghostteleportlocs = list()
|
||||
name = "\improper Syndicate Station"
|
||||
icon_state = "yellow"
|
||||
requires_power = 0
|
||||
unlimited_power = 1
|
||||
|
||||
/area/syndicate_station/start
|
||||
name = "\improper Syndicate Forward Operating Base"
|
||||
@@ -1177,10 +1180,6 @@ var/list/ghostteleportlocs = list()
|
||||
name = "\improper Robotics"
|
||||
icon_state = "medresearch"
|
||||
|
||||
/area/medical/research
|
||||
name = "\improper Medical Research"
|
||||
icon_state = "medresearch"
|
||||
|
||||
/area/medical/virology
|
||||
name = "\improper Virology"
|
||||
icon_state = "virology"
|
||||
@@ -1378,12 +1377,11 @@ var/list/ghostteleportlocs = list()
|
||||
icon_state = "garden"
|
||||
|
||||
//rnd (Research and Development
|
||||
/area/rnd/research
|
||||
name = "\improper Research and Development"
|
||||
icon_state = "research"
|
||||
|
||||
/area/rnd/lab
|
||||
name = "\improper Research and Development"
|
||||
icon_state = "toxlab"
|
||||
|
||||
/area/rnd/hallway
|
||||
name = "\improper Research Lab"
|
||||
icon_state = "toxlab"
|
||||
|
||||
|
||||
@@ -70,9 +70,6 @@
|
||||
/atom/proc/CheckExit()
|
||||
return 1
|
||||
|
||||
/atom/proc/HasEntered(atom/movable/AM as mob|obj)
|
||||
return
|
||||
|
||||
/atom/proc/HasProximity(atom/movable/AM as mob|obj)
|
||||
return
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
|
||||
if(user == connected.occupant || user.stat)
|
||||
return
|
||||
@@ -425,7 +425,7 @@
|
||||
data["beakerVolume"] += R.volume
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
/obj/structure/cult
|
||||
density = 1
|
||||
anchored = 1
|
||||
icon = 'icons/obj/cult.dmi'
|
||||
|
||||
/obj/structure/cult/talisman
|
||||
name = "Altar"
|
||||
desc = "A bloodstained altar dedicated to Nar-Sie"
|
||||
icon_state = "talismanaltar"
|
||||
|
||||
|
||||
/obj/structure/cult/forge
|
||||
name = "Daemon forge"
|
||||
desc = "A forge used in crafting the unholy weapons used by the armies of Nar-Sie"
|
||||
icon_state = "forge"
|
||||
|
||||
/obj/structure/cult/pylon
|
||||
name = "Pylon"
|
||||
desc = "A floating crystal that hums with an unearthly energy"
|
||||
icon_state = "pylon"
|
||||
luminosity = 5
|
||||
|
||||
|
||||
/obj/structure/cult/tome
|
||||
name = "Desk"
|
||||
desc = "A desk covered in arcane manuscripts and tomes in unknown languages. Looking at the text makes your skin crawl"
|
||||
icon_state = "tomealtar"
|
||||
// luminosity = 5
|
||||
|
||||
//sprites for this no longer exist -Pete
|
||||
//(they were stolen from another game anyway)
|
||||
/*
|
||||
/obj/structure/cult/pillar
|
||||
name = "Pillar"
|
||||
desc = "This should not exist"
|
||||
icon_state = "pillar"
|
||||
icon = 'magic_pillar.dmi'
|
||||
*/
|
||||
|
||||
/obj/effect/gateway
|
||||
name = "gateway"
|
||||
desc = "You're pretty sure that abyss is staring back"
|
||||
icon = 'icons/obj/cult.dmi'
|
||||
icon_state = "hole"
|
||||
density = 1
|
||||
unacidable = 1
|
||||
anchored = 1.0
|
||||
|
||||
/obj/effect/gateway/Bumped(mob/M as mob|obj)
|
||||
spawn(0)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/effect/gateway/HasEntered(AM as mob|obj)
|
||||
spawn(0)
|
||||
return
|
||||
/obj/structure/cult
|
||||
density = 1
|
||||
anchored = 1
|
||||
icon = 'icons/obj/cult.dmi'
|
||||
|
||||
/obj/structure/cult/talisman
|
||||
name = "Altar"
|
||||
desc = "A bloodstained altar dedicated to Nar-Sie"
|
||||
icon_state = "talismanaltar"
|
||||
|
||||
|
||||
/obj/structure/cult/forge
|
||||
name = "Daemon forge"
|
||||
desc = "A forge used in crafting the unholy weapons used by the armies of Nar-Sie"
|
||||
icon_state = "forge"
|
||||
|
||||
/obj/structure/cult/pylon
|
||||
name = "Pylon"
|
||||
desc = "A floating crystal that hums with an unearthly energy"
|
||||
icon_state = "pylon"
|
||||
luminosity = 5
|
||||
|
||||
|
||||
/obj/structure/cult/tome
|
||||
name = "Desk"
|
||||
desc = "A desk covered in arcane manuscripts and tomes in unknown languages. Looking at the text makes your skin crawl"
|
||||
icon_state = "tomealtar"
|
||||
// luminosity = 5
|
||||
|
||||
//sprites for this no longer exist -Pete
|
||||
//(they were stolen from another game anyway)
|
||||
/*
|
||||
/obj/structure/cult/pillar
|
||||
name = "Pillar"
|
||||
desc = "This should not exist"
|
||||
icon_state = "pillar"
|
||||
icon = 'magic_pillar.dmi'
|
||||
*/
|
||||
|
||||
/obj/effect/gateway
|
||||
name = "gateway"
|
||||
desc = "You're pretty sure that abyss is staring back"
|
||||
icon = 'icons/obj/cult.dmi'
|
||||
icon_state = "hole"
|
||||
density = 1
|
||||
unacidable = 1
|
||||
anchored = 1.0
|
||||
|
||||
/obj/effect/gateway/Bumped(mob/M as mob|obj)
|
||||
spawn(0)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/effect/gateway/Crossed(AM as mob|obj)
|
||||
spawn(0)
|
||||
return
|
||||
return
|
||||
@@ -71,7 +71,7 @@
|
||||
world << sound('sound/AI/commandreport.ogg')
|
||||
|
||||
// add an extra law to the AI to make sure it cooperates with the heads
|
||||
var/extra_law = "Crew authorized to know of pathogen [virus_name]'s existence are: Heads of command, any crew member with loyalty implant. Do not allow unauthorized personnel to gain knowledge of [virus_name]. Aid authorized personnel in quarantining and neutrlizing the outbreak. This law overrides all other laws."
|
||||
var/extra_law = "Crew authorized to know of pathogen [virus_name]'s existence are: Heads of command. Do not allow unauthorized personnel to gain knowledge of [virus_name]. Aid authorized personnel in quarantining and neutrlizing the outbreak. This law overrides all other laws."
|
||||
for(var/mob/living/silicon/ai/M in world)
|
||||
M.add_ion_law(extra_law)
|
||||
M << "\red " + extra_law
|
||||
|
||||
@@ -315,24 +315,15 @@ ________________________________________________________________________________
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
var/total_moles = environment.total_moles
|
||||
|
||||
dat += "Air Pressure: [round(pressure,0.1)] kPa"
|
||||
|
||||
if (total_moles)
|
||||
var/o2_level = environment.oxygen/total_moles
|
||||
var/n2_level = environment.nitrogen/total_moles
|
||||
var/co2_level = environment.carbon_dioxide/total_moles
|
||||
var/phoron_level = environment.phoron/total_moles
|
||||
var/unknown_level = 1-(o2_level+n2_level+co2_level+phoron_level)
|
||||
dat += "<ul>"
|
||||
dat += "<li>Nitrogen: [round(n2_level*100)]%</li>"
|
||||
dat += "<li>Oxygen: [round(o2_level*100)]%</li>"
|
||||
dat += "<li>Carbon Dioxide: [round(co2_level*100)]%</li>"
|
||||
dat += "<li>Phoron: [round(phoron_level*100)]%</li>"
|
||||
for(var/g in environment.gas)
|
||||
dat += "<li>[gas_data.name[g]]: [round((environment.gas[g] / total_moles) * 100)]%</li>"
|
||||
dat += "</ul>"
|
||||
if(unknown_level > 0.01)
|
||||
dat += "OTHER: [round(unknown_level)]%<br>"
|
||||
|
||||
dat += "Temperature: [round(environment.temperature-T0C)]°C"
|
||||
if(2)
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
del(A)
|
||||
continue
|
||||
|
||||
var/obj/effect/landmark/uplinklocker = locate("landmark*Syndicate-Uplink") //i will be rewriting this shortly
|
||||
var/obj/effect/landmark/uplinkdevice = locate("landmark*Syndicate-Uplink") //i will be rewriting this shortly
|
||||
var/obj/effect/landmark/nuke_spawn = locate("landmark*Nuclear-Bomb")
|
||||
|
||||
var/nuke_code = "[rand(10000, 99999)]"
|
||||
@@ -153,8 +153,9 @@
|
||||
|
||||
update_all_synd_icons()
|
||||
|
||||
if(uplinklocker)
|
||||
new /obj/structure/closet/syndicate/nuclear(uplinklocker.loc)
|
||||
if(uplinkdevice)
|
||||
var/obj/item/device/radio/uplink/U = new(uplinkdevice.loc)
|
||||
U.hidden_uplink.uses = 40
|
||||
if(nuke_spawn && synd_spawn.len > 0)
|
||||
var/obj/machinery/nuclearbomb/the_bomb = new /obj/machinery/nuclearbomb(nuke_spawn.loc)
|
||||
the_bomb.r_code = nuke_code
|
||||
@@ -166,6 +167,7 @@
|
||||
|
||||
|
||||
/datum/game_mode/proc/prepare_syndicate_leader(var/datum/mind/synd_mind, var/nuke_code)
|
||||
var/obj/effect/landmark/code_spawn = locate("landmark*Nuclear-Code")
|
||||
if (nuke_code)
|
||||
synd_mind.store_memory("<B>Syndicate Nuclear Bomb Code</B>: [nuke_code]", 0, 0)
|
||||
synd_mind.current << "The nuclear authorization code is: <B>[nuke_code]</B>"
|
||||
@@ -173,7 +175,7 @@
|
||||
P.info = "The nuclear authorization code is: <b>[nuke_code]</b>"
|
||||
P.name = "nuclear bomb code"
|
||||
if (ticker.mode.config_tag=="nuclear")
|
||||
P.loc = synd_mind.current.loc
|
||||
P.loc = code_spawn.loc
|
||||
else
|
||||
var/mob/living/carbon/human/H = synd_mind.current
|
||||
P.loc = H.loc
|
||||
@@ -230,6 +232,7 @@
|
||||
synd_mob.equip_to_slot_or_del(new /obj/item/weapon/gun/projectile/automatic/c20r(synd_mob), slot_belt)
|
||||
synd_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/box/engineer(synd_mob.back), slot_in_backpack)
|
||||
|
||||
/* Commented; nukes now have a suit cycler for changing rig-suits, they don't need to spawn with them
|
||||
var/obj/item/clothing/suit/space/rig/syndi/new_suit = new(synd_mob)
|
||||
var/obj/item/clothing/head/helmet/space/rig/syndi/new_helmet = new(synd_mob)
|
||||
|
||||
@@ -245,8 +248,8 @@
|
||||
if("Skrell")
|
||||
new_suit.species_restricted = list("Skrell")
|
||||
|
||||
synd_mob.equip_to_slot_or_del(new_suit, slot_wear_suit)
|
||||
synd_mob.equip_to_slot_or_del(new_helmet, slot_head)
|
||||
synd_mob.equip_to_slot_or_del(new_suit, slot_in_backpack)
|
||||
synd_mob.equip_to_slot_or_del(new_helmet, slot_in_backpack)*/
|
||||
|
||||
// var/obj/item/weapon/implant/explosive/E = new/obj/item/weapon/implant/explosive(synd_mob)
|
||||
// E.imp_in = synd_mob
|
||||
|
||||
@@ -557,7 +557,7 @@ datum/objective/steal
|
||||
|
||||
for(var/obj/item/I in all_items) //Check for phoron tanks
|
||||
if(istype(I, steal_target))
|
||||
found_amount += (target_name=="28 moles of phoron (full tank)" ? (I:air_contents:phoron) : (I:amount))
|
||||
found_amount += (target_name=="28 moles of phoron (full tank)" ? (I:air_contents:gas["phoron"]) : (I:amount))
|
||||
return found_amount>=target_amount
|
||||
|
||||
if("50 coins (in bag)")
|
||||
|
||||
@@ -32,13 +32,10 @@
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/ids(H), slot_r_hand)
|
||||
else
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/ids(H.back), slot_in_backpack)
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
world << "<b>[H.real_name] is the captain!</b>"
|
||||
var/datum/organ/external/affected = H.organs_by_name["head"]
|
||||
affected.implants += L
|
||||
L.part = affected
|
||||
|
||||
H.implant_loyalty(src)
|
||||
|
||||
return 1
|
||||
|
||||
get_access()
|
||||
|
||||
@@ -357,10 +357,8 @@
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H), slot_r_hand)
|
||||
else
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
var/datum/organ/external/affected = H.organs_by_name["head"]
|
||||
affected.implants += L
|
||||
L.part = affected
|
||||
|
||||
H.implant_loyalty(H)
|
||||
|
||||
|
||||
return 1
|
||||
|
||||
@@ -39,12 +39,7 @@
|
||||
else
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/handcuffs(H), slot_in_backpack)
|
||||
var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)
|
||||
L.imp_in = H
|
||||
L.implanted = 1
|
||||
var/datum/organ/external/affected = H.organs_by_name["head"]
|
||||
affected.implants += L
|
||||
L.part = affected
|
||||
H.implant_loyalty(H)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -165,4 +160,4 @@
|
||||
else
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
|
||||
H.equip_to_slot_or_del(new /obj/item/weapon/handcuffs(H), slot_in_backpack)
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_hand(mob/user as mob)
|
||||
src.ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
data["on"] = on ? 1 : 0
|
||||
@@ -62,7 +62,7 @@
|
||||
data["gasTemperatureClass"] = temp_class
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
@@ -137,7 +137,7 @@
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_hand(mob/user as mob)
|
||||
src.ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
data["on"] = on ? 1 : 0
|
||||
@@ -153,7 +153,7 @@
|
||||
data["gasTemperatureClass"] = temp_class
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
|
||||
@@ -198,23 +198,24 @@
|
||||
gas = location.remove_air(0.25*environment.total_moles)
|
||||
if(gas)
|
||||
var/heat_capacity = gas.heat_capacity()
|
||||
var/energy_used = min( abs( heat_capacity*(gas.temperature - target_temperature) ), MAX_ENERGY_CHANGE)
|
||||
if(heat_capacity)
|
||||
var/energy_used = min( abs( heat_capacity*(gas.temperature - target_temperature) ), MAX_ENERGY_CHANGE)
|
||||
|
||||
//Use power. Assuming that each power unit represents 1 watts....
|
||||
use_power(energy_used, ENVIRON)
|
||||
//Use power. Assuming that each power unit represents 1 watts....
|
||||
use_power(energy_used, ENVIRON)
|
||||
|
||||
//We need to cool ourselves.
|
||||
if(environment.temperature > target_temperature)
|
||||
gas.temperature -= energy_used/heat_capacity
|
||||
else
|
||||
gas.temperature += energy_used/heat_capacity
|
||||
//We need to cool ourselves.
|
||||
if(environment.temperature > target_temperature)
|
||||
gas.temperature -= energy_used/heat_capacity
|
||||
else
|
||||
gas.temperature += energy_used/heat_capacity
|
||||
|
||||
environment.merge(gas)
|
||||
environment.merge(gas)
|
||||
|
||||
if(abs(environment.temperature - target_temperature) <= 0.5)
|
||||
regulating_temperature = 0
|
||||
visible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
|
||||
"You hear a click as a faint electronic humming stops.")
|
||||
if(abs(environment.temperature - target_temperature) <= 0.5)
|
||||
regulating_temperature = 0
|
||||
visible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
|
||||
"You hear a click as a faint electronic humming stops.")
|
||||
|
||||
var/old_level = danger_level
|
||||
var/old_pressurelevel = pressure_dangerlevel
|
||||
@@ -256,23 +257,23 @@
|
||||
|
||||
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
var/other_moles = 0.0
|
||||
for(var/datum/gas/G in environment.trace_gases)
|
||||
other_moles+=G.moles
|
||||
//var/other_moles = 0.0
|
||||
////for(var/datum/gas/G in environment.trace_gases)
|
||||
// other_moles+=G.moles
|
||||
|
||||
pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
|
||||
oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, TLV["oxygen"])
|
||||
co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, TLV["carbon dioxide"])
|
||||
phoron_dangerlevel = get_danger_level(environment.phoron*partial_pressure, TLV["phoron"])
|
||||
oxygen_dangerlevel = get_danger_level(environment.gas["oxygen"]*partial_pressure, TLV["oxygen"])
|
||||
co2_dangerlevel = get_danger_level(environment.gas["carbon_dioxide"]*partial_pressure, TLV["carbon dioxide"])
|
||||
phoron_dangerlevel = get_danger_level(environment.gas["phoron"]*partial_pressure, TLV["phoron"])
|
||||
temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
|
||||
other_dangerlevel = get_danger_level(other_moles*partial_pressure, TLV["other"])
|
||||
//other_dangerlevel = get_danger_level(other_moles*partial_pressure, TLV["other"])
|
||||
|
||||
return max(
|
||||
pressure_dangerlevel,
|
||||
oxygen_dangerlevel,
|
||||
co2_dangerlevel,
|
||||
phoron_dangerlevel,
|
||||
other_dangerlevel,
|
||||
//other_dangerlevel,
|
||||
temperature_dangerlevel
|
||||
)
|
||||
|
||||
@@ -661,7 +662,7 @@
|
||||
/obj/machinery/alarm/proc/return_status()
|
||||
var/turf/location = get_turf(src)
|
||||
var/datum/gas_mixture/environment = location.return_air()
|
||||
var/total = environment.oxygen + environment.carbon_dioxide + environment.phoron + environment.nitrogen
|
||||
var/total = environment.total_moles
|
||||
var/output = "<b>Air Status:</b><br>"
|
||||
|
||||
if(total == 0)
|
||||
@@ -683,22 +684,22 @@
|
||||
var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
|
||||
|
||||
current_settings = TLV["oxygen"]
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, current_settings)
|
||||
var/oxygen_percent = round(environment.oxygen / total * 100, 2)
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.gas["oxygen"]*partial_pressure, current_settings)
|
||||
var/oxygen_percent = round(environment.gas["oxygen"] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["carbon dioxide"]
|
||||
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, current_settings)
|
||||
var/co2_percent = round(environment.carbon_dioxide / total * 100, 2)
|
||||
var/co2_dangerlevel = get_danger_level(environment.gas["carbon_dioxide"]*partial_pressure, current_settings)
|
||||
var/co2_percent = round(environment.gas["carbon_dioxide"] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["phoron"]
|
||||
var/phoron_dangerlevel = get_danger_level(environment.phoron*partial_pressure, current_settings)
|
||||
var/phoron_percent = round(environment.phoron / total * 100, 2)
|
||||
var/phoron_dangerlevel = get_danger_level(environment.gas["phoron"]*partial_pressure, current_settings)
|
||||
var/phoron_percent = round(environment.gas["phoron"] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["other"]
|
||||
var/other_moles = 0.0
|
||||
for(var/datum/gas/G in environment.trace_gases)
|
||||
other_moles+=G.moles
|
||||
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings)
|
||||
//current_settings = TLV["other"]
|
||||
//var/other_moles = 0.0
|
||||
//for(var/datum/gas/G in environment.trace_gases)
|
||||
// other_moles+=G.moles
|
||||
//var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings)
|
||||
|
||||
current_settings = TLV["temperature"]
|
||||
var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings)
|
||||
@@ -709,10 +710,10 @@ Oxygen: <span class='dl[oxygen_dangerlevel]'>[oxygen_percent]</span>%<br>
|
||||
Carbon dioxide: <span class='dl[co2_dangerlevel]'>[co2_percent]</span>%<br>
|
||||
Toxins: <span class='dl[phoron_dangerlevel]'>[phoron_percent]</span>%<br>
|
||||
"}
|
||||
if (other_dangerlevel==2)
|
||||
output += "Notice: <span class='dl2'>High Concentration of Unknown Particles Detected</span><br>"
|
||||
else if (other_dangerlevel==1)
|
||||
output += "Notice: <span class='dl1'>Low Concentration of Unknown Particles Detected</span><br>"
|
||||
//if (other_dangerlevel==2)
|
||||
// output += "Notice: <span class='dl2'>High Concentration of Unknown Particles Detected</span><br>"
|
||||
//else if (other_dangerlevel==1)
|
||||
// output += "Notice: <span class='dl1'>Low Concentration of Unknown Particles Detected</span><br>"
|
||||
|
||||
output += "Temperature: <span class='dl[temperature_dangerlevel]'>[environment.temperature]</span>K ([round(environment.temperature - T0C, 0.1)]C)<br>"
|
||||
|
||||
|
||||
@@ -40,16 +40,16 @@ obj/machinery/air_sensor
|
||||
signal.data["temperature"] = round(air_sample.temperature,0.1)
|
||||
|
||||
if(output>4)
|
||||
var/total_moles = air_sample.total_moles()
|
||||
var/total_moles = air_sample.total_moles
|
||||
if(total_moles > 0)
|
||||
if(output&4)
|
||||
signal.data["oxygen"] = round(100*air_sample.oxygen/total_moles,0.1)
|
||||
signal.data["oxygen"] = round(100*air_sample.gas["oxygen"]/total_moles,0.1)
|
||||
if(output&8)
|
||||
signal.data["phoron"] = round(100*air_sample.phoron/total_moles,0.1)
|
||||
signal.data["phoron"] = round(100*air_sample.gas["phoron"]/total_moles,0.1)
|
||||
if(output&16)
|
||||
signal.data["nitrogen"] = round(100*air_sample.nitrogen/total_moles,0.1)
|
||||
signal.data["nitrogen"] = round(100*air_sample.gas["nitrogen"]/total_moles,0.1)
|
||||
if(output&32)
|
||||
signal.data["carbon_dioxide"] = round(100*air_sample.carbon_dioxide/total_moles,0.1)
|
||||
signal.data["carbon_dioxide"] = round(100*air_sample.gas["carbon_dioxide"]/total_moles,0.1)
|
||||
else
|
||||
signal.data["oxygen"] = 0
|
||||
signal.data["phoron"] = 0
|
||||
|
||||
@@ -88,9 +88,9 @@ update_flag
|
||||
src.overlays = 0
|
||||
src.icon_state = text("[]-1", src.canister_color)
|
||||
|
||||
if(icon_state != "[canister_color]")
|
||||
if(icon_state != "[canister_color]")
|
||||
icon_state = "[canister_color]"
|
||||
|
||||
|
||||
if(check_change()) //Returns 1 if no change needed to icons.
|
||||
return
|
||||
|
||||
@@ -227,10 +227,10 @@ update_flag
|
||||
return
|
||||
|
||||
..()
|
||||
|
||||
|
||||
nanomanager.update_uis(src) // Update all NanoUIs attached to src
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/attack_ai(var/mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
@@ -241,7 +241,7 @@ update_flag
|
||||
/obj/machinery/portable_atmospherics/canister/attack_hand(var/mob/user as mob)
|
||||
return src.ui_interact(user)
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/portable_atmospherics/canister/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if (src.destroyed)
|
||||
return
|
||||
|
||||
@@ -255,13 +255,13 @@ update_flag
|
||||
data["minReleasePressure"] = round(ONE_ATMOSPHERE/10)
|
||||
data["maxReleasePressure"] = round(10*ONE_ATMOSPHERE)
|
||||
data["valveOpen"] = valve_open ? 1 : 0
|
||||
|
||||
data["hasHoldingTank"] = holding ? 1 : 0
|
||||
|
||||
data["hasHoldingTank"] = holding ? 1 : 0
|
||||
if (holding)
|
||||
data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.return_pressure()))
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
@@ -330,18 +330,17 @@ update_flag
|
||||
src.canister_color = colors[label]
|
||||
src.icon_state = colors[label]
|
||||
src.name = "Canister: [label]"
|
||||
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
update_icon()
|
||||
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/phoron/New()
|
||||
|
||||
..()
|
||||
|
||||
src.air_contents.phoron = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.update_values()
|
||||
src.air_contents.adjust_gas("phoron", (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
src.update_icon()
|
||||
return 1
|
||||
@@ -350,8 +349,7 @@ update_flag
|
||||
|
||||
..()
|
||||
|
||||
src.air_contents.oxygen = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.update_values()
|
||||
src.air_contents.adjust_gas("oxygen", (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
src.update_icon()
|
||||
return 1
|
||||
|
||||
@@ -359,10 +357,7 @@ update_flag
|
||||
|
||||
..()
|
||||
|
||||
var/datum/gas/sleeping_agent/trace_gas = new
|
||||
air_contents.trace_gases += trace_gas
|
||||
trace_gas.moles = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.update_values()
|
||||
air_contents.adjust_gas("sleeping_agent", (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
src.update_icon()
|
||||
return 1
|
||||
@@ -370,8 +365,7 @@ update_flag
|
||||
//Dirty way to fill room with gas. However it is a bit easier to do than creating some floor/engine/n2o -rastaf0
|
||||
/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller/New()
|
||||
..()
|
||||
var/datum/gas/sleeping_agent/trace_gas = air_contents.trace_gases[1]
|
||||
trace_gas.moles = 9*4000
|
||||
air_contents.gas["sleeping_agent"] = 9*4000
|
||||
spawn(10)
|
||||
var/turf/simulated/location = src.loc
|
||||
if (istype(src.loc))
|
||||
@@ -385,8 +379,7 @@ update_flag
|
||||
|
||||
..()
|
||||
|
||||
src.air_contents.nitrogen = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.update_values()
|
||||
src.air_contents.adjust_gas("nitrogen", (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
src.update_icon()
|
||||
return 1
|
||||
@@ -394,19 +387,14 @@ update_flag
|
||||
/obj/machinery/portable_atmospherics/canister/carbon_dioxide/New()
|
||||
|
||||
..()
|
||||
src.air_contents.carbon_dioxide = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.update_values()
|
||||
|
||||
src.update_icon()
|
||||
src.air_contents.adjust_gas("carbon_dioxide", (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/air/New()
|
||||
|
||||
..()
|
||||
src.air_contents.oxygen = (O2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
src.air_contents.nitrogen = (N2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.update_values()
|
||||
src.air_contents.adjust_multi("oxygen", (O2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature), "nitrogen", (N2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
src.update_icon()
|
||||
return 1
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
if(port)
|
||||
connect(port)
|
||||
update_icon()
|
||||
|
||||
|
||||
process()
|
||||
if(!connected_port) //only react when pipe_network will ont it do it for you
|
||||
//Allow for reactions
|
||||
@@ -118,24 +118,13 @@
|
||||
visible_message("\red [user] has used [W] on \icon[icon]")
|
||||
if(air_contents)
|
||||
var/pressure = air_contents.return_pressure()
|
||||
var/total_moles = air_contents.total_moles()
|
||||
var/total_moles = air_contents.total_moles
|
||||
|
||||
user << "\blue Results of analysis of \icon[icon]"
|
||||
if (total_moles>0)
|
||||
var/o2_concentration = air_contents.oxygen/total_moles
|
||||
var/n2_concentration = air_contents.nitrogen/total_moles
|
||||
var/co2_concentration = air_contents.carbon_dioxide/total_moles
|
||||
var/phoron_concentration = air_contents.phoron/total_moles
|
||||
|
||||
var/unknown_concentration = 1-(o2_concentration+n2_concentration+co2_concentration+phoron_concentration)
|
||||
|
||||
user << "\blue Pressure: [round(pressure,0.1)] kPa"
|
||||
user << "\blue Nitrogen: [round(n2_concentration*100)]%"
|
||||
user << "\blue Oxygen: [round(o2_concentration*100)]%"
|
||||
user << "\blue CO2: [round(co2_concentration*100)]%"
|
||||
user << "\blue Phoron: [round(phoron_concentration*100)]%"
|
||||
if(unknown_concentration>0.01)
|
||||
user << "\red Unknown: [round(unknown_concentration*100)]%"
|
||||
for(var/g in air_contents.gas)
|
||||
user << "\blue [gas_data.name[g]]: [round((air_contents.gas[g] / total_moles) * 100)]%"
|
||||
user << "\blue Temperature: [round(air_contents.temperature-T0C)]°C"
|
||||
else
|
||||
user << "\blue Tank is empty!"
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
environment = holding.air_contents
|
||||
else
|
||||
environment = loc.return_air()
|
||||
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
|
||||
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles
|
||||
|
||||
//Take a gas sample
|
||||
var/datum/gas_mixture/removed
|
||||
@@ -114,23 +114,17 @@
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
|
||||
filtered_out.phoron = removed.phoron
|
||||
removed.phoron = 0
|
||||
filtered_out.gas["phoron"] = removed.gas["phoron"]
|
||||
removed.gas["phoron"] = 0
|
||||
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
filtered_out.gas["carbon_dioxide"] = removed.gas["carbon_dioxide"]
|
||||
removed.gas["carbon_dioxide"] = 0
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/sleeping_agent))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
filtered_out.gas["sleeping_agent"] = removed.gas["sleeping_agent"]
|
||||
removed.gas["sleeping_agent"] = 0
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
filtered_out.gas["oxygen_agent_b"] = removed.gas["oxygen_agent_b"]
|
||||
removed.gas["oxygen_agent_b"] = 0
|
||||
|
||||
//Remix the resulting gases
|
||||
air_contents.merge(filtered_out)
|
||||
|
||||
@@ -789,7 +789,7 @@
|
||||
return get_turf(src)
|
||||
|
||||
|
||||
// called from mob/living/carbon/human/HasEntered()
|
||||
// called from mob/living/carbon/human/Crossed()
|
||||
// when mulebot is in the same loc
|
||||
/obj/machinery/bot/mulebot/proc/RunOver(var/mob/living/carbon/human/H)
|
||||
src.visible_message("\red [src] drives over [H]!")
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/mob/living/silicon/ai/var/max_locations = 5
|
||||
/mob/living/silicon/ai/var/stored_locations[0]
|
||||
|
||||
/mob/living/silicon/ai/proc/InvalidTurf(turf/T as turf)
|
||||
if(!T)
|
||||
return 1
|
||||
if(T.z == 2)
|
||||
return 1
|
||||
if(T.z > 6)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/ai/proc/get_camera_list()
|
||||
|
||||
if(src.stat == 2)
|
||||
@@ -38,6 +50,59 @@
|
||||
|
||||
return
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_store_location(loc as text)
|
||||
set category = "AI Commands"
|
||||
set name = "Store Camera Location"
|
||||
set desc = "Stores your current camera location by the given name"
|
||||
|
||||
loc = copytext(sanitize(loc), 1, MAX_MESSAGE_LEN)
|
||||
if(!loc)
|
||||
src << "\red Must supply a location name"
|
||||
return
|
||||
|
||||
if(stored_locations.len >= max_locations)
|
||||
src << "\red Cannot store additional locations. Remove one first"
|
||||
return
|
||||
|
||||
if(loc in stored_locations)
|
||||
src << "\red There is already a stored location by this name"
|
||||
return
|
||||
|
||||
var/L = src.eyeobj.getLoc()
|
||||
if (InvalidTurf(get_turf(L)))
|
||||
src << "\red Unable to store this location"
|
||||
return
|
||||
|
||||
stored_locations[loc] = L
|
||||
src << "Location '[loc]' stored"
|
||||
|
||||
/mob/living/silicon/ai/proc/sorted_stored_locations()
|
||||
return sortList(stored_locations)
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_goto_location(loc in sorted_stored_locations())
|
||||
set category = "AI Commands"
|
||||
set name = "Goto Camera Location"
|
||||
set desc = "Returns to the selected camera location"
|
||||
|
||||
if (!(loc in stored_locations))
|
||||
src << "\red Location [loc] not found"
|
||||
return
|
||||
|
||||
var/L = stored_locations[loc]
|
||||
src.eyeobj.setLoc(L)
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_remove_location(loc in sorted_stored_locations())
|
||||
set category = "AI Commands"
|
||||
set name = "Remove Camera Location"
|
||||
set desc = "Removes the selected camera location"
|
||||
|
||||
if (!(loc in stored_locations))
|
||||
src << "\red Location [loc] not found"
|
||||
return
|
||||
|
||||
stored_locations.Remove(loc)
|
||||
src << "Location [loc] removed"
|
||||
|
||||
// Used to allow the AI is write in mob names/camera name from the CMD line.
|
||||
/datum/trackable
|
||||
var/list/names = list()
|
||||
@@ -55,12 +120,7 @@
|
||||
for(var/mob/living/M in mob_list)
|
||||
// Easy checks first.
|
||||
// Don't detect mobs on Centcom. Since the wizard den is on Centcomm, we only need this.
|
||||
var/turf/T = get_turf(M)
|
||||
if(!T)
|
||||
continue
|
||||
if(T.z == 2)
|
||||
continue
|
||||
if(T.z > 6)
|
||||
if(InvalidTurf(get_turf(M)))
|
||||
continue
|
||||
if(M == usr)
|
||||
continue
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
if(stat & (NOPOWER|BROKEN)) return
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/computer/card/ui_interact(mob/user, ui_key="main", datum/nanoui/ui=null)
|
||||
/obj/machinery/computer/card/ui_interact(mob/user, ui_key="main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
user.set_machine(src)
|
||||
|
||||
var/data[0]
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
data["regions"] = regions
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "identification_computer.tmpl", src.name, 600, 700)
|
||||
ui.set_initial_data(data)
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
/obj/machinery/computer/crew/interact(mob/user)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/computer/crew/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/computer/crew/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
user.set_machine(src)
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
data["crewmembers"] = crewmembers
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "crew_monitor.tmpl", "Crew Monitoring Computer", 900, 600)
|
||||
ui.set_initial_data(data)
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
|
||||
if(user == occupant || user.stat)
|
||||
return
|
||||
@@ -121,13 +121,13 @@
|
||||
data["beakerVolume"] += R.volume
|
||||
|
||||
// update the ui if it exists, returns null if no ui is passed/found
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new() one
|
||||
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
|
||||
ui = new(user, src, ui_key, "cryo.tmpl", "Cryo Cell Control System", 520, 410)
|
||||
// when the ui is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
ui.set_initial_data(data)
|
||||
// open the new ui window
|
||||
ui.open()
|
||||
// auto update every Master Controller tick
|
||||
@@ -194,7 +194,7 @@
|
||||
icon_state = "cell-off"
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/process_occupant()
|
||||
if(air_contents.total_moles() < 10)
|
||||
if(air_contents.total_moles < 10)
|
||||
return
|
||||
if(occupant)
|
||||
if(occupant.stat == 2)
|
||||
@@ -205,7 +205,7 @@
|
||||
if(occupant.bodytemperature < T0C)
|
||||
occupant.sleeping = max(5, (1/occupant.bodytemperature)*2000)
|
||||
occupant.Paralyse(max(5, (1/occupant.bodytemperature)*3000))
|
||||
if(air_contents.oxygen > 2)
|
||||
if(air_contents.gas["oxygen"] > 2)
|
||||
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)
|
||||
else
|
||||
occupant.adjustOxyLoss(-1)
|
||||
@@ -224,7 +224,7 @@
|
||||
beaker.reagents.reaction(occupant)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/heat_gas_contents()
|
||||
if(air_contents.total_moles() < 1)
|
||||
if(air_contents.total_moles < 1)
|
||||
return
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
@@ -233,7 +233,7 @@
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/expel_gas()
|
||||
if(air_contents.total_moles() < 1)
|
||||
if(air_contents.total_moles < 1)
|
||||
return
|
||||
// var/datum/gas_mixture/expel_gas = new
|
||||
// var/remove_amount = air_contents.total_moles()/50
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#define CONTROL_POD_DOORS 0
|
||||
#define CONTROL_NORMAL_DOORS 1
|
||||
#define CONTROL_EMITTERS 2
|
||||
|
||||
/obj/machinery/door_control
|
||||
name = "remote door-control"
|
||||
desc = "It controls doors, remotely."
|
||||
@@ -7,7 +11,7 @@
|
||||
power_channel = ENVIRON
|
||||
var/id = null
|
||||
var/range = 10
|
||||
var/normaldoorcontrol = 0
|
||||
var/normaldoorcontrol = CONTROL_POD_DOORS
|
||||
var/desiredstate = 0 // Zero is closed, 1 is open.
|
||||
var/specialfunctions = 1
|
||||
/*
|
||||
@@ -63,8 +67,59 @@
|
||||
playsound(src.loc, "sparks", 100, 1)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/door_control/proc/handle_door()
|
||||
for(var/obj/machinery/door/airlock/D in range(range))
|
||||
if(D.id_tag == src.id)
|
||||
if(specialfunctions & OPEN)
|
||||
if (D.density)
|
||||
spawn(0)
|
||||
D.open()
|
||||
return
|
||||
else
|
||||
spawn(0)
|
||||
D.close()
|
||||
return
|
||||
if(desiredstate == 1)
|
||||
if(specialfunctions & IDSCAN)
|
||||
D.aiDisabledIdScanner = 1
|
||||
if(specialfunctions & BOLTS)
|
||||
D.lock()
|
||||
if(specialfunctions & SHOCK)
|
||||
D.secondsElectrified = -1
|
||||
if(specialfunctions & SAFE)
|
||||
D.safe = 0
|
||||
else
|
||||
if(specialfunctions & IDSCAN)
|
||||
D.aiDisabledIdScanner = 0
|
||||
if(specialfunctions & BOLTS)
|
||||
if(!D.isWireCut(4) && D.arePowerSystemsOn())
|
||||
D.unlock()
|
||||
if(specialfunctions & SHOCK)
|
||||
D.secondsElectrified = 0
|
||||
if(specialfunctions & SAFE)
|
||||
D.safe = 1
|
||||
|
||||
/obj/machinery/door_control/proc/handle_pod()
|
||||
for(var/obj/machinery/door/poddoor/M in world)
|
||||
if(M.id == src.id)
|
||||
if(M.density)
|
||||
spawn(0)
|
||||
M.open()
|
||||
return
|
||||
else
|
||||
spawn(0)
|
||||
M.close()
|
||||
return
|
||||
|
||||
/obj/machinery/door_control/proc/handle_emitters(mob/user as mob)
|
||||
for(var/obj/machinery/power/emitter/E in range(range))
|
||||
if(E.id == src.id)
|
||||
spawn(0)
|
||||
E.activate(user)
|
||||
return
|
||||
|
||||
/obj/machinery/door_control/attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(usr)
|
||||
src.add_fingerprint(user)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
@@ -77,49 +132,13 @@
|
||||
icon_state = "doorctrl1"
|
||||
add_fingerprint(user)
|
||||
|
||||
if(normaldoorcontrol)
|
||||
for(var/obj/machinery/door/airlock/D in range(range))
|
||||
if(D.id_tag == src.id)
|
||||
if(specialfunctions & OPEN)
|
||||
if (D.density)
|
||||
spawn(0)
|
||||
D.open()
|
||||
return
|
||||
else
|
||||
spawn(0)
|
||||
D.close()
|
||||
return
|
||||
if(desiredstate == 1)
|
||||
if(specialfunctions & IDSCAN)
|
||||
D.aiDisabledIdScanner = 1
|
||||
if(specialfunctions & BOLTS)
|
||||
D.lock()
|
||||
if(specialfunctions & SHOCK)
|
||||
D.secondsElectrified = -1
|
||||
if(specialfunctions & SAFE)
|
||||
D.safe = 0
|
||||
else
|
||||
if(specialfunctions & IDSCAN)
|
||||
D.aiDisabledIdScanner = 0
|
||||
if(specialfunctions & BOLTS)
|
||||
if(!D.isWireCut(4) && D.arePowerSystemsOn())
|
||||
D.unlock()
|
||||
if(specialfunctions & SHOCK)
|
||||
D.secondsElectrified = 0
|
||||
if(specialfunctions & SAFE)
|
||||
D.safe = 1
|
||||
|
||||
else
|
||||
for(var/obj/machinery/door/poddoor/M in world)
|
||||
if (M.id == src.id)
|
||||
if (M.density)
|
||||
spawn( 0 )
|
||||
M.open()
|
||||
return
|
||||
else
|
||||
spawn( 0 )
|
||||
M.close()
|
||||
return
|
||||
switch(normaldoorcontrol)
|
||||
if(CONTROL_NORMAL_DOORS)
|
||||
handle_door()
|
||||
if(CONTROL_POD_DOORS)
|
||||
handle_pod()
|
||||
if(CONTROL_EMITTERS)
|
||||
handle_emitters(user)
|
||||
|
||||
desiredstate = !desiredstate
|
||||
spawn(15)
|
||||
|
||||
@@ -288,13 +288,7 @@ Airlock index -> wire color are { 9, 4, 6, 7, 5, 8, 1, 2, 3 }.
|
||||
|
||||
/obj/machinery/door/airlock/phoron/proc/PhoronBurn(temperature)
|
||||
for(var/turf/simulated/floor/target_tile in range(2,loc))
|
||||
// if(target_tile.parent && target_tile.parent.group_processing) // THESE PROBABLY DO SOMETHING IMPORTANT BUT I DON'T KNOW HOW TO FIX IT - Erthilo
|
||||
// target_tile.parent.suspend_group_processing()
|
||||
var/datum/gas_mixture/napalm = new
|
||||
var/phoronToDeduce = 35
|
||||
napalm.phoron = phoronToDeduce
|
||||
napalm.temperature = 400+T0C
|
||||
target_tile.assume_air(napalm)
|
||||
target_tile.assume_gas("phoron", 35, 400+T0C)
|
||||
spawn (0) target_tile.hotspot_expose(temperature, 400)
|
||||
for(var/obj/structure/falsewall/phoron/F in range(3,src))//Hackish as fuck, but until temperature_expose works, there is nothing I can do -Sieve
|
||||
var/turf/T = get_turf(F)
|
||||
@@ -540,8 +534,8 @@ About the new airlock wires panel:
|
||||
/obj/machinery/door/airlock/proc/canAIControl()
|
||||
return ((src.aiControlDisabled!=1) && (!src.isAllPowerCut()));
|
||||
|
||||
/obj/machinery/door/airlock/proc/canAIHack()
|
||||
return ((src.aiControlDisabled==1) && (!hackProof) && (!src.isAllPowerCut()));
|
||||
/obj/machinery/door/airlock/proc/canAIHack(var/user as mob)
|
||||
return (isAI(user) && src.aiControlDisabled==1 && !hackProof && !src.isAllPowerCut());
|
||||
|
||||
/obj/machinery/door/airlock/proc/arePowerSystemsOn()
|
||||
return (src.secondsMainPowerLost==0 || src.secondsBackupPowerLost==0)
|
||||
@@ -651,12 +645,8 @@ About the new airlock wires panel:
|
||||
return
|
||||
|
||||
/obj/machinery/door/airlock/attack_ai(mob/user as mob)
|
||||
if(!src.canAIControl())
|
||||
if(src.canAIHack())
|
||||
src.hack(user)
|
||||
return
|
||||
else
|
||||
user << "Airlock AI control has been blocked with a firewall. Unable to hack."
|
||||
if (!check_synth_access(user))
|
||||
return
|
||||
|
||||
//Separate interface for the AI.
|
||||
user.set_machine(src)
|
||||
@@ -772,7 +762,7 @@ About the new airlock wires panel:
|
||||
user << "Alert cancelled. Airlock control has been restored without our assistance."
|
||||
src.aiHacking=0
|
||||
return
|
||||
else if(!src.canAIHack())
|
||||
else if(!src.canAIHack(user))
|
||||
user << "We've lost our connection! Unable to hack airlock."
|
||||
src.aiHacking=0
|
||||
return
|
||||
@@ -784,7 +774,7 @@ About the new airlock wires panel:
|
||||
user << "Alert cancelled. Airlock control has been restored without our assistance."
|
||||
src.aiHacking=0
|
||||
return
|
||||
else if(!src.canAIHack())
|
||||
else if(!src.canAIHack(user))
|
||||
user << "We've lost our connection! Unable to hack airlock."
|
||||
src.aiHacking=0
|
||||
return
|
||||
@@ -794,7 +784,7 @@ About the new airlock wires panel:
|
||||
user << "Alert cancelled. Airlock control has been restored without our assistance."
|
||||
src.aiHacking=0
|
||||
return
|
||||
else if(!src.canAIHack())
|
||||
else if(!src.canAIHack(user))
|
||||
user << "We've lost our connection! Unable to hack airlock."
|
||||
src.aiHacking=0
|
||||
return
|
||||
@@ -889,6 +879,17 @@ About the new airlock wires panel:
|
||||
..(user)
|
||||
return
|
||||
|
||||
/obj/machinery/door/airlock/proc/check_synth_access(mob/user as mob)
|
||||
if(emagged)
|
||||
user << "<span class='warning'>Unable to interface: Airlock is unresponsive.</span>"
|
||||
return 0
|
||||
if(!src.canAIControl())
|
||||
if(src.canAIHack(user))
|
||||
src.hack(user)
|
||||
else
|
||||
user << "<span class='warning'>Airlock AI control has been blocked with a firewall.</span>"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/machinery/door/airlock/Topic(href, href_list, var/nowindow = 0)
|
||||
if(!nowindow)
|
||||
@@ -951,7 +952,10 @@ About the new airlock wires panel:
|
||||
src.signalers[wirenum] = null
|
||||
|
||||
|
||||
if(istype(usr, /mob/living/silicon) && src.canAIControl())
|
||||
if(istype(usr, /mob/living/silicon))
|
||||
if (!check_synth_access(usr))
|
||||
return
|
||||
|
||||
//AI
|
||||
//aiDisable - 1 idscan, 2 disrupt main power, 3 disrupt backup power, 4 drop door bolts, 5 un-electrify door, 7 close door, 8 door safties, 9 door speed
|
||||
//aiEnable - 1 idscan, 4 raise door bolts, 5 electrify door for 30 seconds, 6 electrify door indefinitely, 7 open door, 8 door safties, 9 door speed
|
||||
@@ -961,10 +965,11 @@ About the new airlock wires panel:
|
||||
if(1)
|
||||
//disable idscan
|
||||
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
|
||||
usr << "The IdScan wire has been cut - So, you can't disable it, but it is already disabled anyways."
|
||||
usr << "The IdScan wire has been cut - The IdScan feature is already disabled."
|
||||
else if(src.aiDisabledIdScanner)
|
||||
usr << "You've already disabled the IdScan feature."
|
||||
usr << "The IdScan feature is already disabled."
|
||||
else
|
||||
usr << "The IdScan feature has been disabled."
|
||||
src.aiDisabledIdScanner = 1
|
||||
if(2)
|
||||
//disrupt main power
|
||||
@@ -981,38 +986,19 @@ About the new airlock wires panel:
|
||||
if(4)
|
||||
//drop door bolts
|
||||
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
|
||||
usr << "You can't drop the door bolts - The door bolt control wire has been cut."
|
||||
usr << "The door bolt control wire has been cut - The door bolts are already dropped."
|
||||
else if(src.locked)
|
||||
usr << "The door bolts are already dropped."
|
||||
else
|
||||
src.lock()
|
||||
usr << "The door bolts have been dropped."
|
||||
if(5)
|
||||
//un-electrify door
|
||||
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
|
||||
usr << text("Can't un-electrify the airlock - The electrification wire is cut.")
|
||||
else if(src.secondsElectrified==-1)
|
||||
usr << text("The electrification wire is cut - Cannot un-electrify the door.")
|
||||
else if(secondsElectrified != 0)
|
||||
usr << "The door is now un-electrified."
|
||||
src.secondsElectrified = 0
|
||||
else if(src.secondsElectrified>0)
|
||||
src.secondsElectrified = 0
|
||||
|
||||
if(8)
|
||||
// Safeties! We don't need no stinking safeties!
|
||||
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
|
||||
usr << text("Control to door sensors is disabled.")
|
||||
else if (src.safe)
|
||||
safe = 0
|
||||
else
|
||||
usr << text("Firmware reports safeties already overriden.")
|
||||
|
||||
|
||||
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
|
||||
usr << text("Control to door timing circuitry has been severed.")
|
||||
else if (src.normalspeed)
|
||||
normalspeed = 0
|
||||
else
|
||||
usr << text("Door timing circurity already accellerated.")
|
||||
|
||||
if(7)
|
||||
//close door
|
||||
if(src.welded)
|
||||
@@ -1023,17 +1009,31 @@ About the new airlock wires panel:
|
||||
close()
|
||||
else
|
||||
open()
|
||||
|
||||
if(8)
|
||||
// Safeties! We don't need no stinking safeties!
|
||||
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
|
||||
usr << text("Control to door sensors is disabled.")
|
||||
else if (src.safe)
|
||||
safe = 0
|
||||
else
|
||||
usr << text("Firmware reports safeties already overridden.")
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
|
||||
usr << text("Control to door timing circuitry has been severed.")
|
||||
else if (src.normalspeed)
|
||||
normalspeed = 0
|
||||
else
|
||||
usr << text("Door timing circuity already accelerated.")
|
||||
if(10)
|
||||
// Bolt lights
|
||||
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
|
||||
usr << text("Control to door bolt lights has been severed.</a>")
|
||||
usr << "The bolt lights wire has been cut - The door bolt lights are already disabled."
|
||||
else if (src.lights)
|
||||
lights = 0
|
||||
usr << "The door bolt lights have been disabled."
|
||||
else
|
||||
usr << text("Door bolt lights are already disabled!")
|
||||
|
||||
|
||||
usr << "The door bolt lights are already disabled!"
|
||||
|
||||
else if(href_list["aiEnable"])
|
||||
var/code = text2num(href_list["aiEnable"])
|
||||
@@ -1041,20 +1041,23 @@ About the new airlock wires panel:
|
||||
if(1)
|
||||
//enable idscan
|
||||
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
|
||||
usr << "You can't enable IdScan - The IdScan wire has been cut."
|
||||
usr << "The IdScan wire has been cut - The IdScan feature cannot be enabled."
|
||||
else if(src.aiDisabledIdScanner)
|
||||
usr << "The IdScan feature has been enabled."
|
||||
src.aiDisabledIdScanner = 0
|
||||
else
|
||||
usr << "The IdScan feature is not disabled."
|
||||
usr << "The IdScan feature is already enabled."
|
||||
if(4)
|
||||
//raise door bolts
|
||||
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
|
||||
usr << text("The door bolt control wire is cut - you can't raise the door bolts.<br>\n")
|
||||
usr << "The door bolt control wire has been cut - The door bolts cannot be raised."
|
||||
else if(!src.locked)
|
||||
usr << text("The door bolts are already up.<br>\n")
|
||||
usr << "The door bolts are already raised."
|
||||
else
|
||||
src.unlock()
|
||||
|
||||
if(src.unlock())
|
||||
usr << "The door bolts have been raised."
|
||||
else
|
||||
usr << "Unable to raise door bolts."
|
||||
if(5)
|
||||
//electrify door for 30 seconds
|
||||
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
|
||||
@@ -1062,17 +1065,17 @@ About the new airlock wires panel:
|
||||
else if(src.secondsElectrified==-1)
|
||||
usr << text("The door is already indefinitely electrified. You'd have to un-electrify it before you can re-electrify it with a non-forever duration.<br>\n")
|
||||
else if(src.secondsElectrified!=0)
|
||||
usr << text("The door is already electrified. You can't re-electrify it while it's already electrified.<br>\n")
|
||||
usr << text("The door is already electrified. Cannot re-electrify it while it's already electrified.<br>\n")
|
||||
else
|
||||
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
|
||||
usr << "The door is now electrified for thirty seconds."
|
||||
src.secondsElectrified = 30
|
||||
spawn(10)
|
||||
while (src.secondsElectrified>0)
|
||||
src.secondsElectrified-=1
|
||||
if(src.secondsElectrified<0)
|
||||
src.secondsElectrified = 0
|
||||
src.updateUsrDialog()
|
||||
sleep(10)
|
||||
if(6)
|
||||
//electrify door indefinitely
|
||||
@@ -1085,28 +1088,8 @@ About the new airlock wires panel:
|
||||
else
|
||||
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
|
||||
usr << "The door is now electrified."
|
||||
src.secondsElectrified = -1
|
||||
|
||||
if (8) // Not in order >.>
|
||||
// Safeties! Maybe we do need some stinking safeties!
|
||||
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
|
||||
usr << text("Control to door sensors is disabled.")
|
||||
else if (!src.safe)
|
||||
safe = 1
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
usr << text("Firmware reports safeties already in place.")
|
||||
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
|
||||
usr << text("Control to door timing circuitry has been severed.")
|
||||
else if (!src.normalspeed)
|
||||
normalspeed = 1
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
usr << text("Door timing circurity currently operating normally.")
|
||||
|
||||
if(7)
|
||||
//open door
|
||||
if(src.welded)
|
||||
@@ -1117,16 +1100,31 @@ About the new airlock wires panel:
|
||||
open()
|
||||
else
|
||||
close()
|
||||
|
||||
if (8)
|
||||
// Safeties! Maybe we do need some stinking safeties!
|
||||
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
|
||||
usr << text("Control to door sensors is disabled.")
|
||||
else if (!src.safe)
|
||||
safe = 1
|
||||
else
|
||||
usr << text("Firmware reports safeties already in place.")
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
|
||||
usr << text("Control to door timing circuitry has been severed.")
|
||||
else if (!src.normalspeed)
|
||||
normalspeed = 1
|
||||
else
|
||||
usr << text("Door timing circuity currently operating normally.")
|
||||
if(10)
|
||||
// Bolt lights
|
||||
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
|
||||
usr << text("Control to door bolt lights has been severed.</a>")
|
||||
usr << "The bolt lights wire has been cut - The door bolt lights cannot be enabled."
|
||||
else if (!src.lights)
|
||||
lights = 1
|
||||
src.updateUsrDialog()
|
||||
usr << "The door bolt lights have been enabled"
|
||||
else
|
||||
usr << text("Door bolt lights are already enabled!")
|
||||
usr << "The door bolt lights are already enabled!"
|
||||
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
@@ -1315,13 +1313,15 @@ About the new airlock wires panel:
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/door/airlock/proc/unlock(var/forced=0)
|
||||
if (!src.locked) return
|
||||
if (!src.locked) return 0
|
||||
|
||||
if(forced || src.arePowerSystemsOn()) //only can raise bolts if power's on
|
||||
src.locked = 0
|
||||
for(var/mob/M in range(1,src))
|
||||
M.show_message("You hear a click from the bottom of the door.", 2)
|
||||
update_icon()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/door/airlock/New()
|
||||
..()
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/door/window/attack_paw(mob/user as mob)
|
||||
if(istype(user, /mob/living/carbon/alien/humanoid) || istype(user, /mob/living/carbon/slime/adult))
|
||||
if(istype(user, /mob/living/carbon/alien/humanoid))
|
||||
if(src.operating)
|
||||
return
|
||||
playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1)
|
||||
@@ -346,4 +346,4 @@
|
||||
/obj/machinery/door/window/brigdoor/southright
|
||||
dir = SOUTH
|
||||
icon_state = "rightsecure"
|
||||
base_state = "rightsecure"
|
||||
base_state = "rightsecure"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/obj/machinery/embedded_controller/radio/airlock/advanced_airlock_controller
|
||||
name = "Advanced Airlock Controller"
|
||||
|
||||
/obj/machinery/embedded_controller/radio/airlock/advanced_airlock_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/airlock/advanced_airlock_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
@@ -29,7 +29,7 @@
|
||||
"secure" = program.memory["secure"]
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "advanced_airlock_console.tmpl", name, 470, 290)
|
||||
@@ -75,7 +75,7 @@
|
||||
name = "Airlock Controller"
|
||||
tag_secure = 1
|
||||
|
||||
/obj/machinery/embedded_controller/radio/airlock/airlock_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/airlock/airlock_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
@@ -85,7 +85,7 @@
|
||||
"processing" = program.memory["processing"],
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "simple_airlock_console.tmpl", name, 470, 290)
|
||||
@@ -140,7 +140,7 @@
|
||||
else
|
||||
icon_state = "access_control_off"
|
||||
|
||||
/obj/machinery/embedded_controller/radio/airlock/access_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/airlock/access_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
@@ -149,7 +149,7 @@
|
||||
"processing" = program.memory["processing"]
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "door_access_console.tmpl", name, 330, 220)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
docking_program = new/datum/computer/file/embedded_program/docking/airlock(src, airlock_program)
|
||||
program = docking_program
|
||||
|
||||
/obj/machinery/embedded_controller/radio/airlock/docking_port/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/airlock/docking_port/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
@@ -24,7 +24,7 @@
|
||||
"override_enabled" = docking_program.override_enabled,
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "docking_airlock_console.tmpl", name, 470, 290)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
child_names[tags[i]] = names[i]
|
||||
|
||||
|
||||
/obj/machinery/embedded_controller/radio/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
var/list/airlocks[child_names.len]
|
||||
@@ -35,7 +35,7 @@
|
||||
"airlocks" = airlocks,
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "multi_docking_console.tmpl", name, 470, 290)
|
||||
@@ -60,7 +60,7 @@
|
||||
airlock_program = new/datum/computer/file/embedded_program/airlock/multi_docking(src)
|
||||
program = airlock_program
|
||||
|
||||
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
@@ -73,7 +73,7 @@
|
||||
"override_enabled" = airlock_program.override_enabled,
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "docking_airlock_console.tmpl", name, 470, 290)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
name = "escape pod controller"
|
||||
var/datum/shuttle/ferry/escape_pod/pod
|
||||
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
@@ -15,7 +15,7 @@
|
||||
"is_armed" = pod.arming_controller.armed,
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "escape_pod_console.tmpl", name, 470, 290)
|
||||
@@ -45,7 +45,7 @@
|
||||
docking_program = new/datum/computer/file/embedded_program/docking/simple/escape_pod(src)
|
||||
program = docking_program
|
||||
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod_berth/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod_berth/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
var/armed = null
|
||||
@@ -59,7 +59,7 @@
|
||||
"armed" = armed,
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "escape_pod_berth_console.tmpl", name, 470, 290)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
docking_program = new/datum/computer/file/embedded_program/docking/simple(src)
|
||||
program = docking_program
|
||||
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
|
||||
data = list(
|
||||
@@ -19,7 +19,7 @@
|
||||
"door_lock" = docking_program.memory["door_status"]["lock"],
|
||||
)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "simple_docking_console.tmpl", name, 470, 290)
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
* SmartFridge Menu
|
||||
********************/
|
||||
|
||||
/obj/machinery/smartfridge/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/smartfridge/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
user.set_machine(src)
|
||||
|
||||
var/is_secure = istype(src,/obj/machinery/smartfridge/secure)
|
||||
@@ -269,7 +269,7 @@
|
||||
if (vendor_wires.len > 0)
|
||||
data["wires"] = vendor_wires
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "smartfridge.tmpl", src.name, 400, 500)
|
||||
ui.set_initial_data(data)
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
|
||||
if("/turf/simulated/floor", "/turf/simulated/floor/engine")
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/turf_total = environment.total_moles()
|
||||
var/turf_total = environment.total_moles
|
||||
var/t1 = turf_total / MOLES_CELLSTANDARD * 175
|
||||
|
||||
if(t1<=100)
|
||||
|
||||
@@ -52,7 +52,7 @@ Buildable meters
|
||||
if (make_from)
|
||||
src.dir = make_from.dir
|
||||
src.pipename = make_from.name
|
||||
color = make_from.color
|
||||
color = make_from.pipe_color
|
||||
var/is_bent
|
||||
if (make_from.initialize_directions in list(NORTH|SOUTH, WEST|EAST))
|
||||
is_bent = 0
|
||||
@@ -324,12 +324,12 @@ Buildable meters
|
||||
return 1
|
||||
// no conflicts found
|
||||
|
||||
var/pipefailtext = "\red There's nothing to connect this pipe section to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
var/pipefailtext = "\red There's nothing to connect this pipe section to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
|
||||
switch(pipe_type)
|
||||
if(PIPE_SIMPLE_STRAIGHT, PIPE_SIMPLE_BENT)
|
||||
var/obj/machinery/atmospherics/pipe/simple/P = new( src.loc )
|
||||
P.color = color
|
||||
P.pipe_color = color
|
||||
P.dir = src.dir
|
||||
P.initialize_directions = pipe_dir
|
||||
var/turf/T = P.loc
|
||||
@@ -382,7 +382,7 @@ Buildable meters
|
||||
|
||||
if(PIPE_MANIFOLD) //manifold
|
||||
var/obj/machinery/atmospherics/pipe/manifold/M = new( src.loc )
|
||||
M.color = color
|
||||
M.pipe_color = color
|
||||
M.dir = dir
|
||||
M.initialize_directions = pipe_dir
|
||||
//M.New()
|
||||
@@ -390,7 +390,7 @@ Buildable meters
|
||||
M.level = T.intact ? 2 : 1
|
||||
M.initialize()
|
||||
if (!M)
|
||||
usr << "There's nothing to connect this manifold to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
usr << "There's nothing to connect this manifold to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
return 1
|
||||
M.build_network()
|
||||
if (M.node1)
|
||||
@@ -405,7 +405,7 @@ Buildable meters
|
||||
|
||||
if(PIPE_MANIFOLD4W) //4-way manifold
|
||||
var/obj/machinery/atmospherics/pipe/manifold4w/M = new( src.loc )
|
||||
M.color = color
|
||||
M.pipe_color = color
|
||||
M.dir = dir
|
||||
M.initialize_directions = pipe_dir
|
||||
//M.New()
|
||||
@@ -413,7 +413,7 @@ Buildable meters
|
||||
M.level = T.intact ? 2 : 1
|
||||
M.initialize()
|
||||
if (!M)
|
||||
usr << "There's nothing to connect this manifold to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
usr << "There's nothing to connect this manifold to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
return 1
|
||||
M.build_network()
|
||||
if (M.node1)
|
||||
@@ -438,7 +438,7 @@ Buildable meters
|
||||
//P.level = T.intact ? 2 : 1
|
||||
P.initialize()
|
||||
if (!P)
|
||||
usr << "There's nothing to connect this pipe to!" //(with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
usr << pipefailtext //"There's nothing to connect this pipe to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)"
|
||||
return 1
|
||||
P.build_network()
|
||||
if (P.node1)
|
||||
@@ -709,7 +709,7 @@ Buildable meters
|
||||
C.node.initialize()
|
||||
C.node.build_network()
|
||||
///// Z-Level stuff
|
||||
if(PIPE_UP) //volume pump
|
||||
if(PIPE_UP)
|
||||
var/obj/machinery/atmospherics/pipe/zpipe/up/P = new(src.loc)
|
||||
P.dir = dir
|
||||
P.initialize_directions = pipe_dir
|
||||
@@ -725,7 +725,7 @@ Buildable meters
|
||||
if (P.node2)
|
||||
P.node2.initialize()
|
||||
P.node2.build_network()
|
||||
if(PIPE_DOWN) //volume pump
|
||||
if(PIPE_DOWN)
|
||||
var/obj/machinery/atmospherics/pipe/zpipe/down/P = new(src.loc)
|
||||
P.dir = dir
|
||||
P.initialize_directions = pipe_dir
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
|
||||
/*
|
||||
//Allow you to push disposal pipes into it (for those with density 1)
|
||||
/obj/machinery/pipedispenser/disposal/HasEntered(var/obj/structure/disposalconstruct/pipe as obj)
|
||||
/obj/machinery/pipedispenser/disposal/Crossed(var/obj/structure/disposalconstruct/pipe as obj)
|
||||
if(istype(pipe) && !pipe.anchored)
|
||||
del(pipe)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ obj/machinery/recharger/attackby(obj/item/weapon/G as obj, mob/user as mob)
|
||||
if(!isarea(a))
|
||||
user << "\red The [name] blinks red as you try to insert the item!"
|
||||
return
|
||||
if(a.power_equip == 0)
|
||||
if(a.power_equip == 0 && !a.unlimited_power)
|
||||
user << "\red The [name] blinks red as you try to insert the item!"
|
||||
return
|
||||
|
||||
@@ -57,7 +57,7 @@ obj/machinery/recharger/attack_hand(mob/user as mob)
|
||||
|
||||
if(charging)
|
||||
charging.update_icon()
|
||||
charging.loc = loc
|
||||
user.put_in_hands(charging)
|
||||
charging = null
|
||||
use_power = 1
|
||||
update_icon()
|
||||
|
||||
+201
-201
@@ -1,202 +1,202 @@
|
||||
/obj/machinery/space_heater
|
||||
anchored = 0
|
||||
density = 1
|
||||
icon = 'icons/obj/atmos.dmi'
|
||||
icon_state = "sheater0"
|
||||
name = "space heater"
|
||||
desc = "Made by Space Amish using traditional space techniques, this heater is guaranteed not to set the station on fire."
|
||||
var/obj/item/weapon/cell/cell
|
||||
var/on = 0
|
||||
var/open = 0
|
||||
var/set_temperature = 50 // in celcius, add T0C for kelvin
|
||||
var/heating_power = 40000
|
||||
|
||||
flags = FPRINT
|
||||
|
||||
|
||||
New()
|
||||
..()
|
||||
cell = new(src)
|
||||
cell.charge = 1000
|
||||
cell.maxcharge = 1000
|
||||
update_icon()
|
||||
return
|
||||
|
||||
update_icon()
|
||||
overlays.Cut()
|
||||
icon_state = "sheater[on]"
|
||||
if(open)
|
||||
overlays += "sheater-open"
|
||||
return
|
||||
|
||||
examine()
|
||||
set src in oview(12)
|
||||
if (!( usr ))
|
||||
return
|
||||
usr << "This is \icon[src] \an [src.name]."
|
||||
usr << src.desc
|
||||
|
||||
usr << "The heater is [on ? "on" : "off"] and the hatch is [open ? "open" : "closed"]."
|
||||
if(open)
|
||||
usr << "The power cell is [cell ? "installed" : "missing"]."
|
||||
else
|
||||
usr << "The charge meter reads [cell ? round(cell.percent(),1) : 0]%"
|
||||
return
|
||||
|
||||
emp_act(severity)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
..(severity)
|
||||
return
|
||||
if(cell)
|
||||
cell.emp_act(severity)
|
||||
..(severity)
|
||||
|
||||
attackby(obj/item/I, mob/user)
|
||||
if(istype(I, /obj/item/weapon/cell))
|
||||
if(open)
|
||||
if(cell)
|
||||
user << "There is already a power cell inside."
|
||||
return
|
||||
else
|
||||
// insert cell
|
||||
var/obj/item/weapon/cell/C = usr.get_active_hand()
|
||||
if(istype(C))
|
||||
user.drop_item()
|
||||
cell = C
|
||||
C.loc = src
|
||||
C.add_fingerprint(usr)
|
||||
|
||||
user.visible_message("\blue [user] inserts a power cell into [src].", "\blue You insert the power cell into [src].")
|
||||
else
|
||||
user << "The hatch must be open to insert a power cell."
|
||||
return
|
||||
else if(istype(I, /obj/item/weapon/screwdriver))
|
||||
open = !open
|
||||
user.visible_message("\blue [user] [open ? "opens" : "closes"] the hatch on the [src].", "\blue You [open ? "open" : "close"] the hatch on the [src].")
|
||||
update_icon()
|
||||
if(!open && user.machine == src)
|
||||
user << browse(null, "window=spaceheater")
|
||||
user.unset_machine()
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
interact(user)
|
||||
|
||||
interact(mob/user as mob)
|
||||
|
||||
if(open)
|
||||
|
||||
var/dat
|
||||
dat = "Power cell: "
|
||||
if(cell)
|
||||
dat += "<A href='byond://?src=\ref[src];op=cellremove'>Installed</A><BR>"
|
||||
else
|
||||
dat += "<A href='byond://?src=\ref[src];op=cellinstall'>Removed</A><BR>"
|
||||
|
||||
dat += "Power Level: [cell ? round(cell.percent(),1) : 0]%<BR><BR>"
|
||||
|
||||
dat += "Set Temperature: "
|
||||
|
||||
dat += "<A href='?src=\ref[src];op=temp;val=-5'>-</A>"
|
||||
|
||||
dat += " [set_temperature]°C "
|
||||
dat += "<A href='?src=\ref[src];op=temp;val=5'>+</A><BR>"
|
||||
|
||||
user.set_machine(src)
|
||||
user << browse("<HEAD><TITLE>Space Heater Control Panel</TITLE></HEAD><TT>[dat]</TT>", "window=spaceheater")
|
||||
onclose(user, "spaceheater")
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
on = !on
|
||||
user.visible_message("\blue [user] switches [on ? "on" : "off"] the [src].","\blue You switch [on ? "on" : "off"] the [src].")
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
Topic(href, href_list)
|
||||
if (usr.stat)
|
||||
return
|
||||
if ((in_range(src, usr) && istype(src.loc, /turf)) || (istype(usr, /mob/living/silicon)))
|
||||
usr.set_machine(src)
|
||||
|
||||
switch(href_list["op"])
|
||||
|
||||
if("temp")
|
||||
var/value = text2num(href_list["val"])
|
||||
|
||||
// limit to 20-90 degC
|
||||
set_temperature = dd_range(0, 90, set_temperature + value)
|
||||
|
||||
if("cellremove")
|
||||
if(open && cell && !usr.get_active_hand())
|
||||
cell.updateicon()
|
||||
usr.put_in_hands(cell)
|
||||
cell.add_fingerprint(usr)
|
||||
cell = null
|
||||
usr.visible_message("\blue [usr] removes the power cell from \the [src].", "\blue You remove the power cell from \the [src].")
|
||||
|
||||
|
||||
if("cellinstall")
|
||||
if(open && !cell)
|
||||
var/obj/item/weapon/cell/C = usr.get_active_hand()
|
||||
if(istype(C))
|
||||
usr.drop_item()
|
||||
cell = C
|
||||
C.loc = src
|
||||
C.add_fingerprint(usr)
|
||||
|
||||
usr.visible_message("\blue [usr] inserts a power cell into \the [src].", "\blue You insert the power cell into \the [src].")
|
||||
|
||||
updateDialog()
|
||||
else
|
||||
usr << browse(null, "window=spaceheater")
|
||||
usr.unset_machine()
|
||||
return
|
||||
|
||||
|
||||
|
||||
process()
|
||||
if(on)
|
||||
if(cell && cell.charge > 0)
|
||||
|
||||
var/turf/simulated/L = loc
|
||||
if(istype(L))
|
||||
var/datum/gas_mixture/env = L.return_air()
|
||||
if(env.temperature != set_temperature + T0C)
|
||||
|
||||
var/transfer_moles = 0.25 * env.total_moles()
|
||||
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
|
||||
//world << "got [transfer_moles] moles at [removed.temperature]"
|
||||
|
||||
if(removed)
|
||||
|
||||
var/heat_capacity = removed.heat_capacity()
|
||||
//world << "heating ([heat_capacity])"
|
||||
if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
||||
if(removed.temperature < set_temperature + T0C)
|
||||
removed.temperature = min(removed.temperature + heating_power/heat_capacity, 1000) // Added min() check to try and avoid wacky superheating issues in low gas scenarios -- TLE
|
||||
else
|
||||
removed.temperature = max(removed.temperature - heating_power/heat_capacity, TCMB)
|
||||
cell.use(heating_power/20000)
|
||||
|
||||
//world << "now at [removed.temperature]"
|
||||
|
||||
env.merge(removed)
|
||||
|
||||
//world << "turf now at [env.temperature]"
|
||||
|
||||
|
||||
else
|
||||
on = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/space_heater
|
||||
anchored = 0
|
||||
density = 1
|
||||
icon = 'icons/obj/atmos.dmi'
|
||||
icon_state = "sheater0"
|
||||
name = "space heater"
|
||||
desc = "Made by Space Amish using traditional space techniques, this heater is guaranteed not to set the station on fire."
|
||||
var/obj/item/weapon/cell/cell
|
||||
var/on = 0
|
||||
var/open = 0
|
||||
var/set_temperature = 50 // in celcius, add T0C for kelvin
|
||||
var/heating_power = 40000
|
||||
|
||||
flags = FPRINT
|
||||
|
||||
|
||||
New()
|
||||
..()
|
||||
cell = new(src)
|
||||
cell.charge = 1000
|
||||
cell.maxcharge = 1000
|
||||
update_icon()
|
||||
return
|
||||
|
||||
update_icon()
|
||||
overlays.Cut()
|
||||
icon_state = "sheater[on]"
|
||||
if(open)
|
||||
overlays += "sheater-open"
|
||||
return
|
||||
|
||||
examine()
|
||||
set src in oview(12)
|
||||
if (!( usr ))
|
||||
return
|
||||
usr << "This is \icon[src] \an [src.name]."
|
||||
usr << src.desc
|
||||
|
||||
usr << "The heater is [on ? "on" : "off"] and the hatch is [open ? "open" : "closed"]."
|
||||
if(open)
|
||||
usr << "The power cell is [cell ? "installed" : "missing"]."
|
||||
else
|
||||
usr << "The charge meter reads [cell ? round(cell.percent(),1) : 0]%"
|
||||
return
|
||||
|
||||
emp_act(severity)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
..(severity)
|
||||
return
|
||||
if(cell)
|
||||
cell.emp_act(severity)
|
||||
..(severity)
|
||||
|
||||
attackby(obj/item/I, mob/user)
|
||||
if(istype(I, /obj/item/weapon/cell))
|
||||
if(open)
|
||||
if(cell)
|
||||
user << "There is already a power cell inside."
|
||||
return
|
||||
else
|
||||
// insert cell
|
||||
var/obj/item/weapon/cell/C = usr.get_active_hand()
|
||||
if(istype(C))
|
||||
user.drop_item()
|
||||
cell = C
|
||||
C.loc = src
|
||||
C.add_fingerprint(usr)
|
||||
|
||||
user.visible_message("\blue [user] inserts a power cell into [src].", "\blue You insert the power cell into [src].")
|
||||
else
|
||||
user << "The hatch must be open to insert a power cell."
|
||||
return
|
||||
else if(istype(I, /obj/item/weapon/screwdriver))
|
||||
open = !open
|
||||
user.visible_message("\blue [user] [open ? "opens" : "closes"] the hatch on the [src].", "\blue You [open ? "open" : "close"] the hatch on the [src].")
|
||||
update_icon()
|
||||
if(!open && user.machine == src)
|
||||
user << browse(null, "window=spaceheater")
|
||||
user.unset_machine()
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
src.add_fingerprint(user)
|
||||
interact(user)
|
||||
|
||||
interact(mob/user as mob)
|
||||
|
||||
if(open)
|
||||
|
||||
var/dat
|
||||
dat = "Power cell: "
|
||||
if(cell)
|
||||
dat += "<A href='byond://?src=\ref[src];op=cellremove'>Installed</A><BR>"
|
||||
else
|
||||
dat += "<A href='byond://?src=\ref[src];op=cellinstall'>Removed</A><BR>"
|
||||
|
||||
dat += "Power Level: [cell ? round(cell.percent(),1) : 0]%<BR><BR>"
|
||||
|
||||
dat += "Set Temperature: "
|
||||
|
||||
dat += "<A href='?src=\ref[src];op=temp;val=-5'>-</A>"
|
||||
|
||||
dat += " [set_temperature]°C "
|
||||
dat += "<A href='?src=\ref[src];op=temp;val=5'>+</A><BR>"
|
||||
|
||||
user.set_machine(src)
|
||||
user << browse("<HEAD><TITLE>Space Heater Control Panel</TITLE></HEAD><TT>[dat]</TT>", "window=spaceheater")
|
||||
onclose(user, "spaceheater")
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
on = !on
|
||||
user.visible_message("\blue [user] switches [on ? "on" : "off"] the [src].","\blue You switch [on ? "on" : "off"] the [src].")
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
Topic(href, href_list)
|
||||
if (usr.stat)
|
||||
return
|
||||
if ((in_range(src, usr) && istype(src.loc, /turf)) || (istype(usr, /mob/living/silicon)))
|
||||
usr.set_machine(src)
|
||||
|
||||
switch(href_list["op"])
|
||||
|
||||
if("temp")
|
||||
var/value = text2num(href_list["val"])
|
||||
|
||||
// limit to 20-90 degC
|
||||
set_temperature = dd_range(0, 90, set_temperature + value)
|
||||
|
||||
if("cellremove")
|
||||
if(open && cell && !usr.get_active_hand())
|
||||
cell.updateicon()
|
||||
usr.put_in_hands(cell)
|
||||
cell.add_fingerprint(usr)
|
||||
cell = null
|
||||
usr.visible_message("\blue [usr] removes the power cell from \the [src].", "\blue You remove the power cell from \the [src].")
|
||||
|
||||
|
||||
if("cellinstall")
|
||||
if(open && !cell)
|
||||
var/obj/item/weapon/cell/C = usr.get_active_hand()
|
||||
if(istype(C))
|
||||
usr.drop_item()
|
||||
cell = C
|
||||
C.loc = src
|
||||
C.add_fingerprint(usr)
|
||||
|
||||
usr.visible_message("\blue [usr] inserts a power cell into \the [src].", "\blue You insert the power cell into \the [src].")
|
||||
|
||||
updateDialog()
|
||||
else
|
||||
usr << browse(null, "window=spaceheater")
|
||||
usr.unset_machine()
|
||||
return
|
||||
|
||||
|
||||
|
||||
process()
|
||||
if(on)
|
||||
if(cell && cell.charge > 0)
|
||||
|
||||
var/turf/simulated/L = loc
|
||||
if(istype(L))
|
||||
var/datum/gas_mixture/env = L.return_air()
|
||||
if(env.temperature != set_temperature + T0C)
|
||||
|
||||
var/transfer_moles = 0.25 * env.total_moles
|
||||
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
|
||||
//world << "got [transfer_moles] moles at [removed.temperature]"
|
||||
|
||||
if(removed)
|
||||
|
||||
var/heat_capacity = removed.heat_capacity()
|
||||
//world << "heating ([heat_capacity])"
|
||||
if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
||||
if(removed.temperature < set_temperature + T0C)
|
||||
removed.temperature = min(removed.temperature + heating_power/heat_capacity, 1000) // Added min() check to try and avoid wacky superheating issues in low gas scenarios -- TLE
|
||||
else
|
||||
removed.temperature = max(removed.temperature - heating_power/heat_capacity, TCMB)
|
||||
cell.use(heating_power/20000)
|
||||
|
||||
//world << "now at [removed.temperature]"
|
||||
|
||||
env.merge(removed)
|
||||
|
||||
//world << "turf now at [env.temperature]"
|
||||
|
||||
|
||||
else
|
||||
on = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
return
|
||||
@@ -21,6 +21,19 @@
|
||||
if(istype(P, /obj/item/device/multitool))
|
||||
attack_hand(user)
|
||||
|
||||
|
||||
// REPAIRING: Use Nanopaste to repair 10-20 integrity points.
|
||||
if(istype(P, /obj/item/stack/nanopaste))
|
||||
var/obj/item/stack/nanopaste/T = P
|
||||
if (integrity < 100) //Damaged, let's repair!
|
||||
integrity = between(0, integrity + rand(10,20), 100)
|
||||
T.use(1)
|
||||
usr << "You apply the Nanopaste to [src], repairing some of the damage."
|
||||
else
|
||||
usr << "This machine is already in perfect condition."
|
||||
return
|
||||
|
||||
|
||||
switch(construct_op)
|
||||
if(0)
|
||||
if(istype(P, /obj/item/weapon/screwdriver))
|
||||
|
||||
@@ -214,11 +214,20 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
|
||||
/obj/machinery/telecomms/proc/checkheat()
|
||||
// Checks heat from the environment and applies any integrity damage
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/damage_chance = 0 // Percent based chance of applying 1 integrity damage this tick
|
||||
switch(environment.temperature)
|
||||
if(T0C to (T20C + 20))
|
||||
integrity = between(0, integrity, 100)
|
||||
if((T20C + 20) to (T0C + 70))
|
||||
integrity = max(0, integrity - 1)
|
||||
if((T0C + 40) to (T0C + 70)) // 40C-70C, minor overheat, 10% chance of taking damage
|
||||
damage_chance = 10
|
||||
if((T0C + 70) to (T0C + 130)) // 70C-130C, major overheat, 25% chance of taking damage
|
||||
damage_chance = 25
|
||||
if((T0C + 130) to (T0C + 200)) // 130C-200C, dangerous overheat, 50% chance of taking damage
|
||||
damage_chance = 50
|
||||
if((T0C + 200) to INFINITY) // More than 200C, INFERNO. Takes damage every tick.
|
||||
damage_chance = 100
|
||||
if (damage_chance && prob(damage_chance))
|
||||
integrity = between(0, integrity - 1, 100)
|
||||
|
||||
|
||||
if(delay)
|
||||
delay--
|
||||
else
|
||||
@@ -237,7 +246,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
|
||||
var/datum/gas_mixture/env = L.return_air()
|
||||
if(env.temperature < (heat_amt+T0C))
|
||||
|
||||
var/transfer_moles = 0.25 * env.total_moles()
|
||||
var/transfer_moles = 0.25 * env.total_moles
|
||||
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
|
||||
|
||||
@@ -924,13 +924,11 @@
|
||||
return
|
||||
var/datum/gas_mixture/GM = new
|
||||
if(prob(10))
|
||||
GM.phoron += 100
|
||||
GM.temperature = 1500+T0C //should be enough to start a fire
|
||||
T.assume_gas("phoron", 100, 1500+T0C)
|
||||
T.visible_message("The [src] suddenly disgorges a cloud of heated phoron.")
|
||||
destroy()
|
||||
else
|
||||
GM.phoron += 5
|
||||
GM.temperature = istype(T) ? T.air.temperature : T20C
|
||||
T.assume_gas("phoron", 5, istype(T) ? T.air.temperature : T20C)
|
||||
T.visible_message("The [src] suddenly disgorges a cloud of phoron.")
|
||||
T.assume_air(GM)
|
||||
return
|
||||
|
||||
+13
-14
@@ -123,8 +123,7 @@
|
||||
cabin_air = new
|
||||
cabin_air.temperature = T20C
|
||||
cabin_air.volume = 200
|
||||
cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
cabin_air.adjust_multi("oxygen", O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature), "nitrogen", N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
|
||||
return cabin_air
|
||||
|
||||
/obj/mecha/proc/add_radio()
|
||||
@@ -332,7 +331,7 @@
|
||||
var/obj/O = obstacle
|
||||
if(istype(O, /obj/effect/portal)) //derpfix
|
||||
src.anchored = 0
|
||||
O.HasEntered(src)
|
||||
O.Crossed(src)
|
||||
spawn(0)//countering portal teleport spawn(0), hurr
|
||||
src.anchored = 1
|
||||
else if(!O.anchored)
|
||||
@@ -855,11 +854,11 @@
|
||||
/obj/mecha/proc/return_temperature()
|
||||
. = 0
|
||||
if(use_internal_tank)
|
||||
. = cabin_air.return_temperature()
|
||||
. = cabin_air.temperature
|
||||
else
|
||||
var/datum/gas_mixture/t_air = get_turf_air()
|
||||
if(t_air)
|
||||
. = t_air.return_temperature()
|
||||
. = t_air.temperature
|
||||
return
|
||||
|
||||
/obj/mecha/proc/connect(obj/machinery/atmospherics/portables_connector/new_port)
|
||||
@@ -1705,7 +1704,7 @@
|
||||
delay = 20
|
||||
|
||||
process(var/obj/mecha/mecha)
|
||||
if(mecha.cabin_air && mecha.cabin_air.return_volume() > 0)
|
||||
if(mecha.cabin_air && mecha.cabin_air.volume > 0)
|
||||
var/delta = mecha.cabin_air.temperature - T20C
|
||||
mecha.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
|
||||
return
|
||||
@@ -1723,8 +1722,8 @@
|
||||
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2)
|
||||
var/transfer_moles = 0
|
||||
if(pressure_delta > 0) //cabin pressure lower than release pressure
|
||||
if(tank_air.return_temperature() > 0)
|
||||
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
if(tank_air.temperature > 0)
|
||||
transfer_moles = pressure_delta*cabin_air.volume/(cabin_air.temperature * R_IDEAL_GAS_EQUATION)
|
||||
var/datum/gas_mixture/removed = tank_air.remove(transfer_moles)
|
||||
cabin_air.merge(removed)
|
||||
else if(pressure_delta < 0) //cabin pressure higher than release pressure
|
||||
@@ -1733,7 +1732,7 @@
|
||||
if(t_air)
|
||||
pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta)
|
||||
if(pressure_delta > 0) //if location pressure is lower than cabin pressure
|
||||
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
|
||||
transfer_moles = pressure_delta*cabin_air.volume/(cabin_air.temperature * R_IDEAL_GAS_EQUATION)
|
||||
var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles)
|
||||
if(t_air)
|
||||
t_air.merge(removed)
|
||||
@@ -1766,12 +1765,12 @@
|
||||
if(mecha.internal_tank.return_pressure()>mecha.internal_tank.maximum_pressure && !(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)))
|
||||
mecha.setInternalDamage(MECHA_INT_TANK_BREACH)
|
||||
var/datum/gas_mixture/int_tank_air = mecha.internal_tank.return_air()
|
||||
if(int_tank_air && int_tank_air.return_volume()>0) //heat the air_contents
|
||||
if(int_tank_air && int_tank_air.volume>0) //heat the air_contents
|
||||
int_tank_air.temperature = min(6000+T0C, int_tank_air.temperature+rand(10,15))
|
||||
if(mecha.cabin_air && mecha.cabin_air.return_volume()>0)
|
||||
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.return_temperature()+rand(10,15))
|
||||
if(mecha.cabin_air.return_temperature()>mecha.max_temperature/2)
|
||||
mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.return_temperature(),0.1),"fire")
|
||||
if(mecha.cabin_air && mecha.cabin_air.volume>0)
|
||||
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.temperature+rand(10,15))
|
||||
if(mecha.cabin_air.temperature>mecha.max_temperature/2)
|
||||
mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.temperature,0.1),"fire")
|
||||
if(mecha.hasInternalDamage(MECHA_INT_TEMP_CONTROL)) //stop the mecha_preserve_temp loop datum
|
||||
mecha.pr_int_temp_processor.stop()
|
||||
if(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)) //remove some air from internal tank
|
||||
|
||||
@@ -45,7 +45,7 @@ var/global/list/image/splatter_cache=list()
|
||||
if(basecolor == "rainbow") basecolor = "#[pick(list("FF0000","FF7F00","FFFF00","00FF00","0000FF","4B0082","8F00FF"))]"
|
||||
color = basecolor
|
||||
|
||||
/obj/effect/decal/cleanable/blood/HasEntered(mob/living/carbon/human/perp)
|
||||
/obj/effect/decal/cleanable/blood/Crossed(mob/living/carbon/human/perp)
|
||||
if (!istype(perp))
|
||||
return
|
||||
if(amount < 1)
|
||||
|
||||
@@ -216,7 +216,7 @@ steam.start() -- spawns the effect
|
||||
delete()
|
||||
return
|
||||
|
||||
/obj/effect/effect/smoke/HasEntered(mob/living/carbon/M as mob )
|
||||
/obj/effect/effect/smoke/Crossed(mob/living/carbon/M as mob )
|
||||
..()
|
||||
if(istype(M))
|
||||
affect(M)
|
||||
@@ -549,7 +549,7 @@ steam.start() -- spawns the effect
|
||||
delete()
|
||||
|
||||
|
||||
/obj/effect/effect/foam/HasEntered(var/atom/movable/AM)
|
||||
/obj/effect/effect/foam/Crossed(var/atom/movable/AM)
|
||||
if(metal)
|
||||
return
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
icon_state = "glowshroomf"
|
||||
layer = 2.1
|
||||
l_color = "#003300"
|
||||
|
||||
var/endurance = 30
|
||||
var/potency = 30
|
||||
var/delay = 1200
|
||||
@@ -44,7 +46,7 @@
|
||||
|
||||
processing_objects += src
|
||||
|
||||
SetLuminosity(round(potency/10))
|
||||
SetLuminosity(round(potency/15))
|
||||
lastTick = world.timeofday
|
||||
|
||||
/obj/effect/glowshroom/Del()
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
/obj/effect/mine/New()
|
||||
icon_state = "uglyminearmed"
|
||||
|
||||
/obj/effect/mine/HasEntered(AM as mob|obj)
|
||||
/obj/effect/mine/Crossed(AM as mob|obj)
|
||||
Bumped(AM)
|
||||
|
||||
/obj/effect/mine/Bumped(mob/M as mob|obj)
|
||||
@@ -51,14 +51,7 @@
|
||||
|
||||
for (var/turf/simulated/floor/target in range(1,src))
|
||||
if(!target.blocks_air)
|
||||
|
||||
var/datum/gas_mixture/payload = new
|
||||
var/datum/gas/sleeping_agent/trace_gas = new
|
||||
|
||||
trace_gas.moles = 30
|
||||
payload += trace_gas
|
||||
|
||||
target.zone.air.merge(payload)
|
||||
target.assume_gas("sleeping_agent", 30)
|
||||
|
||||
spawn(0)
|
||||
del(src)
|
||||
@@ -66,12 +59,7 @@
|
||||
/obj/effect/mine/proc/triggerphoron(obj)
|
||||
for (var/turf/simulated/floor/target in range(1,src))
|
||||
if(!target.blocks_air)
|
||||
|
||||
var/datum/gas_mixture/payload = new
|
||||
|
||||
payload.phoron = 30
|
||||
|
||||
target.zone.air.merge(payload)
|
||||
target.assume_gas("phoron", 30)
|
||||
|
||||
target.hotspot_expose(1000, CELL_VOLUME)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user