Files
CHOMPStation2/code/game/machinery/atmoalter/pump_vr.dm
CHOMPStation2StaffMirrorBot e957f101c5 [MIRROR] more new to Init (#10183)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2025-02-16 03:06:56 +01:00

129 lines
3.5 KiB
Plaintext

/obj/machinery/portable_atmospherics/powered/pump/huge
name = "Huge Air Pump"
icon = 'icons/obj/atmos.dmi'
icon_state = "siphon:0"
anchored = TRUE
volume = 500000
use_power = USE_POWER_IDLE
idle_power_usage = 50 //internal circuitry, friction losses and stuff
active_power_usage = 1000 // Blowers running
power_rating = 100000 //100 kW ~ 135 HP
var/global/gid = 1
var/id = 0
/obj/machinery/portable_atmospherics/powered/pump/huge/Initialize(mapload)
. = ..(mapload, TRUE)
id = gid
gid++
name = "[name] (ID [id])"
/obj/machinery/portable_atmospherics/powered/pump/huge/attack_hand(var/mob/user)
to_chat(user, span_notice("You can't directly interact with this machine. Use the pump control console."))
/obj/machinery/portable_atmospherics/powered/pump/huge/update_icon()
cut_overlays()
if(on && !(stat & (NOPOWER|BROKEN)))
icon_state = "siphon:1"
else
icon_state = "siphon:0"
/obj/machinery/portable_atmospherics/powered/pump/huge/power_change()
var/old_stat = stat
..()
if (old_stat != stat)
update_icon()
/obj/machinery/portable_atmospherics/powered/pump/huge/process()
if(!anchored || (stat & (NOPOWER|BROKEN)))
on = 0
last_flow_rate = 0
last_power_draw = 0
update_icon()
var/new_use_power = 1 + on
if(new_use_power != use_power)
update_use_power(new_use_power)
if(!on)
return
var/power_draw = -1
var/datum/gas_mixture/environment = loc.return_air()
var/pressure_delta
var/output_volume
var/air_temperature
if(direction_out)
pressure_delta = target_pressure - environment.return_pressure()
output_volume = environment.volume * environment.group_multiplier
air_temperature = environment.temperature? environment.temperature : air_contents.temperature
else
pressure_delta = environment.return_pressure() - target_pressure
output_volume = air_contents.volume * air_contents.group_multiplier
air_temperature = air_contents.temperature? air_contents.temperature : environment.temperature
var/transfer_moles = pressure_delta*output_volume/(air_temperature * R_IDEAL_GAS_EQUATION)
if(pressure_delta > 0.01)
if(direction_out)
power_draw = pump_gas(src, air_contents, environment, transfer_moles, power_rating)
else
power_draw = pump_gas(src, environment, air_contents, transfer_moles, power_rating)
if (power_draw < 0)
last_flow_rate = 0
last_power_draw = 0
else
use_power(power_draw)
update_connected_network()
/obj/machinery/portable_atmospherics/powered/pump/huge/attackby(var/obj/item/I, var/mob/user)
if(I.has_tool_quality(TOOL_WRENCH))
if(on)
to_chat(user, span_warning("Turn \the [src] off first!"))
return
anchored = !anchored
playsound(src, I.usesound, 50, 1)
to_chat(user, span_notice("You [anchored ? "wrench" : "unwrench"] \the [src]."))
return
//doesn't use power cells
if(istype(I, /obj/item/cell))
return
if (I.has_tool_quality(TOOL_SCREWDRIVER))
return
//doesn't hold tanks
if(istype(I, /obj/item/tank))
return
..()
/obj/machinery/portable_atmospherics/powered/pump/huge/stationary
name = "Stationary Air Pump"
/obj/machinery/portable_atmospherics/powered/pump/huge/stationary/attackby(var/obj/item/I, var/mob/user)
if(I.has_tool_quality(TOOL_WRENCH))
to_chat(user, span_warning("The bolts are too tight for you to unscrew!"))
return
..()
/obj/machinery/portable_atmospherics/powered/pump/huge/stationary/purge
on = 1
start_pressure = 0
target_pressure = 0
/obj/machinery/portable_atmospherics/powered/pump/huge/stationary/purge/power_change()
..()
if(!(stat & (NOPOWER|BROKEN)))
on = 1
update_icon()