Minor edits to scrubber surge and how it starts. (#69695)

Makes minor edits to surge event

Uses ``as anything`` to check scrubbers we already know are scrubbers
Makes the CHECK_TICK -> early return into just a crash, since it's not supposed to happen.

Cockroaches now appear on dangerous vents instead of being a prob(25), I thought it would be better this way to make it easier to tell what vents are spitting out dangerous foams.
Also creates/uses the reagents we are actually gonna use, rather than creating a dynamic amount of reagents, but then turning a hardcoded amount of it into foam.
This commit is contained in:
John Willard
2022-09-06 12:45:17 -04:00
committed by GitHub
parent c34935ea44
commit eff3bdcf34
+19 -16
View File
@@ -8,13 +8,12 @@
/datum/round_event/scrubber_overflow
announce_when = 1
start_when = 5
end_when = 35
/// A list of scrubbers that will have reagents ejected from them
var/list/scrubbers = list()
/// The probability that the ejected reagents will be dangerous
var/danger_chance = 1
/// Amount of reagents ejected from each scrubber
var/reagents_amount = 50
/// A list of scrubbers that will have reagents ejected from them
var/list/scrubbers = list()
/// The list of chems that scrubbers can produce
var/list/safer_chems = list(/datum/reagent/water,
/datum/reagent/carbon,
@@ -54,36 +53,40 @@
)
//needs to be chemid unit checked at some point
/datum/round_event/scrubber_overflow/announce()
/datum/round_event/scrubber_overflow/announce(fake)
priority_announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert")
/datum/round_event/scrubber_overflow/setup()
end_when = rand(25, 100)
for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent in GLOB.machines)
var/turf/scrubber_turf = get_turf(temp_vent)
if(scrubber_turf && is_station_level(scrubber_turf.z) && !temp_vent.welded && prob(50))
scrubbers += temp_vent
if(!scrubber_turf)
continue
if(!is_station_level(scrubber_turf.z))
continue
if(temp_vent.welded)
continue
if(!prob(50))
continue
scrubbers += temp_vent
if(!scrubbers.len)
return kill()
/datum/round_event/scrubber_overflow/start()
for(var/obj/machinery/atmospherics/components/unary/vent in scrubbers)
for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/vent as anything in scrubbers)
if(!vent.loc)
CHECK_TICK
return ..()
CRASH("SCRUBBER SURGE: [vent] has no loc somehow?")
var/datum/reagents/dispensed_reagent = new/datum/reagents(1000)
var/datum/reagents/dispensed_reagent = new /datum/reagents(reagents_amount)
dispensed_reagent.my_atom = vent
if (prob(danger_chance))
dispensed_reagent.add_reagent(get_random_reagent_id(), reagents_amount)
new /mob/living/basic/cockroach(get_turf(vent))
new /mob/living/basic/cockroach(get_turf(vent))
else
dispensed_reagent.add_reagent(pick(safer_chems), reagents_amount)
dispensed_reagent.create_foam(/datum/effect_system/fluid_spread/foam, 50)
if (prob(25))
new /mob/living/basic/cockroach(get_turf(vent))
new /mob/living/basic/cockroach(get_turf(vent))
dispensed_reagent.create_foam(/datum/effect_system/fluid_spread/foam, reagents_amount)
CHECK_TICK