From 0bd97b3e738b619265bae00a587b262202602b66 Mon Sep 17 00:00:00 2001 From: Luc <89928798+lewcc@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:15:34 -0400 Subject: [PATCH] Refactors false alarms (#22010) * rework anomalies * oh yeah, events, too. * does remaining events * fixes most issues * oops * this too * ensures traders actually fake announce properly * fix tear * missing return * And another missing return --- code/modules/admin/verbs/randomverbs.dm | 4 +- code/modules/events/alien_infestation.dm | 4 +- code/modules/events/anomaly_bluespace.dm | 5 +- code/modules/events/anomaly_cryo.dm | 5 +- code/modules/events/anomaly_event.dm | 26 +++++- code/modules/events/anomaly_flux.dm | 5 +- code/modules/events/anomaly_grav.dm | 5 +- code/modules/events/anomaly_pyro.dm | 5 +- code/modules/events/anomaly_vortex.dm | 5 +- code/modules/events/blob_spawn.dm | 4 +- code/modules/events/brand_intelligence.dm | 14 +++- .../modules/events/communications_blackout.dm | 4 +- code/modules/events/event.dm | 16 +++- code/modules/events/false_alarm.dm | 77 +++++++++-------- code/modules/events/infestation.dm | 83 ++++++------------- code/modules/events/ion_storm.dm | 6 +- code/modules/events/meteors_event.dm | 11 ++- code/modules/events/prison_break.dm | 4 +- code/modules/events/spider_infestation.dm | 4 +- code/modules/events/spider_terror.dm | 4 +- code/modules/events/tear.dm | 13 ++- code/modules/events/traders.dm | 8 ++ 22 files changed, 162 insertions(+), 150 deletions(-) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 6fc9686f9f6..f2cf78e85a1 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -278,7 +278,7 @@ var/show_log = alert(src, "Show ion message?", "Message", "Yes", "No") var/announce_ion_laws = (show_log == "Yes" ? 1 : -1) - new /datum/event/ion_storm(0, announce_ion_laws) + new /datum/event/ion_storm(botEmagChance = 0, announceEvent = announce_ion_laws) SSblackbox.record_feedback("tally", "admin_verb", 1, "Add Random AI Law") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/toggle_antagHUD_use() @@ -584,7 +584,7 @@ Traitors and the like can also be revived with the previous role mostly intact. var/show_log = alert(src, "Show ion message?", "Message", "Yes", "No") var/announce_ion_laws = (show_log == "Yes" ? 1 : -1) - new /datum/event/ion_storm(0, announce_ion_laws, input) + new /datum/event/ion_storm(botEmagChance = 0, announceEvent = announce_ion_laws, ionMessage = input) SSblackbox.record_feedback("tally", "admin_verb", 1, "Add Custom AI Law") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index b922167e1a6..16f275cb652 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -8,8 +8,8 @@ /datum/event/alien_infestation/setup() announceWhen = rand(announceWhen, announceWhen + 50) -/datum/event/alien_infestation/announce() - if(successSpawn) +/datum/event/alien_infestation/announce(false_alarm) + if(successSpawn || false_alarm) GLOB.major_announcement.Announce("Confirmed outbreak of level 3-X biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/effects/siren-spooky.ogg', new_sound2 = 'sound/AI/outbreak3.ogg') else log_and_message_admins("Warning: Could not spawn any mobs for event Alien Infestation") diff --git a/code/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm index 1ef2063f132..1543a022907 100644 --- a/code/modules/events/anomaly_bluespace.dm +++ b/code/modules/events/anomaly_bluespace.dm @@ -3,6 +3,5 @@ startWhen = 3 announceWhen = 10 anomaly_path = /obj/effect/anomaly/bluespace - -/datum/event/anomaly/anomaly_bluespace/announce() - GLOB.minor_announcement.Announce("Unstable bluespace anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert", 'sound/AI/anomaly_bluespace.ogg') + prefix_message = "Unstable bluespace anomaly detected on long range scanners." + announce_sound = 'sound/AI/anomaly_bluespace.ogg' diff --git a/code/modules/events/anomaly_cryo.dm b/code/modules/events/anomaly_cryo.dm index 614c2afae8b..ddfbb9b4a59 100644 --- a/code/modules/events/anomaly_cryo.dm +++ b/code/modules/events/anomaly_cryo.dm @@ -3,6 +3,5 @@ startWhen = 3 announceWhen = 10 anomaly_path = /obj/effect/anomaly/cryo - -/datum/event/anomaly/anomaly_cryo/announce() - GLOB.minor_announcement.Announce("Cryogenic anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert", 'sound/AI/anomaly_pyro.ogg') + prefix_message = "Cryogenic anomaly detected on long range scanners." + announce_sound = 'sound/AI/anomaly_pyro.ogg' diff --git a/code/modules/events/anomaly_event.dm b/code/modules/events/anomaly_event.dm index 4e80080feb6..14b0ae316cc 100644 --- a/code/modules/events/anomaly_event.dm +++ b/code/modules/events/anomaly_event.dm @@ -5,25 +5,43 @@ var/obj/effect/anomaly/anomaly_path = /obj/effect/anomaly/flux var/turf/target_turf announceWhen = 1 + /// The prefix message for the anomaly annoucement. + var/prefix_message = "Localized hyper-energetic flux wave detected on long range scanners." + /// Sound effect used + var/announce_sound = 'sound/AI/anomaly_flux.ogg' + /datum/event/anomaly/setup() + target_turf = find_targets(TRUE) + +/datum/event/anomaly/proc/find_targets(warn_on_fail = FALSE) + var/turf/target for(var/tries in 0 to TURF_FIND_TRIES) impact_area = findEventArea() if(!impact_area) - CRASH("No valid areas for anomaly found.") + if(warn_on_fail) + CRASH("No valid areas for anomaly found.") + else + return var/list/candidate_turfs = get_area_turfs(impact_area) while(length(candidate_turfs)) var/turf/candidate = pick_n_take(candidate_turfs) if(!is_blocked_turf(candidate,TRUE)) - target_turf = candidate + target = candidate break if(target_turf) break if(!target_turf) CRASH("Anomaly: Unable to find a valid turf to spawn the anomaly. Last area tried: [impact_area] - [impact_area.type]") -/datum/event/anomaly/announce() - GLOB.minor_announcement.Announce("Localized hyper-energetic flux wave detected on long range scanners. Expected location of impact: [impact_area.name].", "Anomaly Alert", 'sound/AI/anomaly_flux.ogg') + return target + +/datum/event/anomaly/announce(false_alarm) + var/area/target = false_alarm ? findEventArea() : impact_area + if(false_alarm && !target) + log_debug("Failed to find a valid area when trying to make a false alarm anomaly!") + return + GLOB.minor_announcement.Announce("[prefix_message] Expected location: [target.name].", "Anomaly Alert", announce_sound) /datum/event/anomaly/start() var/newAnomaly = new anomaly_path(target_turf) diff --git a/code/modules/events/anomaly_flux.dm b/code/modules/events/anomaly_flux.dm index c8192591c8c..553f43b569d 100644 --- a/code/modules/events/anomaly_flux.dm +++ b/code/modules/events/anomaly_flux.dm @@ -3,6 +3,5 @@ startWhen = 10 announceWhen = 3 anomaly_path = /obj/effect/anomaly/flux - -/datum/event/anomaly/anomaly_flux/announce() - GLOB.minor_announcement.Announce("Localized hyper-energetic flux wave detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert", 'sound/AI/anomaly_flux.ogg') + prefix_message = "Localized hyper-energetic flux wave detected on long range scanners." + announce_sound = 'sound/AI/anomaly_flux.ogg' diff --git a/code/modules/events/anomaly_grav.dm b/code/modules/events/anomaly_grav.dm index 9c978ea1c50..d4291d25389 100644 --- a/code/modules/events/anomaly_grav.dm +++ b/code/modules/events/anomaly_grav.dm @@ -3,6 +3,5 @@ startWhen = 3 announceWhen = 20 anomaly_path = /obj/effect/anomaly/grav - -/datum/event/anomaly/anomaly_grav/announce() - GLOB.minor_announcement.Announce("Gravitational anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert", 'sound/AI/anomaly_gravity.ogg') + prefix_message = "Gravitational anomaly detected on long range scanners." + announce_sound = 'sound/AI/anomaly_gravity.ogg' diff --git a/code/modules/events/anomaly_pyro.dm b/code/modules/events/anomaly_pyro.dm index be2a2573500..f3270a8dbfb 100644 --- a/code/modules/events/anomaly_pyro.dm +++ b/code/modules/events/anomaly_pyro.dm @@ -3,6 +3,5 @@ startWhen = 3 announceWhen = 10 anomaly_path = /obj/effect/anomaly/pyro - -/datum/event/anomaly/anomaly_pyro/announce() - GLOB.minor_announcement.Announce("Pyroclastic anomaly detected on long range scanners. Expected location: [impact_area.name].", "Anomaly Alert", 'sound/AI/anomaly_pyro.ogg') + prefix_message = "Pyroclastic anomaly detected on long range scanners." + announce_sound = 'sound/AI/anomaly_pyro.ogg' diff --git a/code/modules/events/anomaly_vortex.dm b/code/modules/events/anomaly_vortex.dm index cd27d32ddb7..26a26594fcf 100644 --- a/code/modules/events/anomaly_vortex.dm +++ b/code/modules/events/anomaly_vortex.dm @@ -3,6 +3,5 @@ startWhen = 10 announceWhen = 3 anomaly_path = /obj/effect/anomaly/bhole - -/datum/event/anomaly/anomaly_vortex/announce() - GLOB.minor_announcement.Announce("Localized high-intensity vortex anomaly detected on long range scanners. Expected location: [impact_area.name]", "Anomaly Alert", 'sound/AI/anomaly_vortex.ogg') + prefix_message = "Localized high-intensity vortex anomaly detected on long range scanners." + announce_sound = 'sound/AI/anomaly_vortex.ogg' diff --git a/code/modules/events/blob_spawn.dm b/code/modules/events/blob_spawn.dm index f5078ecd412..9fbff9dca07 100644 --- a/code/modules/events/blob_spawn.dm +++ b/code/modules/events/blob_spawn.dm @@ -3,8 +3,8 @@ endWhen = 240 var/successSpawn = FALSE //So we don't make a command report if nothing gets spawned. -/datum/event/blob/announce() - if(successSpawn) +/datum/event/blob/announce(false_alarm) + if(successSpawn || false_alarm) GLOB.major_announcement.Announce("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/AI/outbreak5.ogg') else log_and_message_admins("Warning: Could not spawn any mobs for event Blob") diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index 62d7e3b01e0..c8612e16346 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -13,8 +13,18 @@ "Advertising is legalized lying! But don't let that put you off our great deals!", \ "You don't want to buy anything? Yeah, well I didn't want to buy your mom either.") -/datum/event/brand_intelligence/announce() - GLOB.minor_announcement.Announce("Rampant brand intelligence has been detected aboard [station_name()], please stand-by. The origin is believed to be \a [originMachine.category] vendor.", "Machine Learning Alert", 'sound/AI/brand_intelligence.ogg') +/datum/event/brand_intelligence/announce(false_alarm) + var/alarm_source = originMachine + if(originMachine) + alarm_source = originMachine.category + else if(false_alarm) + alarm_source = pick(VENDOR_TYPE_GENERIC, VENDOR_TYPE_CLOTHING, VENDOR_TYPE_FOOD, VENDOR_TYPE_DRINK, VENDOR_TYPE_SUPPLIES, VENDOR_TYPE_DEPARTMENTAL, VENDOR_TYPE_RECREATION) + else + log_debug("Couldn't announce brand intelligence -- no machine was selected, and it wasn't a false alarm! Killing event.") + kill() + return + + GLOB.minor_announcement.Announce("Rampant brand intelligence has been detected aboard [station_name()], please stand-by. The origin is believed to be \a [alarm_source] vendor.", "Machine Learning Alert", 'sound/AI/brand_intelligence.ogg') /datum/event/brand_intelligence/start() var/list/obj/machinery/economy/vending/leaderables = list() diff --git a/code/modules/events/communications_blackout.dm b/code/modules/events/communications_blackout.dm index f99be7126c3..9d1931e5e2a 100644 --- a/code/modules/events/communications_blackout.dm +++ b/code/modules/events/communications_blackout.dm @@ -1,4 +1,4 @@ -/datum/event/communications_blackout/announce() +/datum/event/communications_blackout/announce(false_alarm) var/alert = pick( "Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you*%fj00)`5vc-BZZT", \ "Ionospheric anomalies detected. Temporary telecommunication failu*3mga;b4;'1v?-BZZZT", \ "Ionospheric anomalies detected. Temporary telec#MCi46:5.;@63-BZZZZT", \ @@ -11,7 +11,7 @@ to_chat(A, "[alert]") to_chat(A, "
") - if(prob(30)) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts. + if(prob(30) || false_alarm) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts. GLOB.minor_announcement.Announce(alert) /datum/event/communications_blackout/start() diff --git a/code/modules/events/event.dm b/code/modules/events/event.dm index b2d744b9e34..f82af011b84 100644 --- a/code/modules/events/event.dm +++ b/code/modules/events/event.dm @@ -99,7 +99,7 @@ * Only called once. * Ensure no sleep is called. Use INVOKE_ASYNC to call procs which do. */ -/datum/event/proc/announce() +/datum/event/proc/announce(false_alarm = FALSE) return /** @@ -172,9 +172,10 @@ SSevents.active_events -= src SSevents.event_complete(src) -/datum/event/New(datum/event_meta/EM) +/datum/event/New(datum/event_meta/EM, skeleton = FALSE) // event needs to be responsible for this, as stuff like APLUs currently make their own events for curious reasons - SSevents.active_events += src + if(!skeleton) + SSevents.active_events += src if(!EM) EM = new /datum/event_meta(EVENT_LEVEL_MAJOR, "Unknown, Most likely admin called", src.type) @@ -186,7 +187,8 @@ startedAt = world.time - setup() + if(!skeleton) + setup() ..() //Called after something followable has been spawned by an event @@ -195,3 +197,9 @@ /datum/event/proc/announce_to_ghosts(atom/atom_of_interest) if(atom_of_interest) notify_ghosts("[name] has an object of interest: [atom_of_interest]!", title = "Something's Interesting!", source = atom_of_interest, action = NOTIFY_FOLLOW) + +/// Override this to make a custom fake announcement that differs from the normal announcement. +/// Used for false alarms. +/// If this proc returns TRUE, the regular Announce() won't be called. +/datum/event/proc/fake_announce() + return FALSE diff --git a/code/modules/events/false_alarm.dm b/code/modules/events/false_alarm.dm index a4f8a191e74..6f58a8b94b7 100644 --- a/code/modules/events/false_alarm.dm +++ b/code/modules/events/false_alarm.dm @@ -1,46 +1,43 @@ /datum/event/falsealarm announceWhen = 0 endWhen = 1 + var/static/list/possible_event_types = list( + /datum/event/alien_infestation, + /datum/event/apc_overload, + /datum/event/apc_short, + /datum/event/blob, + /datum/event/brand_intelligence, + /datum/event/bureaucratic_error, + /datum/event/communications_blackout, + /datum/event/electrical_storm, + /datum/event/immovable_rod, + /datum/event/infestation, + /datum/event/ion_storm, + /datum/event/mass_hallucination, + /datum/event/meteor_wave, + /datum/event/prison_break, + /datum/event/rogue_drone, + /datum/event/solar_flare, + /datum/event/spider_infestation, + /datum/event/tear, + /datum/event/traders, + /datum/event/vent_clog + ) + subtypesof(/datum/event/anomaly) + subtypesof(/datum/event/carp_migration) + + var/datum/event/working_event + +/datum/event/falsealarm/start() + . = ..() + var/datum/event/working_event_type = pick(possible_event_types) + working_event = new working_event_type(skeleton = TRUE) + log_debug("False alarm selecting [working_event] to imitate") /datum/event/falsealarm/announce() - var/list/event - var/list/minor_fake_events = list( - list("A solar flare has been detected on collision course with the station. Do not conduct space walks or approach windows until the flare has passed!", "Incoming Solar Flare", 'sound/AI/flare.ogg'), - list("Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you*%fj00`5vc-BZZT"), - list("Overload detected in [station_name()]'s powernet. Engineering, please repair shorted APCs.", "Systems Power Failure", 'sound/AI/power_overload.ogg'), - list("Localized hyper-energetic flux wave detected on long range scanners. Expected location of impact: Kitchen.", "Anomaly Alert", 'sound/AI/anomaly_flux.ogg'), - list("Overload detected in [station_name()]'s powernet. Engineering, please check all underfloor APC terminals.", "Critical Power Failure", 'sound/AI/power_overload.ogg'), - list("Hostile runtime detected in door controllers. Isolation lockdown protocols are now in effect. Please remain calm.", "Network Alert", 'sound/AI/door_runtimes.ogg'), - list("Rampant brand intelligence has been detected aboard [station_name()], please stand-by. The origin is believed to be a vendomat.", "Machine Learning Alert", 'sound/AI/brand_intelligence.ogg'), - list("Massive migration of unknown biological entities has been detected near [station_name()], please stand-by.", "Lifesign Alert"), - list("An electrical storm has been detected in your area, please repair potential electronic overloads.", "Electrical Storm Alert", 'sound/AI/elec_storm.ogg'), - list("What the fuck was that?!", "General Alert"), - list("Bioscans indicate that spiders have been breeding in the vault. Clear them out, before this starts to affect productivity.", "Lifesign Alert"), - list("Ion storm detected near the station. Please check all AI-controlled equipment for errors.", "Anomaly Alert", 'sound/AI/ions.ogg'), - list("The [station_name()] is passing through a minor radiation field. Be advised that acute exposure to space radiation can induce hallucinogenic episodes."), - list("Meteors have been detected on collision course with the station.", "Meteor Alert", 'sound/AI/meteors.ogg'), - list("Malignant trojan detected in [station_name()] imprisonment subroutines. Secure any compromised areas immediately. Station AI involvement is recommended.", "Security Alert"), - list("High levels of radiation detected near the station. Maintenance is best shielded from radiation.", "Anomaly Alert", 'sound/AI/radiation.ogg'), - list("Contact has been lost with a combat drone wing operating out of the NSV Icarus. If any are sighted in the area, approach with caution.", "Rogue drone alert"), - list("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", 'sound/AI/aliens.ogg'), - list("A Honknomoly has opened. Expected location: Clown's Office.", "Honknomoly Alert", 'sound/items/airhorn.ogg'), - list("A tear in the fabric of space and time has opened. Expected location: Mime's Office.", "Anomaly Alert", 'sound/AI/anomaly.ogg'), - list("A trading shuttle from Jupiter Station has been granted docking permission at [station_name()] arrivals port 4.", "Trader Shuttle Docking Request Accepted"), - list("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert", 'sound/AI/scrubbers.ogg'), - list("Space-time anomalies detected on the station. There is no additional data.", "Anomaly Alert", 'sound/AI/spanomalies.ogg') - ) + if(working_event.fake_announce()) + return + working_event.announce(TRUE) + message_admins("False Alarm: [working_event]") + kill() - var/list/major_fake_events = list( - list("Confirmed outbreak of level 3-X biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/AI/outbreak3.ogg', 'sound/effects/siren-spooky.ogg'), - list("Confirmed outbreak of level 3-S biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/AI/outbreak3.ogg', 'sound/effects/siren-spooky.ogg'), - list("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/AI/outbreak5.ogg') - ) - - if(prob(90)) - event = pick_n_take(minor_fake_events) - GLOB.minor_announcement.Announce(event[1], listgetindex(event, 2), listgetindex(event, 3)) - else - event = pick_n_take(major_fake_events) - GLOB.major_announcement.Announce(event[1], listgetindex(event, 2), listgetindex(event, 3), new_sound2 = listgetindex(event, 4)) - - message_admins("False Alarm: [event[1]]") +/datum/event/falsealarm/end() + QDEL_NULL(working_event) diff --git a/code/modules/events/infestation.dm b/code/modules/events/infestation.dm index 90edfe99e46..faeebc623e1 100644 --- a/code/modules/events/infestation.dm +++ b/code/modules/events/infestation.dm @@ -1,14 +1,3 @@ -#define LOC_KITCHEN 0 -#define LOC_ATMOS 1 -#define LOC_INCIN 2 -#define LOC_CHAPEL 3 -#define LOC_LIBRARY 4 -#define LOC_HYDRO 5 -#define LOC_VAULT 6 -#define LOC_CONSTR 7 -#define LOC_TECH 8 -#define LOC_ARMORY 9 - #define VERM_MICE 0 #define VERM_LIZARDS 1 #define VERM_SPIDERS 2 @@ -20,53 +9,36 @@ var/locstring var/vermin var/vermstring + var/static/list/spawn_areas = list( + /area/station/service/kitchen = "the kitchen", + /area/station/engineering/atmos = "atmospherics", + /area/station/maintenance/incinerator = "the incinerator", + /area/station/service/chapel = "the chapel", + /area/station/service/library = "the library", + /area/station/service/hydroponics = "hydroponics", + /area/station/command/vault = "the vault", + /area/station/public/construction = "the construction area", + /area/station/engineering/tech_storage = "technical storage", + /area/station/security/armory/secure = "the armory" + ) /datum/event/infestation/start() - - location = rand(0,9) var/list/turf/simulated/floor/turfs = list() - var/spawn_area_type - switch(location) - if(LOC_KITCHEN) - spawn_area_type = /area/station/service/kitchen - locstring = "the kitchen" - if(LOC_ATMOS) - spawn_area_type = /area/station/engineering/atmos - locstring = "atmospherics" - if(LOC_INCIN) - spawn_area_type = /area/station/maintenance/incinerator - locstring = "the incinerator" - if(LOC_CHAPEL) - spawn_area_type = /area/station/service/chapel - locstring = "the chapel" - if(LOC_LIBRARY) - spawn_area_type = /area/station/service/library - locstring = "the library" - if(LOC_HYDRO) - spawn_area_type = /area/station/service/hydroponics - locstring = "hydroponics" - if(LOC_VAULT) - spawn_area_type = /area/station/command/vault - locstring = "the vault" - if(LOC_CONSTR) - spawn_area_type = /area/station/public/construction - locstring = "the construction area" - if(LOC_TECH) - spawn_area_type = /area/station/engineering/tech_storage - locstring = "technical storage" - if(LOC_ARMORY) - spawn_area_type = /area/station/security/armory/secure - locstring = "armory" - + var/area/spawn_area_type = pick(spawn_areas) + locstring = spawn_areas[location] for(var/areapath in typesof(spawn_area_type)) var/area/A = locate(areapath) + if(!A) + log_debug("Failed to locate area for infestation event!") + kill() + return for(var/turf/simulated/floor/F in A.contents) if(turf_clear(F)) turfs += F var/list/spawn_types = list() var/max_number - vermin = rand(0,2) + vermin = rand(0, 2) switch(vermin) if(VERM_MICE) spawn_types = list(/mob/living/simple_animal/mouse/gray, /mob/living/simple_animal/mouse/brown, /mob/living/simple_animal/mouse/white) @@ -93,17 +65,14 @@ new spawn_type(T) -/datum/event/infestation/announce() - GLOB.minor_announcement.Announce("Bioscans indicate that [vermstring] have been breeding in [locstring]. Clear them out, before this starts to affect productivity.", "Lifesign Alert") +/datum/event/infestation/announce(false_alarm) + var/vermin_chosen = vermstring || pick("spiders", "lizards", "mice") + var/location_str = locstring + if(false_alarm) + var/area/loc_area = pick(spawn_areas) + location_str = spawn_areas[loc_area] -#undef LOC_KITCHEN -#undef LOC_ATMOS -#undef LOC_INCIN -#undef LOC_CHAPEL -#undef LOC_LIBRARY -#undef LOC_HYDRO -#undef LOC_VAULT -#undef LOC_TECH + GLOB.minor_announcement.Announce("Bioscans indicate that [vermin_chosen] have been breeding in [location_str]. Clear them out, before this starts to affect productivity.", "Lifesign Alert") #undef VERM_MICE #undef VERM_LIZARDS diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm index 08333a4f203..08fee5b6792 100644 --- a/code/modules/events/ion_storm.dm +++ b/code/modules/events/ion_storm.dm @@ -9,15 +9,15 @@ var/ionAnnounceChance = 33 announceWhen = 1 -/datum/event/ion_storm/New(botEmagChance = 10, announceEvent = ION_NOANNOUNCEMENT, ionMessage = null, ionAnnounceChance = 33) +/datum/event/ion_storm/New(datum/event_meta/EM, skeleton = FALSE, botEmagChance = 10, announceEvent = ION_NOANNOUNCEMENT, ionMessage = null, ionAnnounceChance = 33) src.botEmagChance = botEmagChance src.announceEvent = announceEvent src.ionMessage = ionMessage src.ionAnnounceChance = ionAnnounceChance ..() -/datum/event/ion_storm/announce() - if(announceEvent == ION_ANNOUNCE || (announceEvent == ION_RANDOM && prob(ionAnnounceChance))) +/datum/event/ion_storm/announce(false_alarm) + if(announceEvent == ION_ANNOUNCE || (announceEvent == ION_RANDOM && prob(ionAnnounceChance)) || false_alarm) GLOB.minor_announcement.Announce("Ion storm detected near the station. Please check all AI-controlled equipment for errors.", "Anomaly Alert", 'sound/AI/ions.ogg') /datum/event/ion_storm/start() diff --git a/code/modules/events/meteors_event.dm b/code/modules/events/meteors_event.dm index ddecbd8540b..24ede06bf92 100644 --- a/code/modules/events/meteors_event.dm +++ b/code/modules/events/meteors_event.dm @@ -13,12 +13,11 @@ waves = severity * 2 + rand(0, severity) //4-6 waves on medium. 6-9 waves on major. More consistant. -/datum/event/meteor_wave/announce() - switch(severity) - if(EVENT_LEVEL_MAJOR) - GLOB.minor_announcement.Announce("Meteors have been detected on collision course with the station.", "Meteor Alert", new_sound = 'sound/AI/meteors.ogg') - else - GLOB.minor_announcement.Announce("The station is now in a meteor shower.", "Meteor Alert") +/datum/event/meteor_wave/announce(false_alarm) + if(severity == EVENT_LEVEL_MAJOR || (false_alarm && prob(30))) + GLOB.minor_announcement.Announce("Meteors have been detected on collision course with the station.", "Meteor Alert", new_sound = 'sound/AI/meteors.ogg') + else + GLOB.minor_announcement.Announce("The station is now in a meteor shower.", "Meteor Alert") //meteor showers are lighter and more common, /datum/event/meteor_wave/tick() diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm index 43f01b8c670..957d98dd1b5 100644 --- a/code/modules/events/prison_break.dm +++ b/code/modules/events/prison_break.dm @@ -35,8 +35,8 @@ src.endWhen = src.releaseWhen+2 -/datum/event/prison_break/announce() - if(areas && areas.len > 0) +/datum/event/prison_break/announce(false_alarm) + if(length(areas) || false_alarm) GLOB.minor_announcement.Announce("[pick("Gr3y.T1d3 virus","Malignant trojan")] detected in [station_name()] [(eventDept == "Security")? "imprisonment":"containment"] subroutines. Secure any compromised areas immediately. Station AI involvement is recommended.", "[eventDept] Alert") /datum/event/prison_break/start() diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index f4f45a38961..cfe58e22ba6 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -10,8 +10,8 @@ GLOBAL_VAR_INIT(sent_spiders_to_station, 0) spawncount = round(num_players() * 0.8) GLOB.sent_spiders_to_station = 1 -/datum/event/spider_infestation/announce() - if(successSpawn) +/datum/event/spider_infestation/announce(false_alarm) + if(successSpawn || false_alarm) GLOB.minor_announcement.Announce("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg') else log_and_message_admins("Warning: Could not spawn any mobs for event Spider Infestation") diff --git a/code/modules/events/spider_terror.dm b/code/modules/events/spider_terror.dm index c8483bffed4..c90115a7518 100644 --- a/code/modules/events/spider_terror.dm +++ b/code/modules/events/spider_terror.dm @@ -14,8 +14,8 @@ announceWhen = rand(announceWhen, announceWhen + 30) spawncount = 1 -/datum/event/spider_terror/announce() - if(successSpawn) +/datum/event/spider_terror/announce(false_alarm) + if(successSpawn || false_alarm) GLOB.major_announcement.Announce("Confirmed outbreak of level 3-S biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/effects/siren-spooky.ogg', new_sound2 = 'sound/AI/outbreak3.ogg') else log_and_message_admins("Warning: Could not spawn any mobs for event Terror Spiders") diff --git a/code/modules/events/tear.dm b/code/modules/events/tear.dm index e1428de6558..506be351fc5 100644 --- a/code/modules/events/tear.dm +++ b/code/modules/events/tear.dm @@ -40,8 +40,17 @@ /datum/event/tear/proc/spawn_tear(location) TE = new /obj/effect/tear(location) -/datum/event/tear/announce() - GLOB.minor_announcement.Announce("A tear in the fabric of space and time has opened. Expected location: [impact_area.name].", "Anomaly Alert", 'sound/AI/anomaly.ogg') +/datum/event/tear/announce(false_alarm) + var/area/target_area = impact_area + if(!target_area) + if(false_alarm) + target_area = findEventArea() + else + log_debug("Tried to announce a tear without a valid area!") + kill() + return + + GLOB.minor_announcement.Announce("A tear in the fabric of space and time has opened. Expected location: [target_area.name].", "Anomaly Alert", 'sound/AI/anomaly.ogg') /datum/event/tear/end() if(TE) diff --git a/code/modules/events/traders.dm b/code/modules/events/traders.dm index f299f9b10d9..52d5b1542da 100644 --- a/code/modules/events/traders.dm +++ b/code/modules/events/traders.dm @@ -13,6 +13,14 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol")) if(GLOB.unused_trade_stations.len) station = pick_n_take(GLOB.unused_trade_stations) +/datum/event/traders/fake_announce() + . = TRUE + if(seclevel2num(get_security_level()) >= SEC_LEVEL_RED) + GLOB.minor_announcement.Announce("A trading shuttle from Jupiter Station has been denied docking permission due to the heightened security alert aboard [station_name()].", "Trader Shuttle Docking Request Refused") + return + GLOB.minor_announcement.Announce("A trading shuttle from Jupiter Station has been granted docking permission at [station_name()] arrivals port 4.", "Trader Shuttle Docking Request Accepted") + + /datum/event/traders/start() if(!station) // If there are no unused stations, just no. return