Vent Clog and False Alarm events: Attempt 2 (#850)

New PR to fix merge issues

Porting an event from tg. Scrubbers get clogged and eject some chemical smoke with potentially fun effeects

I looked through chemsmoke code while doing this, and found it wanting, so i improved it. Added a duration input, adjusted all uses of chemsmoke in the code. Generally gave them all higher durations, chemsmoke grenades were a disappointing poot

Adds a new mundane event, false alarm.
It picks a random moderate or severe event and fakes its announcement without actually running the event.

Three minutes later, CC sends another announcement apologising for the false alarm

Also added an event var allowing events to exclude themselves from being picked for faking
This commit is contained in:
NanakoAC
2016-09-01 20:46:32 +02:00
committed by skull132
parent 893398104f
commit 0b2732b7a0
11 changed files with 158 additions and 22 deletions
+10 -3
View File
@@ -49,6 +49,11 @@
var/endedAt = 0 //When this event ended.
var/datum/event_meta/event_meta = null
var/no_fake = 0
//If set to 1, this event will not be picked for false announcements
//This should really only be used for events that have no announcement
/datum/event/nothing
//Called first before processing.
@@ -114,12 +119,13 @@
activeFor++
//Called when start(), announce() and end() has all been called.
/datum/event/proc/kill()
/datum/event/proc/kill(var/do_end = 1)
// If this event was forcefully killed run end() for individual cleanup
if(isRunning)
isRunning = 0
if(do_end && isRunning)
end()
isRunning = 0
endedAt = world.time
event_manager.active_events -= src
event_manager.event_complete(src)
@@ -137,3 +143,4 @@
setup()
..()
+6 -4
View File
@@ -132,15 +132,17 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Brand Intelligence",/datum/event/brand_intelligence,15, list(ASSIGNMENT_JANITOR = 20), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Camera Damage", /datum/event/camera_damage, 20, list(ASSIGNMENT_ENGINEER = 10)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Economic News", /datum/event/economic_event, 300),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/carp_migration, 20, list(ASSIGNMENT_SECURITY = 10), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/carp_migration, 20, list(ASSIGNMENT_SECURITY = 10), 1),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Hacker", /datum/event/money_hacker, 10),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Lotto", /datum/event/money_lotto, 0, list(ASSIGNMENT_ANY = 1), 1, 5, 15),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Lotto", /datum/event/money_lotto, 0, list(ASSIGNMENT_ANY = 1), 1, 5, 15),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Mundane News", /datum/event/mundane_news, 300),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "PDA Spam", /datum/event/pda_spam, 0, list(ASSIGNMENT_ANY = 3), 0, 0, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Space Dust", /datum/event/dust , 30, list(ASSIGNMENT_ENGINEER = 5), 0, 0, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "PDA Spam", /datum/event/pda_spam, 0, list(ASSIGNMENT_ANY = 3), 0, 0, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Space Dust", /datum/event/dust , 30, list(ASSIGNMENT_ENGINEER = 5), 0, 0, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Trivial News", /datum/event/trivial_news, 400),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Vermin Infestation",/datum/event/infestation, 60, list(ASSIGNMENT_JANITOR = 20, ASSIGNMENT_SECURITY = 10)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Wallrot", /datum/event/wallrot, 75, list(ASSIGNMENT_ENGINEER = 5, ASSIGNMENT_GARDENER = 20)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Clogged Vents", /datum/event/vent_clog, 100),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "False Alarm", /datum/event/false_alarm, 100),
)
/datum/event_container/moderate
+37
View File
@@ -0,0 +1,37 @@
//False Alarm Event
//This picks a random moderate or severe event and fakes its announcement
//without actually running the event
//After roughly 3 minutes, CC sends another announcement apologising for the false alarm
/datum/event/false_alarm
announceWhen = 0
endWhen = 90
var/datum/event_meta/EM
/datum/event/false_alarm/end()
command_announcement.Announce("Error, It appears our previous announcement about a [EM.name] was a sensor glitch. There is no cause for alarm, please return to your stations.", "False Alarm")
/datum/event/false_alarm/announce()
var/datum/event_container/EC
if (prob(50))
EC = event_manager.event_containers[EVENT_LEVEL_MODERATE]
else
EC = event_manager.event_containers[EVENT_LEVEL_MAJOR]
//Don't pick events that are excluded from faking.
EM = pick(EC.available_events)
var/datum/event/E = null
var/fake_allowed = 0
while (!fake_allowed)
if (E)
E.kill(0)
EM = pick(EC.available_events)
E = new EM.event_type(EM)
fake_allowed = !E.no_fake
message_admins("False Alarm: [E]")
E.kill(0)
E.announce()
@@ -1,3 +1,6 @@
/datum/event/spontaneous_appendicitis
no_fake = 1
/datum/event/spontaneous_appendicitis/start()
for(var/mob/living/carbon/human/H in shuffle(living_mob_list)) if(H.client && H.stat != DEAD)
var/foundAlready = 0 //don't infect someone that already has the virus
+44
View File
@@ -0,0 +1,44 @@
/datum/event/vent_clog
announceWhen = 1
startWhen = 5
endWhen = 35
var/interval = 2
var/list/vents = list()
var/list/gunk = list("water","carbon","flour","radium","toxin","cleaner","nutriment",\
"condensedcapsaicin","mindbreaker","lube","plantbgone","banana","space_drugs",\
"holywater","ethanol","hot_coco","sacid", "hyperzine", "ethanol")
/datum/event/vent_clog/setup()
endWhen = rand(25, 100)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in machines)
if(temp_vent.z in config.station_levels)//STATION ZLEVEL
if(temp_vent.network.normal_members.len > 20)
vents += temp_vent
if(!vents.len)
return kill()
/datum/event/vent_clog/tick()
if(activeFor % interval == 0)
var/obj/machinery/atmospherics/unary/vent_scrubber/vent = pick_n_take(vents)
if(vent && vent.loc)
var/datum/reagents/R = new/datum/reagents(50)
R.my_atom = vent
var/chem = pick(gunk)
R.add_reagent(chem, 50)
var/datum/effect/effect/system/smoke_spread/chem/smoke = new
smoke.show_log = 0//This spams admin logs if not disabled.
smoke.set_up(R, 10, 0, vent, 120)
playsound(vent.loc, 'sound/effects/smoke.ogg', 50, 1, -3)
smoke.start()
qdel(R)
/datum/event/vent_clog/announce()
command_announcement.Announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert")
+1 -1
View File
@@ -93,7 +93,7 @@
var/datum/effect/effect/system/smoke_spread/chem/spores/S = new(name)
S.attach(T)
S.set_up(R, round(get_trait(TRAIT_POTENCY)/4), 0, T)
S.set_up(R, round(get_trait(TRAIT_POTENCY)/4), 0, T, 40)
S.start()
// Does brute damage to a target.
+1 -1
View File
@@ -577,7 +577,7 @@
var/location = get_turf(holder.my_atom)
var/datum/effect/effect/system/smoke_spread/chem/S = new /datum/effect/effect/system/smoke_spread/chem
S.attach(location)
S.set_up(holder, created_volume, 0, location)
S.set_up(holder, created_volume, 0, location, 80)
playsound(location, 'sound/effects/smoke.ogg', 50, 1, -3)
spawn(0)
S.start()