mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-26 10:02:28 +00:00
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.
* this is probably important
* Remove cascade disabling SSgarbage
* Fixed a bug where dust() did not qdel the target mob
* Misc fixes
* Fix decals surviving break-to-plating
* Subsystem flag tweaks
* Apparently subsystems are new'd before config is.
* Fix paper icons
* Speculative fix for insane lag
* Better machinery stat
* Make organs not use SSoverlay
* Misc bugfixes & tweaks
* Nightmode fixes
* Changelog for SMC
* Port /tg/'s improved MC crash handling
* Add some more SS Recover() procs
* supply_controller -> SScargo
* More New() -> Initialize()
* pAI and robot construction overlays
* Fix cargo unit tests
* Merge the DMM Suite's atom/New() into atoms_init
* Lighting pre-baking
* Lighting initialization logging
* Fix some bad SS init orders
* Fix SSlighting logging; rename Processes to MC
* Speculative fix for insane GC lag
* Prebaked openturf/icon_smooth & fix lighting prebake
* SS init status; SSatoms LATEQDEL
* Fix bug with MC init stat panel
* Fix parallax
* Misc
* Ignore SS_NO_DISPLAY during init
* apparently this is important
* REEEEEE
* Image GC fixes; broadcaster radio-new sanity
* RCON Cleanup
* Move pAI recruiter into subsystem
* Move global solars list into sun subsystem
* Make chickens not use a global
* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup
* Speed up space init a little
* Fix bad timer flags on floor drying
* Subsystem panic-restart verb for mins
* Explosion speedup
* Minor subsystem & MC logging tweaks
* SSopenturf improvements
* Make pipenet actually initialize (whoops)
* Minor tweaks
* Implement lighting rounding
* comments are hard okay
* Minor lattice tweaks
* Fix some timer issues & better closet init
* Timer sanity
* Request console tweaks + Storage init sanity
* Minor SSmachiner RCON improvements
* Further reduce world-start timer count
* Standardize subsystem logging
* Garbage hard delete profiling from /tg/
* Timer hang detection & recovery
* Log machines that sleep in process() and fuck up SSmachinery
* Fix an issue with external airlocks sleeping in process()
* Failsafe logging
* Minor tweaks
* Revert "Request console tweaks + Storage init sanity"
This reverts commit 98d3579e35.
* Re-implement RC changes
* Fix SQL FT saving
* Fix SSmachinery sleep in disposals
* Minor SS tweaks
* Paper fixes
* Blood drying fixes
* Merge gameticker and SSticker
* Minor global list init cleanup
* Lagcheck biogenerator & bags
* Tweak SScargo init order; RIG Initialize()
* Caching tweaks
* Remove rogue comma
* Initialize fixes
* Lighting destroy cleanup
* Fix emagging airlocks
* Initial SSicon implementation
* Tweaks & Fixes
* Fire + Air alarm queued icon updates
* Overlays + Queued icon cleanup
* Runtime & background fixes
* Kill some meaningless set statements
* Kill some image qdels
* Bump up lighting rounding val
* Fix adv. scanner destroy runtimes
* Remove unneeded icon update limiting
* Move icon smoothing into helpers
* Show a warning if DM 510 compiles without memory leak hack enabled
* Re-organize subsystems & MC defines a little
* Airlock SFX
* Log of Changes
* Make SSicon_update disable itself when not doing anything
* Fix respawn verb runtime when used early in server-init
* Add more information to MC's stat_entry()
* Replace direct refernces to gcDestroyed with QDEL* macros
* plant_controller -> SSplants
* More plant tweaks
* Add more humor to changelog
* Move parallax globals into SSparallax
* Lighting responsiveness tweaks
* Fix parallax init order & better MC init panel stat
* Make mobs GC
* More overlays + Remove intercom spawn()
* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.
* Update changelog
* Mob GC tweaks
* Del() cleanup
* Fix insomniac ZAS connection edges
* Minor pAI cleanup
* Convert more things to SSoverlay; fix duplicated overlay in field gens
* SM Bluespace turf tweaks
* Update SSgarbage debug globals list
* Human-type qdel tweaks
* Subsystem suspension; stat_entry improvements
* SQL Statistics cleanup
* Fix runtimes with ambrosia
* More disable() -> suspend(); fix nightmode again
* Human qdel fix; minor tweaks
* Update turbolift to work with StonedMC
* Make lifts use timers instead of a subsystem
* Make SSassets start earlier
* Convert the radio controller into a subsystem
* Fix some missing CHECK_TICKs in asteroid generation
* MC stat tweaks; make shouldnt_see a typecache
* Kill some redundant debug-controller entries
* radio_controller -> SSradio
* Better SSgarbage hard-del logging from /tg/ upstream
* Logging tweaks + GELF
* Misc client caching improvements
* Slime SSoverlay
* Oven icon fixes
* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.
* Holder tweaks + Welding tool Initialize()
* Fix some bad subsystem logging
* Fix suit cooling units spawning without cells
* Starlight tweaks
* Gibber infinite gib fix
* More SSoverlay stuff
* Make crates use CUT_OVERLAY_IN
* Make SSarrivals suspend instead of disable
* Make openturf use split/phased tick checks
* Speculative fix for unwet timer runtimes
* Blood overlay tweaks/fixes
* Update crusher to play nice with SMC + SSoverlay
* Openturf improvements and fixes
* Minor turbolift tweaks
* Lighting performance improvements + ChangeTurf tweaks
* this is probably important
* Fix wall weld noises on changeturf
* More ChangeTurf tweaks
* Explosion tweaks
* Pre-game lobby tweaks
* Openturf tweaks
* Prevent admins from starting the game before init finishes
* Fix Travis
* Kill an unused var
* Fix ChangeTurf runtimes on openturfs
* Fixes
* Browser datum fixes, asset caching
* Update changelog
* Changelog
* Lobby tweaks
* Ticker tweaks; kill ticker var
* Further lobby tweaks
* Cascade tweaks
* air_master -> SSair
* Reduce overhead from radio autosay
* alarm_manager -> SSalarm
* bomb_processor -> SSexplosives
* corp_regs -> SSlaw
* ZAS overlay fixes
* Small wall icon optimization
* Fix effects master
* Assembly tweaks
* Megavend fixes
* Shuttle fixes
* Camera alert performance improvements
* Fix some world.log spam from lighting overlays
* Fix some Initialize() procs
* Openspace responsiveness tweaks
* Make HE pipes animate through openturfs
* Kill a spawn
326 lines
10 KiB
Plaintext
326 lines
10 KiB
Plaintext
/obj/machinery/atmospherics/unary/vent_scrubber
|
|
icon = 'icons/atmos/vent_scrubber.dmi'
|
|
icon_state = "map_scrubber_off"
|
|
|
|
name = "Air Scrubber"
|
|
desc = "Has a valve and pump attached to it"
|
|
use_power = 0
|
|
idle_power_usage = 150 //internal circuitry, friction losses and stuff
|
|
power_rating = 7500 //7500 W ~ 10 HP
|
|
|
|
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SCRUBBER //connects to regular and scrubber pipes
|
|
|
|
level = 1
|
|
|
|
var/area/initial_loc
|
|
var/id_tag = null
|
|
var/frequency = 1439
|
|
var/datum/radio_frequency/radio_connection
|
|
|
|
var/hibernate = 0 //Do we even process?
|
|
var/scrubbing = 1 //0 = siphoning, 1 = scrubbing
|
|
var/list/scrubbing_gas = list("carbon_dioxide")
|
|
|
|
var/panic = 0 //is this scrubber panicked?
|
|
|
|
var/area_uid
|
|
var/radio_filter_out
|
|
var/radio_filter_in
|
|
|
|
var/welded = 0
|
|
//no_special_init = TRUE
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/on
|
|
use_power = 1
|
|
icon_state = "map_scrubber_on"
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/New()
|
|
..()
|
|
air_contents.volume = ATMOS_DEFAULT_VOLUME_FILTER
|
|
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/Initialize()
|
|
. = ..()
|
|
|
|
initial_loc = get_area(loc)
|
|
area_uid = initial_loc.uid
|
|
if (!id_tag)
|
|
assign_uid()
|
|
id_tag = num2text(uid)
|
|
|
|
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)
|
|
|
|
initialize()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/initialize()
|
|
..()
|
|
broadcast_status()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
|
|
unregister_radio(src, frequency)
|
|
return ..()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/update_icon(var/safety = 0)
|
|
var/turf/T = get_turf(src)
|
|
if(!istype(T))
|
|
return
|
|
|
|
if (welded)
|
|
icon_state = "weld"
|
|
return
|
|
|
|
if (!powered() || !use_power)
|
|
icon_state = "off"
|
|
else if (scrubbing)
|
|
icon_state = "on"
|
|
else
|
|
icon_state = "in"
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/update_underlays()
|
|
if(..())
|
|
underlays.Cut()
|
|
var/turf/T = get_turf(src)
|
|
if(!istype(T))
|
|
return
|
|
if(!T.is_plating() && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
|
|
return
|
|
else
|
|
if(node)
|
|
add_underlay(T, node, dir, node.icon_connect_type)
|
|
else
|
|
add_underlay(T,, dir)
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency)
|
|
SSradio.remove_object(src, frequency)
|
|
frequency = new_frequency
|
|
radio_connection = SSradio.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" = use_power,
|
|
"scrubbing" = scrubbing,
|
|
"panic" = panic,
|
|
"filter_o2" = ("oxygen" in scrubbing_gas),
|
|
"filter_n2" = ("nitrogen" in scrubbing_gas),
|
|
"filter_co2" = ("carbon_dioxide" in scrubbing_gas),
|
|
"filter_phoron" = ("phoron" in scrubbing_gas),
|
|
"filter_n2o" = ("sleeping_agent" in scrubbing_gas),
|
|
"sigtype" = "status"
|
|
)
|
|
|
|
var/area/A = get_area(src)
|
|
if(!A.air_scrub_names[id_tag])
|
|
var/new_name = "[A.name] Air Scrubber #[A.air_scrub_names.len+1]"
|
|
A.air_scrub_names[id_tag] = new_name
|
|
src.name = new_name
|
|
A.air_scrub_info[id_tag] = signal.data
|
|
radio_connection.post_signal(src, signal, radio_filter_out)
|
|
|
|
return 1
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/process()
|
|
..()
|
|
|
|
if (hibernate > world.time)
|
|
return 1
|
|
|
|
if (!node)
|
|
use_power = 0
|
|
//broadcast_status()
|
|
if(!use_power || (stat & (NOPOWER|BROKEN)))
|
|
return 0
|
|
if(welded)
|
|
return 0
|
|
|
|
var/datum/gas_mixture/environment = loc.return_air()
|
|
|
|
var/power_draw = -1
|
|
if(scrubbing)
|
|
//limit flow rate from turfs
|
|
var/transfer_moles = min(environment.total_moles, environment.total_moles*MAX_SCRUBBER_FLOWRATE/environment.volume) //group_multiplier gets divided out here
|
|
|
|
power_draw = scrub_gas(src, scrubbing_gas, environment, air_contents, transfer_moles, power_rating)
|
|
else //Just siphon all air
|
|
//limit flow rate from turfs
|
|
var/transfer_moles = min(environment.total_moles, environment.total_moles*MAX_SIPHON_FLOWRATE/environment.volume) //group_multiplier gets divided out here
|
|
|
|
power_draw = pump_gas(src, environment, air_contents, transfer_moles, power_rating)
|
|
|
|
if(scrubbing && power_draw <= 0) //99% of all scrubbers
|
|
//Fucking hibernate because you ain't doing shit.
|
|
hibernate = world.time + (rand(100,200))
|
|
|
|
if (power_draw >= 0)
|
|
last_power_draw = power_draw
|
|
use_power(power_draw)
|
|
|
|
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()
|
|
update_underlays()
|
|
|
|
/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)
|
|
use_power = text2num(signal.data["power"])
|
|
if(signal.data["power_toggle"] != null)
|
|
use_power = !use_power
|
|
|
|
if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing
|
|
panic = text2num(signal.data["panic_siphon"])
|
|
if(panic)
|
|
use_power = 1
|
|
scrubbing = 0
|
|
else
|
|
scrubbing = 1
|
|
if(signal.data["toggle_panic_siphon"] != null)
|
|
panic = !panic
|
|
if(panic)
|
|
use_power = 1
|
|
scrubbing = 0
|
|
else
|
|
scrubbing = 1
|
|
|
|
if(signal.data["scrubbing"] != null)
|
|
scrubbing = text2num(signal.data["scrubbing"])
|
|
if(scrubbing)
|
|
panic = 0
|
|
if(signal.data["toggle_scrubbing"])
|
|
scrubbing = !scrubbing
|
|
if(scrubbing)
|
|
panic = 0
|
|
|
|
var/list/toggle = list()
|
|
|
|
if(!isnull(signal.data["o2_scrub"]) && text2num(signal.data["o2_scrub"]) != ("oxygen" in scrubbing_gas))
|
|
toggle += "oxygen"
|
|
else if(signal.data["toggle_o2_scrub"])
|
|
toggle += "oxygen"
|
|
|
|
if(!isnull(signal.data["n2_scrub"]) && text2num(signal.data["n2_scrub"]) != ("nitrogen" in scrubbing_gas))
|
|
toggle += "nitrogen"
|
|
else if(signal.data["toggle_n2_scrub"])
|
|
toggle += "nitrogen"
|
|
|
|
if(!isnull(signal.data["co2_scrub"]) && text2num(signal.data["co2_scrub"]) != ("carbon_dioxide" in scrubbing_gas))
|
|
toggle += "carbon_dioxide"
|
|
else if(signal.data["toggle_co2_scrub"])
|
|
toggle += "carbon_dioxide"
|
|
|
|
if(!isnull(signal.data["tox_scrub"]) && text2num(signal.data["tox_scrub"]) != ("phoron" in scrubbing_gas))
|
|
toggle += "phoron"
|
|
else if(signal.data["toggle_tox_scrub"])
|
|
toggle += "phoron"
|
|
|
|
if(!isnull(signal.data["n2o_scrub"]) && text2num(signal.data["n2o_scrub"]) != ("sleeping_agent" in scrubbing_gas))
|
|
toggle += "sleeping_agent"
|
|
else if(signal.data["toggle_n2o_scrub"])
|
|
toggle += "sleeping_agent"
|
|
|
|
scrubbing_gas ^= toggle
|
|
|
|
if(signal.data["init"] != null)
|
|
name = signal.data["init"]
|
|
return
|
|
|
|
if(signal.data["status"] != null)
|
|
addtimer(CALLBACK(src, .proc/broadcast_status), 2, TIMER_UNIQUE)
|
|
return //do not update_icon
|
|
|
|
// log_debug("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
|
|
addtimer(CALLBACK(src, .proc/broadcast_status), 2, TIMER_UNIQUE)
|
|
update_icon()
|
|
return
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/power_change()
|
|
var/old_stat = stat
|
|
..()
|
|
if(old_stat != stat)
|
|
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/weapon/wrench))
|
|
if (!(stat & NOPOWER) && use_power)
|
|
user << "<span class='warning'>You cannot unwrench \the [src], turn it off first.</span>"
|
|
return 1
|
|
var/turf/T = src.loc
|
|
if (node && node.level==1 && isturf(T) && !T.is_plating())
|
|
user << "<span class='warning'>You must remove the plating first.</span>"
|
|
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 << "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>"
|
|
add_fingerprint(user)
|
|
return 1
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
|
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
|
|
if (do_after(user, 40, act_target = src))
|
|
user.visible_message( \
|
|
"<span class='notice'>\The [user] unfastens \the [src].</span>", \
|
|
"<span class='notice'>You have unfastened \the [src].</span>", \
|
|
"You hear a ratchet.")
|
|
new /obj/item/pipe(loc, make_from=src)
|
|
qdel(src)
|
|
return 1
|
|
|
|
if(istype(W, /obj/item/weapon/weldingtool))
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
if (!WT.welding)
|
|
user << "<span class='danger'>\The [WT] must be turned on!</span>"
|
|
else if (WT.remove_fuel(0,user))
|
|
user << "<span class='notice'>Now welding \the [src].</span>"
|
|
if(do_after(user, 20, act_target = src))
|
|
if(!src || !WT.isOn()) return
|
|
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
|
if(!welded)
|
|
user.visible_message("<span class='danger'>\The [user] welds \the [src] shut.</span>", "<span class='notice'>You weld \the [src] shut.</span>", "You hear welding.")
|
|
welded = 1
|
|
update_icon()
|
|
else
|
|
user.visible_message("<span class='danger'>[user] unwelds \the [src].</span>", "<span class='notice'>You unweld \the [src].</span>", "You hear welding.")
|
|
welded = 0
|
|
update_icon()
|
|
else
|
|
user << "<span class='notice'>You fail to complete the welding.</span>"
|
|
else
|
|
user << "<span class='warning'>You need more welding fuel to complete this task.</span>"
|
|
return 1
|
|
return ..()
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/examine(mob/user)
|
|
if(..(user, 1))
|
|
user << "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
|
|
else
|
|
user << "You are too far away to read the gauge."
|
|
if(welded)
|
|
user << "It seems welded shut."
|
|
|
|
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
|
|
if(initial_loc)
|
|
initial_loc.air_scrub_info -= id_tag
|
|
initial_loc.air_scrub_names -= id_tag
|
|
|
|
return ..()
|