mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-20 15:12:57 +00:00
- Complete rewrite of pipe rendering code. It now selects icons from a shared cache. - Manifolds and other devices (pumps, filters, etc.) now match the color of the connected pipes. - Updated omni devices to use the shared cache. - Set separate pipe color definitions. - Cleaned up a lot of pipe code, converting it to absolute paths and removing old commented out code. - Tweaked t-ray rendering code. - Tweaked pipe painter. - Enhanced pipe checking debug command. - Expanded tank capacity and resprited them.
139 lines
3.3 KiB
Plaintext
139 lines
3.3 KiB
Plaintext
/obj/machinery/atmospherics/unary/outlet_injector
|
|
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"
|
|
|
|
var/on = 0
|
|
var/injecting = 0
|
|
|
|
var/volume_rate = 50
|
|
|
|
var/frequency = 0
|
|
var/id = null
|
|
var/datum/radio_frequency/radio_connection
|
|
|
|
level = 1
|
|
|
|
/obj/machinery/atmospherics/unary/outlet_injector/update_icon()
|
|
if(!powered())
|
|
icon_state = "off"
|
|
else
|
|
icon_state = "[on ? "on" : "off"]"
|
|
|
|
/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)
|
|
|
|
/obj/machinery/atmospherics/unary/outlet_injector/power_change()
|
|
var/old_stat = stat
|
|
..()
|
|
if(old_stat != stat)
|
|
update_icon()
|
|
|
|
/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() |