mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Fixes any transformation getting people stuck as contents during transformation.
Span class fixes for all of atmospherics files. Calls new ..() for dice, adds minsides for admins to play with Fixes bug where people would magically change the size of objects using wrapping paper
This commit is contained in:
@@ -104,25 +104,25 @@
|
||||
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/red))
|
||||
src._color = "red"
|
||||
src.color = PIPE_COLOR_RED
|
||||
user << "\red You paint the pipe red."
|
||||
user << "<span class='warning'>You paint the pipe red.</span>"
|
||||
update_icon()
|
||||
return 1
|
||||
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/blue))
|
||||
src._color = "blue"
|
||||
src.color = PIPE_COLOR_BLUE
|
||||
user << "\red You paint the pipe blue."
|
||||
user << "<span class='warning'>You paint the pipe blue.</span>"
|
||||
update_icon()
|
||||
return 1
|
||||
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/green))
|
||||
src._color = "green"
|
||||
src.color = PIPE_COLOR_GREEN
|
||||
user << "\red You paint the pipe green."
|
||||
user << "<span class='warning'>You paint the pipe green.</span>"
|
||||
update_icon()
|
||||
return 1
|
||||
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/yellow))
|
||||
src._color = "yellow"
|
||||
src.color = PIPE_COLOR_YELLOW
|
||||
user << "\red You paint the pipe yellow."
|
||||
user << "<span class='warning'>You paint the pipe yellow.</span>"
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -12,31 +12,31 @@
|
||||
var/current_temperature = T20C
|
||||
var/current_heat_capacity = 50000 //totally random
|
||||
|
||||
update_icon()
|
||||
if(node)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
/obj/machinery/atmospherics/unary/cold_sink/update_icon()
|
||||
if(node)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
on = 0
|
||||
on = 0
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on || !network)
|
||||
return 0
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
/obj/machinery/atmospherics/unary/cold_sink/process()
|
||||
..()
|
||||
if(!on || !network)
|
||||
return 0
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
if(air_contents.temperature > current_temperature) //if it's hotter than we can cool it, cool it
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
if(air_contents.temperature > current_temperature) //if it's hotter than we can cool it, cool it
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
|
||||
//todo: have current temperature affected. require power to bring down current temperature again
|
||||
//todo: have current temperature affected. require power to bring down current temperature again
|
||||
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
network.update = 1
|
||||
return 1
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
network.update = 1
|
||||
return 1
|
||||
@@ -10,60 +10,57 @@
|
||||
var/obj/machinery/atmospherics/unary/heat_exchanger/partner = null
|
||||
var/update_cycle
|
||||
|
||||
update_icon()
|
||||
if(node)
|
||||
icon_state = "intact"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger/update_icon()
|
||||
if(node)
|
||||
icon_state = "intact"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
initialize()
|
||||
if(!partner)
|
||||
var/partner_connect = turn(dir,180)
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger/initialize()
|
||||
if(!partner)
|
||||
var/partner_connect = turn(dir,180)
|
||||
|
||||
for(var/obj/machinery/atmospherics/unary/heat_exchanger/target in get_step(src,partner_connect))
|
||||
if(target.dir & get_dir(src,target))
|
||||
partner = target
|
||||
partner.partner = src
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/unary/heat_exchanger/target in get_step(src,partner_connect))
|
||||
if(target.dir & get_dir(src,target))
|
||||
partner = target
|
||||
partner.partner = src
|
||||
break
|
||||
|
||||
..()
|
||||
..()
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!partner)
|
||||
return 0
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger/process()
|
||||
..()
|
||||
if(!partner)
|
||||
return 0
|
||||
|
||||
if(!air_master || air_master.current_cycle <= update_cycle)
|
||||
return 0
|
||||
if(!air_master || air_master.current_cycle <= update_cycle)
|
||||
return 0
|
||||
|
||||
update_cycle = air_master.current_cycle
|
||||
partner.update_cycle = air_master.current_cycle
|
||||
update_cycle = air_master.current_cycle
|
||||
partner.update_cycle = air_master.current_cycle
|
||||
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/other_air_heat_capacity = partner.air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/other_air_heat_capacity = partner.air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
|
||||
|
||||
var/old_temperature = air_contents.temperature
|
||||
var/other_old_temperature = partner.air_contents.temperature
|
||||
var/old_temperature = air_contents.temperature
|
||||
var/other_old_temperature = partner.air_contents.temperature
|
||||
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = partner.air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = partner.air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
|
||||
var/new_temperature = combined_energy/combined_heat_capacity
|
||||
air_contents.temperature = new_temperature
|
||||
partner.air_contents.temperature = new_temperature
|
||||
var/new_temperature = combined_energy/combined_heat_capacity
|
||||
air_contents.temperature = new_temperature
|
||||
partner.air_contents.temperature = new_temperature
|
||||
|
||||
if(network)
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
network.update = 1
|
||||
if(network)
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
network.update = 1
|
||||
|
||||
if(partner.network)
|
||||
if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
|
||||
partner.network.update = 1
|
||||
if(partner.network)
|
||||
if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
|
||||
partner.network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
return ..()
|
||||
return 1
|
||||
|
||||
@@ -14,31 +14,31 @@
|
||||
var/current_temperature = T20C
|
||||
var/current_heat_capacity = 50000 //totally random
|
||||
|
||||
update_icon()
|
||||
if(node)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/update_icon()
|
||||
if(node)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
on = 0
|
||||
on = 0
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
if(air_contents.temperature < current_temperature) //if its colder than we can heat it, heat it
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
if(air_contents.temperature < current_temperature) //if its colder than we can heat it, heat it
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
|
||||
//todo: have current temperature affected. require power to bring up current temperature again
|
||||
//todo: have current temperature affected. require power to bring up current temperature again
|
||||
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
network.update = 1
|
||||
return 1
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
network.update = 1
|
||||
return 1
|
||||
@@ -18,153 +18,152 @@
|
||||
|
||||
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"
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/update_icon()
|
||||
if(node)
|
||||
if(on && !(stat & NOPOWER))
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
on = 0
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
on = 0
|
||||
|
||||
return
|
||||
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_tag,
|
||||
"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_tag) || (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()
|
||||
return
|
||||
|
||||
if("set_volume_rate" in signal.data)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
volume_rate = Clamp(number, 0, 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
|
||||
|
||||
/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_tag,
|
||||
"device" = "AO",
|
||||
"power" = on,
|
||||
"volume_rate" = volume_rate,
|
||||
//"timestamp" = world.time,
|
||||
"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_tag) || (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()
|
||||
return
|
||||
|
||||
interact(mob/user as mob)
|
||||
update_multitool_menu(user)
|
||||
if("set_volume_rate" in signal.data)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
volume_rate = Clamp(number, 0, air_contents.volume)
|
||||
|
||||
multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
|
||||
</ul>
|
||||
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()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/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/interact(mob/user as mob)
|
||||
update_multitool_menu(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
interact(user)
|
||||
return 1
|
||||
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
|
||||
return ..()
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
interact(user)
|
||||
return 1
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>"
|
||||
return 1
|
||||
return ..()
|
||||
@@ -13,37 +13,37 @@ obj/machinery/atmospherics/unary/oxygen_generator
|
||||
|
||||
var/oxygen_content = 10
|
||||
|
||||
update_icon()
|
||||
if(node)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
icon_state = "exposed_off"
|
||||
obj/machinery/atmospherics/unary/oxygen_generator/update_icon()
|
||||
if(node)
|
||||
icon_state = "intact_[on?("on"):("off")]"
|
||||
else
|
||||
icon_state = "exposed_off"
|
||||
|
||||
on = 0
|
||||
on = 0
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
New()
|
||||
..()
|
||||
obj/machinery/atmospherics/unary/oxygen_generator/New()
|
||||
..()
|
||||
|
||||
air_contents.volume = 50
|
||||
air_contents.volume = 50
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
obj/machinery/atmospherics/unary/oxygen_generator/process()
|
||||
..()
|
||||
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()
|
||||
if(total_moles < oxygen_content)
|
||||
var/current_heat_capacity = air_contents.heat_capacity()
|
||||
|
||||
var/added_oxygen = oxygen_content - total_moles
|
||||
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.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
|
||||
air_contents.oxygen += added_oxygen
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
return 1
|
||||
@@ -12,75 +12,75 @@
|
||||
level = 0
|
||||
|
||||
|
||||
New()
|
||||
initialize_directions = dir
|
||||
..()
|
||||
/obj/machinery/atmospherics/unary/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/unary/portables_connector/update_icon()
|
||||
if(node)
|
||||
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
|
||||
dir = get_dir(src, node)
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/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"
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/process()
|
||||
..()
|
||||
if(!on)
|
||||
return
|
||||
if(!connected_device)
|
||||
on = 0
|
||||
return
|
||||
if(network)
|
||||
network.update = 1
|
||||
return 1
|
||||
|
||||
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"
|
||||
/obj/machinery/atmospherics/unary/portables_connector/Destroy()
|
||||
if(connected_device)
|
||||
connected_device.disconnect()
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!on)
|
||||
return
|
||||
if(!connected_device)
|
||||
on = 0
|
||||
return
|
||||
if(network)
|
||||
network.update = 1
|
||||
return 1
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
del(network)
|
||||
|
||||
Destroy()
|
||||
if(connected_device)
|
||||
connected_device.disconnect()
|
||||
node = null
|
||||
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
del(network)
|
||||
..()
|
||||
|
||||
node = null
|
||||
/obj/machinery/atmospherics/unary/portables_connector/return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
|
||||
..()
|
||||
if(reference==node)
|
||||
return network
|
||||
|
||||
return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
if(reference==connected_device)
|
||||
return network
|
||||
|
||||
if(reference==node)
|
||||
return network
|
||||
return null
|
||||
|
||||
if(reference==connected_device)
|
||||
return network
|
||||
/obj/machinery/atmospherics/unary/portables_connector/return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
return null
|
||||
if(connected_device)
|
||||
results += connected_device.air_contents
|
||||
|
||||
return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(connected_device)
|
||||
results += connected_device.air_contents
|
||||
|
||||
return results
|
||||
return results
|
||||
|
||||
|
||||
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
|
||||
/obj/machinery/atmospherics/unary/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 << "<span class='warning'>You cannot unwrench this [src], dettach [connected_device] first.</span>"
|
||||
return 1
|
||||
if (locate(/obj/machinery/portable_atmospherics, src.loc))
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
@@ -12,79 +12,79 @@
|
||||
name = "Thermal Transfer Plate"
|
||||
desc = "Transfers heat to and from an area"
|
||||
|
||||
update_icon()
|
||||
var/prefix=""
|
||||
//var/suffix="_idle" // Also available: _heat, _cool
|
||||
if(level == 1 && istype(loc, /turf/simulated))
|
||||
prefix="h"
|
||||
icon_state = "[prefix]off"
|
||||
/obj/machinery/atmospherics/unary/thermal_plate/update_icon()
|
||||
var/prefix=""
|
||||
//var/suffix="_idle" // Also available: _heat, _cool
|
||||
if(level == 1 && istype(loc, /turf/simulated))
|
||||
prefix="h"
|
||||
icon_state = "[prefix]off"
|
||||
|
||||
process()
|
||||
..()
|
||||
/obj/machinery/atmospherics/unary/thermal_plate/process()
|
||||
..()
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
//Get processable air sample and thermal info from environment
|
||||
//Get processable air sample and thermal info from environment
|
||||
|
||||
var/transfer_moles = 0.25 * environment.total_moles()
|
||||
var/datum/gas_mixture/external_removed = environment.remove(transfer_moles)
|
||||
var/transfer_moles = 0.25 * environment.total_moles()
|
||||
var/datum/gas_mixture/external_removed = environment.remove(transfer_moles)
|
||||
|
||||
if (!external_removed)
|
||||
return radiate()
|
||||
if (!external_removed)
|
||||
return radiate()
|
||||
|
||||
if (external_removed.total_moles() < 10)
|
||||
return radiate()
|
||||
if (external_removed.total_moles() < 10)
|
||||
return radiate()
|
||||
|
||||
//Get same info from connected gas
|
||||
//Get same info from connected gas
|
||||
|
||||
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
|
||||
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
|
||||
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
|
||||
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
|
||||
|
||||
if (!internal_removed)
|
||||
environment.merge(external_removed)
|
||||
return 1
|
||||
|
||||
var/combined_heat_capacity = internal_removed.heat_capacity() + external_removed.heat_capacity()
|
||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + external_removed.heat_capacity() * external_removed.temperature
|
||||
|
||||
if(!combined_heat_capacity) combined_heat_capacity = 1
|
||||
var/final_temperature = combined_energy / combined_heat_capacity
|
||||
|
||||
external_removed.temperature = final_temperature
|
||||
if (!internal_removed)
|
||||
environment.merge(external_removed)
|
||||
return 1
|
||||
|
||||
internal_removed.temperature = final_temperature
|
||||
air_contents.merge(internal_removed)
|
||||
var/combined_heat_capacity = internal_removed.heat_capacity() + external_removed.heat_capacity()
|
||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + external_removed.heat_capacity() * external_removed.temperature
|
||||
|
||||
if(!combined_heat_capacity) combined_heat_capacity = 1
|
||||
var/final_temperature = combined_energy / combined_heat_capacity
|
||||
|
||||
external_removed.temperature = final_temperature
|
||||
environment.merge(external_removed)
|
||||
|
||||
internal_removed.temperature = final_temperature
|
||||
air_contents.merge(internal_removed)
|
||||
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/thermal_plate/hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
var/prefix=""
|
||||
//var/suffix="_idle" // Also available: _heat, _cool
|
||||
if(i == 1 && istype(loc, /turf/simulated))
|
||||
prefix="h"
|
||||
icon_state = "[prefix]off"
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/thermal_plate/proc/radiate()
|
||||
|
||||
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
|
||||
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
|
||||
|
||||
if (!internal_removed)
|
||||
return 1
|
||||
|
||||
var/combined_heat_capacity = internal_removed.heat_capacity() + RADIATION_CAPACITY
|
||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + (RADIATION_CAPACITY * 6.4)
|
||||
|
||||
var/final_temperature = combined_energy / combined_heat_capacity
|
||||
|
||||
internal_removed.temperature = final_temperature
|
||||
air_contents.merge(internal_removed)
|
||||
|
||||
if (network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
var/prefix=""
|
||||
//var/suffix="_idle" // Also available: _heat, _cool
|
||||
if(i == 1 && istype(loc, /turf/simulated))
|
||||
prefix="h"
|
||||
icon_state = "[prefix]off"
|
||||
return
|
||||
|
||||
proc/radiate()
|
||||
|
||||
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
|
||||
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
|
||||
|
||||
if (!internal_removed)
|
||||
return 1
|
||||
|
||||
var/combined_heat_capacity = internal_removed.heat_capacity() + RADIATION_CAPACITY
|
||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + (RADIATION_CAPACITY * 6.4)
|
||||
|
||||
var/final_temperature = combined_energy / combined_heat_capacity
|
||||
|
||||
internal_removed.temperature = final_temperature
|
||||
air_contents.merge(internal_removed)
|
||||
|
||||
if (network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -4,98 +4,82 @@
|
||||
layer = 2.45 // Cable says we're at 2.45, so we're at 2.45. (old: TURF_LAYER+0.1)
|
||||
|
||||
var/datum/gas_mixture/air_contents
|
||||
|
||||
var/obj/machinery/atmospherics/node
|
||||
|
||||
var/datum/pipe_network/network
|
||||
|
||||
New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
air_contents = new
|
||||
/obj/machinery/atmospherics/unary/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
air_contents = new
|
||||
|
||||
air_contents.temperature = T0C
|
||||
air_contents.volume = starting_volume
|
||||
air_contents.temperature = T0C
|
||||
air_contents.volume = starting_volume
|
||||
|
||||
buildFrom(var/mob/usr,var/obj/item/pipe/pipe)
|
||||
dir = pipe.dir
|
||||
initialize_directions = pipe.get_pipe_dir()
|
||||
if (pipe.pipename)
|
||||
name = pipe.pipename
|
||||
var/turf/T = loc
|
||||
level = T.intact ? 2 : 1
|
||||
initialize()
|
||||
build_network()
|
||||
if (node)
|
||||
node.initialize()
|
||||
node.build_network()
|
||||
return 1
|
||||
/obj/machinery/atmospherics/unary/buildFrom(var/mob/usr,var/obj/item/pipe/pipe)
|
||||
dir = pipe.dir
|
||||
initialize_directions = pipe.get_pipe_dir()
|
||||
if (pipe.pipename)
|
||||
name = pipe.pipename
|
||||
var/turf/T = loc
|
||||
level = T.intact ? 2 : 1
|
||||
initialize()
|
||||
build_network()
|
||||
if (node)
|
||||
node.initialize()
|
||||
node.build_network()
|
||||
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/unary/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
|
||||
new_network.normal_members += src
|
||||
return null
|
||||
|
||||
if(new_network.normal_members.Find(src))
|
||||
return 0
|
||||
/obj/machinery/atmospherics/unary/Destroy()
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
del(network)
|
||||
node = null
|
||||
..()
|
||||
|
||||
new_network.normal_members += src
|
||||
/obj/machinery/atmospherics/unary/initialize()
|
||||
if(node) return
|
||||
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
|
||||
update_icon()
|
||||
|
||||
return null
|
||||
/obj/machinery/atmospherics/unary/build_network()
|
||||
if(!network && node)
|
||||
network = new /datum/pipe_network()
|
||||
network.normal_members += src
|
||||
network.build_network(node, src)
|
||||
|
||||
Destroy()
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
del(network)
|
||||
|
||||
node = null
|
||||
|
||||
..()
|
||||
|
||||
initialize()
|
||||
if(node) return
|
||||
|
||||
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
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/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
|
||||
return null
|
||||
|
||||
/obj/machinery/atmospherics/unary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network == old_network)
|
||||
network = new_network
|
||||
return 1
|
||||
|
||||
return_network(obj/machinery/atmospherics/reference)
|
||||
build_network()
|
||||
/obj/machinery/atmospherics/unary/return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
if(network == reference)
|
||||
results += air_contents
|
||||
return results
|
||||
|
||||
if(reference==node)
|
||||
return network
|
||||
|
||||
return null
|
||||
|
||||
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
|
||||
if(network == old_network)
|
||||
network = new_network
|
||||
|
||||
return 1
|
||||
|
||||
return_network_air(datum/pipe_network/reference)
|
||||
var/list/results = list()
|
||||
|
||||
if(network == reference)
|
||||
results += air_contents
|
||||
|
||||
return results
|
||||
|
||||
disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node)
|
||||
del(network)
|
||||
node = null
|
||||
|
||||
return null
|
||||
/obj/machinery/atmospherics/unary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference==node)
|
||||
del(network)
|
||||
node = null
|
||||
return null
|
||||
@@ -26,272 +26,272 @@
|
||||
var/area_uid
|
||||
var/radio_filter_out
|
||||
var/radio_filter_in
|
||||
New()
|
||||
..()
|
||||
area_uid = areaMaster.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()
|
||||
var/hidden=""
|
||||
if(level == 1 && istype(loc, /turf/simulated))
|
||||
hidden="h"
|
||||
var/suffix=""
|
||||
if(scrub_O2)
|
||||
suffix="1"
|
||||
if(node && on && !(stat & (NOPOWER|BROKEN)))
|
||||
if(scrubbing)
|
||||
icon_state = "[hidden]on[suffix]"
|
||||
else
|
||||
icon_state = "[hidden]in"
|
||||
else
|
||||
icon_state = "[hidden]off"
|
||||
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)
|
||||
|
||||
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_tox" = scrub_Toxins,
|
||||
"filter_n2o" = scrub_N2O,
|
||||
"filter_o2" = scrub_O2,
|
||||
"filter_n2" = scrub_N2,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
if(!areaMaster.air_scrub_names[id_tag])
|
||||
var/new_name = "[areaMaster.name] Air Scrubber #[areaMaster.air_scrub_names.len+1]"
|
||||
areaMaster.air_scrub_names[id_tag] = new_name
|
||||
src.name = new_name
|
||||
areaMaster.air_scrub_info[id_tag] = signal.data
|
||||
radio_connection.post_signal(src, signal, radio_filter_out)
|
||||
|
||||
return 1
|
||||
|
||||
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)
|
||||
|
||||
process()
|
||||
..()
|
||||
CHECK_DISABLED(scrubbers)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
return 0 // Let's not shut it off, for now.
|
||||
//broadcast_status()
|
||||
if(!on)
|
||||
return 0
|
||||
// New GC does this sometimes
|
||||
if(!loc) return
|
||||
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/New()
|
||||
..()
|
||||
area_uid = areaMaster.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/hidden=""
|
||||
if(level == 1 && istype(loc, /turf/simulated))
|
||||
hidden="h"
|
||||
var/suffix=""
|
||||
if(scrub_O2)
|
||||
suffix="1"
|
||||
if(node && on && !(stat & (NOPOWER|BROKEN)))
|
||||
if(scrubbing)
|
||||
// Are we scrubbing gasses that are present?
|
||||
if(\
|
||||
(scrub_Toxins && environment.toxins > 0) ||\
|
||||
(scrub_CO2 && environment.carbon_dioxide > 0) ||\
|
||||
(scrub_N2O && environment.trace_gases.len > 0) ||\
|
||||
(scrub_O2 && environment.oxygen > 0) ||\
|
||||
(scrub_N2 && environment.nitrogen > 0))
|
||||
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
|
||||
icon_state = "[hidden]on[suffix]"
|
||||
else
|
||||
icon_state = "[hidden]in"
|
||||
else
|
||||
icon_state = "[hidden]off"
|
||||
return
|
||||
|
||||
//Take a gas sample
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
if (isnull(removed)) //in space
|
||||
return
|
||||
/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)
|
||||
|
||||
//Filter it
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.temperature
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
if(scrub_Toxins)
|
||||
filtered_out.toxins = removed.toxins
|
||||
removed.toxins = 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_tox" = scrub_Toxins,
|
||||
"filter_n2o" = scrub_N2O,
|
||||
"filter_o2" = scrub_O2,
|
||||
"filter_n2" = scrub_N2,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
if(!areaMaster.air_scrub_names[id_tag])
|
||||
var/new_name = "[areaMaster.name] Air Scrubber #[areaMaster.air_scrub_names.len+1]"
|
||||
areaMaster.air_scrub_names[id_tag] = new_name
|
||||
src.name = new_name
|
||||
areaMaster.air_scrub_info[id_tag] = signal.data
|
||||
radio_connection.post_signal(src, signal, radio_filter_out)
|
||||
|
||||
if(scrub_CO2)
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
return 1
|
||||
|
||||
if(scrub_O2)
|
||||
filtered_out.oxygen = removed.oxygen
|
||||
removed.oxygen = 0
|
||||
/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)
|
||||
|
||||
if(scrub_N2)
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 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
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/process()
|
||||
..()
|
||||
CHECK_DISABLED(scrubbers)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
return 0 // Let's not shut it off, for now.
|
||||
//broadcast_status()
|
||||
if(!on)
|
||||
return 0
|
||||
// New GC does this sometimes
|
||||
if(!loc) return
|
||||
|
||||
|
||||
//Remix the resulting gases
|
||||
air_contents.merge(filtered_out)
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
loc.assume_air(removed)
|
||||
if(scrubbing)
|
||||
// Are we scrubbing gasses that are present?
|
||||
if(\
|
||||
(scrub_Toxins && environment.toxins > 0) ||\
|
||||
(scrub_CO2 && environment.carbon_dioxide > 0) ||\
|
||||
(scrub_N2O && environment.trace_gases.len > 0) ||\
|
||||
(scrub_O2 && environment.oxygen > 0) ||\
|
||||
(scrub_N2 && environment.nitrogen > 0))
|
||||
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
|
||||
|
||||
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
|
||||
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
if(scrub_Toxins)
|
||||
filtered_out.toxins = removed.toxins
|
||||
removed.toxins = 0
|
||||
|
||||
air_contents.merge(removed)
|
||||
if(scrub_CO2)
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
|
||||
if(scrub_O2)
|
||||
filtered_out.oxygen = removed.oxygen
|
||||
removed.oxygen = 0
|
||||
|
||||
if(scrub_N2)
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 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
|
||||
|
||||
return 1
|
||||
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
|
||||
/* //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"
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/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" : "" ]off"
|
||||
on = 0
|
||||
return
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
on = 0
|
||||
return
|
||||
*/
|
||||
|
||||
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
|
||||
/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
|
||||
|
||||
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"]) // We send 0 for false in the alarm.
|
||||
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"]) // We send 0 for false in the alarm.
|
||||
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["o2_scrub"] != null)
|
||||
scrub_O2 = text2num(signal.data["o2_scrub"])
|
||||
if(signal.data["toggle_o2_scrub"])
|
||||
scrub_O2 = !scrub_O2
|
||||
if(signal.data["o2_scrub"] != null)
|
||||
scrub_O2 = text2num(signal.data["o2_scrub"])
|
||||
if(signal.data["toggle_o2_scrub"])
|
||||
scrub_O2 = !scrub_O2
|
||||
|
||||
if(signal.data["n2_scrub"] != null)
|
||||
scrub_N2 = text2num(signal.data["n2_scrub"])
|
||||
if(signal.data["toggle_n2_scrub"])
|
||||
scrub_N2 = !scrub_N2
|
||||
if(signal.data["n2_scrub"] != null)
|
||||
scrub_N2 = text2num(signal.data["n2_scrub"])
|
||||
if(signal.data["toggle_n2_scrub"])
|
||||
scrub_N2 = !scrub_N2
|
||||
|
||||
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()]")
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
if(signal.data["init"] != null)
|
||||
name = signal.data["init"]
|
||||
return
|
||||
|
||||
power_change()
|
||||
if(powered(power_channel))
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
stat |= NOPOWER
|
||||
update_icon()
|
||||
if(signal.data["status"] != null)
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
return //do not update_icon
|
||||
|
||||
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
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
|
||||
// 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()
|
||||
if(powered(power_channel))
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
stat |= NOPOWER
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "<span class='warning'>You cannot unwrench this [src], turn it off first.</span>"
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag")]</li>
|
||||
</ul>
|
||||
"}
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag")]</li>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
|
||||
areaMaster.air_scrub_info.Remove(id_tag)
|
||||
|
||||
Reference in New Issue
Block a user