mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-27 18:51:53 +00:00
204 lines
5.2 KiB
Plaintext
204 lines
5.2 KiB
Plaintext
/obj/machinery/portable_atmospherics/scrubber
|
|
name = "Portable Air Scrubber"
|
|
|
|
icon = 'icons/obj/atmos.dmi'
|
|
icon_state = "pscrubber:0"
|
|
density = 1
|
|
|
|
var/on = 0
|
|
var/volume_rate = 800
|
|
|
|
volume = 750
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/emp_act(severity)
|
|
if(stat & (BROKEN|NOPOWER))
|
|
..(severity)
|
|
return
|
|
|
|
if(prob(50/severity))
|
|
on = !on
|
|
update_icon()
|
|
|
|
..(severity)
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/huge
|
|
name = "Huge Air Scrubber"
|
|
icon_state = "scrubber:0"
|
|
anchored = 1
|
|
volume = 50000
|
|
volume_rate = 5000
|
|
|
|
var/global/gid = 1
|
|
var/id = 0
|
|
New()
|
|
..()
|
|
id = gid
|
|
gid++
|
|
|
|
name = "[name] (ID [id])"
|
|
|
|
attack_hand(var/mob/user as mob)
|
|
usr << "\blue You can't directly interact with this machine. Use the area atmos computer."
|
|
|
|
update_icon()
|
|
src.overlays = 0
|
|
|
|
if(on)
|
|
icon_state = "scrubber:1"
|
|
else
|
|
icon_state = "scrubber:0"
|
|
|
|
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
|
if(istype(W, /obj/item/weapon/wrench))
|
|
if(on)
|
|
user << "\blue Turn it off first!"
|
|
return
|
|
|
|
anchored = !anchored
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
|
user << "\blue You [anchored ? "wrench" : "unwrench"] \the [src]."
|
|
|
|
return
|
|
|
|
..()
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/huge/stationary
|
|
name = "Stationary Air Scrubber"
|
|
|
|
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
|
if(istype(W, /obj/item/weapon/wrench))
|
|
user << "\blue The bolts are too tight for you to unscrew!"
|
|
return
|
|
|
|
..()
|
|
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/update_icon()
|
|
src.overlays = 0
|
|
|
|
if(on)
|
|
icon_state = "pscrubber:1"
|
|
else
|
|
icon_state = "pscrubber:0"
|
|
|
|
if(holding)
|
|
overlays += "scrubber-open"
|
|
|
|
if(connected_port)
|
|
overlays += "scrubber-connector"
|
|
|
|
return
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/process()
|
|
..()
|
|
|
|
if(on)
|
|
var/datum/gas_mixture/environment
|
|
if(holding)
|
|
environment = holding.air_contents
|
|
else
|
|
environment = loc.return_air()
|
|
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
|
|
|
|
//Take a gas sample
|
|
var/datum/gas_mixture/removed
|
|
if(holding)
|
|
removed = environment.remove(transfer_moles)
|
|
else
|
|
removed = loc.remove_air(transfer_moles)
|
|
|
|
//Filter it
|
|
if (removed)
|
|
var/datum/gas_mixture/filtered_out = new
|
|
|
|
filtered_out.temperature = removed.temperature
|
|
|
|
|
|
filtered_out.toxins = removed.toxins
|
|
removed.toxins = 0
|
|
|
|
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/sleeping_agent))
|
|
removed.trace_gases -= trace_gas
|
|
filtered_out.trace_gases += trace_gas
|
|
|
|
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
|
|
|
|
//Remix the resulting gases
|
|
air_contents.merge(filtered_out)
|
|
|
|
if(holding)
|
|
environment.merge(removed)
|
|
else
|
|
loc.assume_air(removed)
|
|
//src.update_icon()
|
|
src.updateDialog()
|
|
return
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/return_air()
|
|
return air_contents
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/attack_ai(var/mob/user as mob)
|
|
src.add_hiddenprint(user)
|
|
return src.attack_hand(user)
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/attack_hand(var/mob/user as mob)
|
|
|
|
user.set_machine(src)
|
|
var/holding_text
|
|
|
|
if(holding)
|
|
holding_text = {"<BR><B>Tank Pressure</B>: [holding.air_contents.return_pressure()] KPa<BR>
|
|
<A href='?src=\ref[src];remove_tank=1'>Remove Tank</A><BR>
|
|
"}
|
|
var/output_text = {"<TT><B>[name]</B><BR>
|
|
Pressure: [air_contents.return_pressure()] KPa<BR>
|
|
Port Status: [(connected_port)?("Connected"):("Disconnected")]
|
|
[holding_text]
|
|
<BR>
|
|
Power Switch: <A href='?src=\ref[src];power=1'>[on?("On"):("Off")]</A><BR>
|
|
Power regulator: <A href='?src=\ref[src];volume_adj=-1000'>-</A> <A href='?src=\ref[src];volume_adj=-100'>-</A> <A href='?src=\ref[src];volume_adj=-10'>-</A> <A href='?src=\ref[src];volume_adj=-1'>-</A> [volume_rate] <A href='?src=\ref[src];volume_adj=1'>+</A> <A href='?src=\ref[src];volume_adj=10'>+</A> <A href='?src=\ref[src];volume_adj=100'>+</A> <A href='?src=\ref[src];volume_adj=1000'>+</A><BR>
|
|
|
|
<HR>
|
|
<A href='?src=\ref[user];mach_close=scrubber'>Close</A><BR>
|
|
"}
|
|
|
|
user << browse(output_text, "window=scrubber;size=600x300")
|
|
onclose(user, "scrubber")
|
|
return
|
|
|
|
/obj/machinery/portable_atmospherics/scrubber/Topic(href, href_list)
|
|
..()
|
|
if (usr.stat || usr.restrained())
|
|
return
|
|
|
|
if (((get_dist(src, usr) <= 1) && istype(src.loc, /turf)))
|
|
usr.set_machine(src)
|
|
|
|
if(href_list["power"])
|
|
on = !on
|
|
|
|
if (href_list["remove_tank"])
|
|
if(holding)
|
|
holding.loc = loc
|
|
holding = null
|
|
|
|
if (href_list["volume_adj"])
|
|
var/diff = text2num(href_list["volume_adj"])
|
|
volume_rate = min(10*ONE_ATMOSPHERE, max(0, volume_rate+diff))
|
|
|
|
src.updateUsrDialog()
|
|
src.add_fingerprint(usr)
|
|
update_icon()
|
|
else
|
|
usr << browse(null, "window=scrubber")
|
|
return
|
|
return |