From 73a95ed5dffafa6aadc189147b5299b51a73f6e4 Mon Sep 17 00:00:00 2001 From: Geeves Date: Tue, 9 Jan 2024 18:41:57 +0200 Subject: [PATCH] Overmap Announcements Overhaul (#16460) * Overmap Announcements * overdoing it a little * update cl * whoops --- code/defines/procs/announce.dm | 8 +-- code/modules/economy/Events.dm | 4 ++ code/modules/events/apc_damage.dm | 3 + code/modules/events/blob.dm | 4 +- code/modules/events/brand_intelligence.dm | 6 +- code/modules/events/camera_damage.dm | 2 + code/modules/events/carp_migration.dm | 36 ++++++----- code/modules/events/ccia_general_notice.dm | 4 +- .../modules/events/communications_blackout.dm | 4 +- code/modules/events/electrical_storm.dm | 49 +++++++------- code/modules/events/event.dm | 50 ++++++++++++--- code/modules/events/event_container.dm | 5 +- code/modules/events/false_alarm.dm | 2 + code/modules/events/gravity.dm | 16 ++--- code/modules/events/grid_check.dm | 2 + code/modules/events/infestation.dm | 2 + code/modules/events/ion_storm.dm | 59 ++++++++--------- code/modules/events/maint_drones.dm | 2 + code/modules/events/meteors.dm | 64 +++++++++---------- code/modules/events/money_hacker.dm | 8 ++- code/modules/events/money_lotto.dm | 2 + code/modules/events/prison_break.dm | 4 ++ code/modules/events/random_antagonist.dm | 2 + code/modules/events/rescue_pod.dm | 4 ++ code/modules/events/rogue_drones.dm | 6 +- code/modules/events/spacevine.dm | 4 +- code/modules/events/spider_infestation.dm | 2 + .../events/spontaneous_appendicitis.dm | 2 + code/modules/events/supply_drop.dm | 2 + code/modules/events/visitor.dm | 2 + code/modules/events/wallrot.dm | 5 ++ code/modules/overmap/events/event.dm | 30 ++++----- .../overmap/ships/computers/sensors.dm | 5 ++ code/modules/psionics/events/_psi.dm | 12 ++-- code/modules/psionics/events/mini_spasm.dm | 12 ++-- .../geeves-overmap_announcement.yml | 8 +++ 36 files changed, 271 insertions(+), 161 deletions(-) create mode 100644 html/changelogs/geeves-overmap_announcement.yml diff --git a/code/defines/procs/announce.dm b/code/defines/procs/announce.dm index b80fe09fd00..e3a89dce180 100644 --- a/code/defines/procs/announce.dm +++ b/code/defines/procs/announce.dm @@ -100,11 +100,11 @@ // Format currently matches that of newscaster feeds: Registered Name (Assigned Rank) return I.assignment ? "[I.registered_name], [I.assignment]" : I.registered_name -/proc/level_seven_announcement() - command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/level_7_biohazard.ogg') +/proc/level_seven_announcement(var/list/affecting_z = current_map.station_levels) + command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/level_7_biohazard.ogg', zlevels = affecting_z) -/proc/ion_storm_announcement() - command_announcement.Announce("It has come to our attention that the ship has passed through an ion storm. Please monitor all electronic equipment for malfunctions.", "Anomaly Alert") +/proc/ion_storm_announcement(var/list/affecting_z = current_map.station_levels) + command_announcement.Announce("It has come to our attention that the ship has passed through an ion storm. Please monitor all electronic equipment for malfunctions.", "Anomaly Alert", zlevels = affecting_z) /proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank, var/join_message) if(SSticker.current_state == GAME_STATE_PLAYING) diff --git a/code/modules/economy/Events.dm b/code/modules/economy/Events.dm index 9d50c06c37c..cf62549c518 100644 --- a/code/modules/economy/Events.dm +++ b/code/modules/economy/Events.dm @@ -8,6 +8,8 @@ var/datum/trade_destination/affected_dest /datum/event/economic_event/start() + ..() + affected_dest = pickweight(weighted_randomevent_locations) if(affected_dest.viable_random_events.len) endWhen = rand(60,300) @@ -93,6 +95,8 @@ SSnews.SubmitArticle(body, author, ch, null, 1) /datum/event/economic_event/end() + ..() + for(var/good_type in dearer_goods) affected_dest.temp_price_change[good_type] = 1 for(var/good_type in cheaper_goods) diff --git a/code/modules/events/apc_damage.dm b/code/modules/events/apc_damage.dm index 290b7164f4d..fdc344ab208 100644 --- a/code/modules/events/apc_damage.dm +++ b/code/modules/events/apc_damage.dm @@ -1,7 +1,10 @@ /datum/event/apc_damage var/apcSelectionRange = 25 no_fake = 1 + /datum/event/apc_damage/start() + ..() + var/obj/machinery/power/apc/A = acquire_random_apc() var/severity_range = 0 diff --git a/code/modules/events/blob.dm b/code/modules/events/blob.dm index 23406c360c0..f507e85b305 100644 --- a/code/modules/events/blob.dm +++ b/code/modules/events/blob.dm @@ -5,9 +5,11 @@ ic_name = "a biohazard" /datum/event/blob/announce() - level_seven_announcement() + level_seven_announcement(affecting_z) /datum/event/blob/start() + ..() + var/turf/T = pick_subarea_turf(/area/maintenance, list(/proc/is_station_turf, /proc/not_turf_contains_dense_objects)) if(!T) log_and_message_admins("Blob failed to find a viable turf.") diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index 1ac6d8017fb..d109c6b9294 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -8,10 +8,12 @@ /datum/event/brand_intelligence/announce() - command_announcement.Announce("Rampant brand intelligence has been detected aboard the [location_name()]. The origin is believed to be \a \"[initial(originMachine.name)]\" type. Infection of other machines is likely.", "[station_name()] Machine Monitoring" , new_sound = 'sound/AI/brandintelligence.ogg') + command_announcement.Announce("Rampant brand intelligence has been detected aboard the [location_name()]. The origin is believed to be \a \"[initial(originMachine.name)]\" type. Infection of other machines is likely.", "[station_name()] Machine Monitoring" , new_sound = 'sound/AI/brandintelligence.ogg', zlevels = affecting_z) /datum/event/brand_intelligence/start() + ..() + for(var/obj/machinery/vending/V in SSmachinery.processing) if(isNotStationLevel(V.z)) continue vendingMachines.Add(V) @@ -53,6 +55,8 @@ ) /datum/event/brand_intelligence/end(var/faked) + ..() + for(var/obj/machinery/vending/infectedMachine in infectedVendingMachines) infectedMachine.shut_up = 1 infectedMachine.shoot_inventory = 0 diff --git a/code/modules/events/camera_damage.dm b/code/modules/events/camera_damage.dm index 7f5b90888d4..8888b1e7572 100644 --- a/code/modules/events/camera_damage.dm +++ b/code/modules/events/camera_damage.dm @@ -1,4 +1,6 @@ /datum/event/camera_damage/start() + ..() + var/obj/machinery/camera/C = acquire_random_camera() if(!C) return diff --git a/code/modules/events/carp_migration.dm b/code/modules/events/carp_migration.dm index 3e5d4fb6752..bfef4d448ae 100644 --- a/code/modules/events/carp_migration.dm +++ b/code/modules/events/carp_migration.dm @@ -20,19 +20,18 @@ despawn_turfs = typecacheof(despawn_turfs) /datum/event/carp_migration/announce() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - var/announcement = "" - var/soundfile = 'sound/AI/carp_migration.ogg' - if(severity == EVENT_LEVEL_MAJOR && deploy_drones) - announcement = "A massive migration of unknown biological entities has been detected near [location_name()], please stand-by." - soundfile = 'sound/AI/massivespacecarp.ogg' - else - announcement = "Unknown biological [length(spawned_carp) == 1 ? "entity has" : "entities have"] been detected near [location_name()], please stand-by." - command_announcement.Announce(announcement, "Lifesign Alert", new_sound = soundfile) - break + var/announcement = "" + var/soundfile = 'sound/AI/carp_migration.ogg' + if(severity == EVENT_LEVEL_MAJOR && deploy_drones) + announcement = "A massive migration of unknown biological entities has been detected near [location_name()], please stand-by." + soundfile = 'sound/AI/massivespacecarp.ogg' + else + announcement = "Unknown biological [length(spawned_carp) == 1 ? "entity has" : "entities have"] been detected near [location_name()], please stand-by." + command_announcement.Announce(announcement, "Lifesign Alert", new_sound = soundfile, zlevels = affecting_z) /datum/event/carp_migration/start() + ..() + if(severity == EVENT_LEVEL_MAJOR) spawn_fish(length(GLOB.landmarks_list), spawn_drones = deploy_drones) spawn_caverndweller(length(GLOB.landmarks_list), spawn_drones = deploy_drones) @@ -95,6 +94,8 @@ i++ /datum/event/carp_migration/end(var/faked) + ..() + for (var/carp_ref in spawned_carp) var/datum/weakref/carp_weakref = carp_ref var/mob/living/simple_animal/hostile/carp/fish = carp_weakref.resolve() @@ -102,13 +103,12 @@ qdel(fish) /datum/event/carp_migration/cozmo/start() + ..() + spawn_fish(7, 3, 5) /datum/event/carp_migration/cozmo/announce() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - command_announcement.Announce("A migration of non-hostile entities has been detected near the ship.", "Lifesign Alert", 'sound/AI/cozmo_migration.ogg') - break + command_announcement.Announce("A migration of non-hostile entities has been detected near the ship.", "Lifesign Alert", 'sound/AI/cozmo_migration.ogg', zlevels = affecting_z) /datum/event/carp_migration/cozmo/spawn_fish(var/num_groups, var/group_size_min = 3, var/group_size_max = 5, var/spawn_drones = FALSE) set waitfor = FALSE @@ -132,6 +132,10 @@ despawn_turfs = list(/turf/space) deploy_drones = FALSE +/datum/event/carp_migration/overmap/setup_for_overmap(var/obj/effect/overmap/visitable/ship/ship, var/obj/effect/overmap/event/hazard) + . = ..() + if(!announce_to_sensor_console) + announceWhen = 0 + /datum/event/carp_migration/overmap/setup() - announceWhen = 1 despawn_turfs = typecacheof(despawn_turfs) diff --git a/code/modules/events/ccia_general_notice.dm b/code/modules/events/ccia_general_notice.dm index 6ee109b7c17..fdf2c7930ec 100644 --- a/code/modules/events/ccia_general_notice.dm +++ b/code/modules/events/ccia_general_notice.dm @@ -5,6 +5,8 @@ no_fake = 1 /datum/event/ccia_general_notice/start() + ..() + if (!establish_db_connection(GLOB.dbcon)) LOG_DEBUG("CCIA Autoamtic General Notice - Could not establish database connection") return @@ -18,4 +20,4 @@ /datum/event/ccia_general_notice/announce() if(announce) - command_announcement.Announce("[reportbody]", reporttitle, new_sound = 'sound/AI/commandreport.ogg', msg_sanitized = 1, do_newscast=1, do_print=1); + command_announcement.Announce("[reportbody]", reporttitle, new_sound = 'sound/AI/commandreport.ogg', msg_sanitized = 1, do_newscast=1, do_print=1) diff --git a/code/modules/events/communications_blackout.dm b/code/modules/events/communications_blackout.dm index be794a9d937..cf824d15305 100644 --- a/code/modules/events/communications_blackout.dm +++ b/code/modules/events/communications_blackout.dm @@ -16,12 +16,14 @@ to_chat(A, "
") if(prob(30)) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts. - command_announcement.Announce(alert) + command_announcement.Announce(alert, zlevels = affecting_z) return return 1 /datum/event/communications_blackout/start() + ..() + for(var/obj/machinery/telecomms/T in SSmachinery.all_telecomms) if(T.z in affecting_z) T.emp_act(EMP_HEAVY) diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index d3becee1649..05192c5cdaa 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -19,32 +19,32 @@ return res /datum/event/electrical_storm/announce() - ..() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - switch(severity) - if(EVENT_LEVEL_MUNDANE) - command_announcement.Announce("A minor electrical storm has been detected near the [location_name()]. Please watch out for possible electrical discharges.", "[location_name()] Sensor Array", new_sound = 'sound/AI/electrical_storm.ogg', zlevels = affecting_z) - if(EVENT_LEVEL_MODERATE) - command_announcement.Announce("The [location_name()] is about to pass through an electrical storm. Please secure sensitive electrical equipment until the storm passes.", "[location_name()] Sensor Array", new_sound = 'sound/AI/electrical_storm.ogg', zlevels = affecting_z) - if(EVENT_LEVEL_MAJOR) - command_announcement.Announce("Alert. A strong electrical storm has been detected in proximity of the [location_name()]. It is recommended to immediately secure sensitive electrical equipment until the storm passes.", "[location_name()] Sensor Array", new_sound = 'sound/AI/electrical_storm.ogg', zlevels = affecting_z) - break + switch(severity) + if(EVENT_LEVEL_MUNDANE) + command_announcement.Announce("A minor electrical storm has been detected near the [location_name()]. Please watch out for possible electrical discharges.", "[location_name()] Sensor Array", new_sound = 'sound/AI/electrical_storm.ogg', zlevels = affecting_z) + if(EVENT_LEVEL_MODERATE) + command_announcement.Announce("The [location_name()] is about to pass through an electrical storm. Please secure sensitive electrical equipment until the storm passes.", "[location_name()] Sensor Array", new_sound = 'sound/AI/electrical_storm.ogg', zlevels = affecting_z) + if(EVENT_LEVEL_MAJOR) + command_announcement.Announce("Alert. A strong electrical storm has been detected in proximity of the [location_name()]. It is recommended to immediately secure sensitive electrical equipment until the storm passes.", "[location_name()] Sensor Array", new_sound = 'sound/AI/electrical_storm.ogg', zlevels = affecting_z) -/datum/event/electrical_storm/start() - ..() +/datum/event/electrical_storm/setup() valid_apcs = list() for(var/obj/machinery/power/apc/A in SSmachinery.machinery) - if(A.z in affecting_z && !A.is_critical) - valid_apcs.Add(A) - if(!valid_apcs.len) - kill(TRUE) + if((A.z in affecting_z) && !A.is_critical) + valid_apcs += A endWhen = (severity * 60) + startWhen +/datum/event/electrical_storm/end(faked) + ..() + + valid_apcs = null + /datum/event/electrical_storm/tick() ..() - if(!valid_apcs.len) - CRASH("No valid APCs found for electrical storm event! This is likely a bug.") + + if(!length(valid_apcs)) + return + var/list/picked_apcs = list() for(var/i=0, i< severity*2, i++) // up to 2/4/6 APCs per tick depending on severity picked_apcs |= pick(valid_apcs) @@ -69,10 +69,7 @@ if(prob((0.2 * severity) - 0.2)) T.set_broken() -/datum/event/electrical_storm/end() - ..() - valid_apcs = null - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - command_announcement.Announce("The [location_name()] has cleared the electrical storm. Please repair any electrical overloads.", "Electrical Storm Alert", zlevels = affecting_z) - break +/datum/event/electrical_storm/announce_end() + . = ..() + if(.) + command_announcement.Announce("The [location_name()] has cleared the electrical storm. Please repair any electrical overloads.", "Electrical Storm Alert", zlevels = affecting_z) diff --git a/code/modules/events/event.dm b/code/modules/events/event.dm index d2cc4fa4505..16d606f4bf5 100644 --- a/code/modules/events/event.dm +++ b/code/modules/events/event.dm @@ -90,6 +90,8 @@ //used for events that run secondary announcements, like releasing maint access. var/has_skybox_image = FALSE + var/obj/effect/overmap/visitable/ship/affected_ship + var/announce_to_sensor_console = FALSE /datum/event/nothing no_fake = 1 @@ -105,9 +107,10 @@ //Allows you to start before announcing or vice versa. //Only called once. /datum/event/proc/start() + SHOULD_CALL_PARENT(TRUE) if(has_skybox_image) SSskybox.rebuild_skyboxes(affecting_z) - return + announce_start() //Called when the tick is equal to the announceWhen variable. //Allows you to announce before starting or vice versa. @@ -115,6 +118,18 @@ /datum/event/proc/announce() return +/datum/event/proc/announce_start() + if(announce_to_sensor_console) + send_sensor_message("Entering [ic_name].") + return FALSE + return TRUE + +/datum/event/proc/announce_end(var/faked) + if(announce_to_sensor_console) + send_sensor_message("Exiting [ic_name].") + return FALSE + return TRUE + //Called on or after the tick counter is equal to startWhen. //You can include code related to your event or add your own //time stamped events. @@ -129,8 +144,9 @@ //For example: if(activeFor == myOwnVariable + 30) doStuff() //Only called once. //faked indicates this is a false alarm. Used to prevent announcements and other things from happening during false alarms. -/datum/event/proc/end() - return +/datum/event/proc/end(var/faked) + SHOULD_CALL_PARENT(TRUE) + announce_end(faked) //Returns the latest point of event processing. /datum/event/proc/lastProcessAt() @@ -181,7 +197,7 @@ SSevents.event_complete(src) -/datum/event/New(var/datum/event_meta/EM = null, var/is_dummy = 0) +/datum/event/New(var/datum/event_meta/EM = null, var/is_dummy = 0, var/obj/effect/overmap/visitable/ship/overmap_ship, var/obj/effect/overmap/event/overmap_hazard) dummy = is_dummy event_meta = EM if (event_meta) @@ -193,14 +209,18 @@ if (dummy) return - // event needs to be responsible for this, as stuff like APLUs currently make their own events for curious reasons - SSevents.active_events += src - startedAt = world.time + + setup() + if(overmap_ship && overmap_hazard) + setup_for_overmap(overmap_ship, overmap_hazard) if(!affecting_z) affecting_z = current_map.station_levels - setup() + // event needs to be responsible for this, as stuff like APLUs currently make their own events for curious reasons + SSevents.active_events += src + startedAt = world.time + ..() /datum/event/proc/location_name() @@ -212,3 +232,17 @@ /datum/event/proc/get_skybox_image() return + +/datum/event/proc/setup_for_overmap(var/obj/effect/overmap/visitable/ship/ship, var/obj/effect/overmap/event/hazard) + startWhen = 0 + endWhen = INFINITY + affecting_z = ship.map_z + affected_ship = ship + announce_to_sensor_console = istype(ship, /obj/effect/overmap/visitable/ship/landable) + if(announce_to_sensor_console) + announceWhen = -1 + ic_name = hazard.name + +/datum/event/proc/send_sensor_message(var/message) + for(var/obj/machinery/computer/ship/sensors/console in affected_ship.consoles) + console.display_message(message) diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index c37108c1d88..a357840662c 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -214,7 +214,10 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT new /datum/event_meta(EVENT_LEVEL_MODERATE, "Appendicitis", /datum/event/spontaneous_appendicitis, 0, list(ASSIGNMENT_SURGEON = 25)), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Communication Blackout", /datum/event/communications_blackout, 100), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Electrical Storm", /datum/event/electrical_storm, 50, list(ASSIGNMENT_ENGINEER = 15, ASSIGNMENT_JANITOR = 20)), - new /datum/event_meta(EVENT_LEVEL_MODERATE, "Gravity Failure", /datum/event/gravity, 100), + // see comment at code/modules/events/gravity.dm + // tl;dr gravity is handled globally, meaning if the horizon loses gravity, everyone does + // this needs to be fixed before we can uncomment this + // new /datum/event_meta(EVENT_LEVEL_MODERATE, "Gravity Failure", /datum/event/gravity, 100), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Ion Storm", /datum/event/ionstorm, 0, list(ASSIGNMENT_AI = 45, ASSIGNMENT_CYBORG = 25, ASSIGNMENT_ENGINEER = 6, ASSIGNMENT_SCIENTIST = 6)), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Prison Break", /datum/event/prison_break, 0, list(ASSIGNMENT_SECURITY = 15, ASSIGNMENT_CYBORG = 20), TRUE), new /datum/event_meta(EVENT_LEVEL_MODERATE, "Containment Error - Xenobiology", /datum/event/prison_break/xenobiology, 0, list(ASSIGNMENT_SCIENTIST = 15, ASSIGNMENT_CYBORG = 20), TRUE), diff --git a/code/modules/events/false_alarm.dm b/code/modules/events/false_alarm.dm index ed6e658e0bb..d2628cdaabd 100644 --- a/code/modules/events/false_alarm.dm +++ b/code/modules/events/false_alarm.dm @@ -13,6 +13,8 @@ /datum/event/false_alarm/end(var/faked) + ..() + command_announcement.Announce("Error, It appears our previous announcement about [eventname] was a sensor glitch. There is no cause for alarm, please return to your stations.", "False Alarm", new_sound = 'sound/AI/falsealarm.ogg', zlevels = affecting_z) if(two_part) E.end() //This does not return TRUE for var/faked because two-part events like radiation storms need to do things such as revoking maint access diff --git a/code/modules/events/gravity.dm b/code/modules/events/gravity.dm index adb16edae69..4f47aa9156b 100644 --- a/code/modules/events/gravity.dm +++ b/code/modules/events/gravity.dm @@ -7,14 +7,14 @@ endWhen = rand(15, 60) /datum/event/gravity/announce() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - command_announcement.Announce("Feedback surge detected in the gravity generation systems. Artificial gravity has been disabled whilst the system reinitializes. Further failures may result in a gravitational collapse and formation of blackholes.", "Gravity Failure", zlevels = affecting_z) - break + command_announcement.Announce("Feedback surge detected in the gravity generation systems. Artificial gravity has been disabled whilst the system reinitializes. Further failures may result in a gravitational collapse and formation of blackholes.", "Gravity Failure", zlevels = affecting_z) /datum/event/gravity/start() + ..() + + // TO-DO: I'm not gonna touch this can of worms right now, but this effectively means that gravity is global for everyone, + // meaning, if the horizon loses gravity, EVERYONE DOES. this seriously needs to be fixed, and i'm commenting out the gravity flux event until that is done GLOB.gravity_is_on = 0 - for(var/A in SSmachinery.gravity_generators) - var/obj/machinery/gravity_generator/main/B = A - if(B.z in affecting_z) - B.eventshutofftoggle() + for(var/obj/machinery/gravity_generator/main/generator in SSmachinery.gravity_generators) + if(generator.z in affecting_z) + generator.eventshutofftoggle() diff --git a/code/modules/events/grid_check.dm b/code/modules/events/grid_check.dm index b8c8812b4de..dad4fb35fad 100644 --- a/code/modules/events/grid_check.dm +++ b/code/modules/events/grid_check.dm @@ -3,6 +3,8 @@ no_fake = 1 /datum/event/grid_check/start() + ..() + power_failure(0, severity) /datum/event/grid_check/announce() diff --git a/code/modules/events/infestation.dm b/code/modules/events/infestation.dm index 14b4212375d..6a02a44ada3 100644 --- a/code/modules/events/infestation.dm +++ b/code/modules/events/infestation.dm @@ -51,6 +51,8 @@ choose_mobs() /datum/event/infestation/start() + ..() + spawn_mobs() /datum/event/infestation/proc/choose_area() diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm index 249f118c34f..4ff3d3514e6 100644 --- a/code/modules/events/ion_storm.dm +++ b/code/modules/events/ion_storm.dm @@ -4,7 +4,6 @@ var/botEmagChance = 0.5 var/list/players = list() var/cloud_hueshift - var/station_level = FALSE //Is this event happening on a station level? no_fake = 1 has_skybox_image = TRUE @@ -15,32 +14,28 @@ res.blend_mode = BLEND_ADD return res - -/datum/event/ionstorm/setup() - //Need to make sure that a ghost role ship doesn't trigger stuff on the main map - if(!current_map.use_overmap) - station_level = TRUE - else - for(var/zlevel in affecting_z) - if(isStationLevel(zlevel)) - station_level = TRUE - break - /datum/event/ionstorm/announce() endWhen = rand(1500, 2000) //Since nothing gets reset at the end of this law, this mostly just prevents it from happening too often - //Only give an ion law/mess with spam filters if it's the station ship that passed through the storm - if(station_level) - give_ion_law() + give_ion_law() - for(var/obj/machinery/telecomms/message_server/MS in SSmachinery.all_telecomms) - MS.spamfilter.Cut() - var/filter_num = rand(1, MS.spamfilter_limit) - for (var/i = 1, i <= filter_num, i++) - MS.spamfilter += pick("maint","NT","Heph","Idris","Zavod","SCC","drugs", "[current_map.station_short]", \ - "PMCG","Zeng","Goddess","fek","Pun Pun","monkey","Ian","Crusher","Ginny","message","spam",\ - "director", "Hello", "Hi!", "filter","crate","Canary","Intrepid", "Command", "thrusters",\ - "slime", "Solarian", "phoron", "RCON") + for(var/obj/machinery/telecomms/message_server/MS in SSmachinery.all_telecomms) + if(!(MS.z in affecting_z)) + continue + MS.spamfilter.Cut() + var/filter_num = rand(1, MS.spamfilter_limit) + for (var/i = 1, i <= filter_num, i++) + MS.spamfilter += pick("maint","NT","Heph","Idris","Zavod","SCC","drugs", "[current_map.station_short]", \ + "PMCG","Zeng","Goddess","fek","Pun Pun","monkey","Ian","Crusher","Ginny","message","spam",\ + "director", "Hello", "Hi!", "filter","crate","Canary","Intrepid", "Command", "thrusters",\ + "slime", "Solarian", "phoron", "RCON") + +/datum/event/ionstorm/announce_end(var/faked) + . = ..() + if(.) + spawn(rand(5000,8000)) + if(prob(50)) + ion_storm_announcement(affecting_z) /datum/event/ionstorm/tick() if(botEmagChance) @@ -48,21 +43,19 @@ if(prob(botEmagChance) && (bot.z in affecting_z)) bot.emag_act(1) -/datum/event/ionstorm/end(var/faked) - ..() - spawn(rand(5000,8000)) - if(prob(50) && station_level) - ion_storm_announcement() - /datum/event/ionstorm/proc/give_ion_law() for(var/mob/living/carbon/human/player in GLOB.player_list) - if( !player.mind || player_is_antag(player.mind, only_offstation_roles = TRUE) || player.client.inactivity > MinutesToTicks(10)) + var/turf/player_turf = get_turf(player) + if(!(player_turf.z in affecting_z)) continue - var/turf/p_loc = get_turf(player) - if(isStationLevel(p_loc.z)) //Only choose those who are on station. Should stop from selecting ghost roles. - players += player.real_name + if(!player.mind || player_is_antag(player.mind, only_offstation_roles = TRUE) || player.client.inactivity > MinutesToTicks(10)) + continue + players += player.real_name for(var/mob/living/silicon/ai/target in GLOB.silicon_mob_list) + var/turf/target_turf = get_turf(target) + if(!(target_turf.z in affecting_z)) + continue var/random_player = "The Captain" if(length(players)) random_player = pick(players) //Random player's name, to be used in laws. diff --git a/code/modules/events/maint_drones.dm b/code/modules/events/maint_drones.dm index 3b60c430dc2..bc49ac178d3 100644 --- a/code/modules/events/maint_drones.dm +++ b/code/modules/events/maint_drones.dm @@ -1,4 +1,6 @@ /datum/event/rogue_maint_drones/start() + ..() + var/drons = severity * 2 - 1 var/groups = rand(3, 8) diff --git a/code/modules/events/meteors.dm b/code/modules/events/meteors.dm index ba44ef3e991..e00a6d2bb2d 100644 --- a/code/modules/events/meteors.dm +++ b/code/modules/events/meteors.dm @@ -25,27 +25,22 @@ endWhen = worst_case_end() /datum/event/meteor_wave/announce() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - command_announcement.Announce(current_map.meteors_detected_message, "Meteor Alert", new_sound = 'sound/AI/meteors_detected_message.ogg', zlevels = affecting_z) - break + command_announcement.Announce(current_map.meteors_detected_message, "Meteor Alert", new_sound = 'sound/AI/meteors_detected_message.ogg', zlevels = affecting_z) -/datum/event/meteor_wave/start() - ..() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - command_announcement.Announce(current_map.meteor_contact_message, "Meteor Alert", zlevels = affecting_z) - break +/datum/event/meteor_wave/announce_start() + . = ..() + if(.) + command_announcement.Announce(current_map.meteor_contact_message, "Meteor Alert", zlevels = affecting_z) -/datum/event/meteor_wave/end(var/faked) - ..() +/datum/event/meteor_wave/announce_end(var/faked) if(faked) return - spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station - command_announcement.Announce(current_map.meteor_end_message, "Meteor Alert", zlevels = affecting_z) + . = ..() + if(.) + spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station + command_announcement.Announce(current_map.meteor_end_message, "Meteor Alert", zlevels = affecting_z) /datum/event/meteor_wave/tick() - if(waves && activeFor >= next_meteor) send_wave() @@ -79,19 +74,20 @@ return SSatlas.current_sector.downed_ship_meteors /datum/event/meteor_wave/downed_ship/announce() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - command_announcement.Announce(current_map.ship_meteor_end_message, "Ship Debris Alert", new_sound = 'sound/AI/meteor_end_message.ogg', zlevels = affecting_z) - break + command_announcement.Announce(current_map.ship_meteor_end_message, "Ship Debris Alert", new_sound = 'sound/AI/meteor_end_message.ogg', zlevels = affecting_z) -/datum/event/meteor_wave/downed_ship/start() - command_announcement.Announce(current_map.ship_meteor_contact_message, "Ship Debris Alert", new_sound = 'sound/AI/meteor_contact_message.ogg', zlevels = affecting_z) +/datum/event/meteor_wave/downed_ship/announce_start() + . = ..() + if(.) + command_announcement.Announce(current_map.ship_meteor_contact_message, "Ship Debris Alert", new_sound = 'sound/AI/meteor_contact_message.ogg', zlevels = affecting_z) -/datum/event/meteor_wave/downed_ship/end(var/faked) +/datum/event/meteor_wave/downed_ship/announce_end(var/faked) if(faked) return - spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station - command_announcement.Announce(current_map.ship_meteor_end_message, "Ship Debris Alert", new_sound = 'sound/AI/meteor_end_message.ogg', zlevels = affecting_z) + . = ..() + if(.) + spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station + command_announcement.Announce(current_map.ship_meteor_end_message, "Ship Debris Alert", new_sound = 'sound/AI/meteor_end_message.ogg', zlevels = affecting_z) /datum/event/meteor_wave/overmap next_meteor_lower = 5 @@ -101,23 +97,25 @@ /datum/event/meteor_wave/overmap/announce() return + /datum/event/meteor_wave/dust ic_name = "a dust belt" /datum/event/meteor_wave/dust/announce() - for (var/zlevel in affecting_z) - if(zlevel in current_map.station_levels) - command_announcement.Announce(current_map.dust_detected_message, "Dust Belt Alert", new_sound = 'sound/AI/dust_detected_message.ogg', zlevels = affecting_z) - break + command_announcement.Announce(current_map.dust_detected_message, "Dust Belt Alert", new_sound = 'sound/AI/dust_detected_message.ogg', zlevels = affecting_z) -/datum/event/meteor_wave/dust/start() - command_announcement.Announce(current_map.dust_contact_message, "Dust Belt Alert", new_sound = 'sound/AI/dust_contact_message.ogg', zlevels = affecting_z) +/datum/event/meteor_wave/dust/announce_start() + . = ..() + if(.) + command_announcement.Announce(current_map.dust_contact_message, "Dust Belt Alert", new_sound = 'sound/AI/dust_contact_message.ogg', zlevels = affecting_z) -/datum/event/meteor_wave/dust/end(var/faked) +/datum/event/meteor_wave/dust/announce_end(var/faked) if(faked) return - spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station - command_announcement.Announce(current_map.dust_end_message, "Dust Belt Alert", , new_sound = 'sound/AI/dust_end_message.ogg', zlevels = affecting_z) + . = ..() + if(.) + spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station + command_announcement.Announce(current_map.dust_end_message, "Dust Belt Alert", , new_sound = 'sound/AI/dust_end_message.ogg', zlevels = affecting_z) /datum/event/meteor_wave/dust/get_meteors() return SSatlas.current_sector.meteors_dust diff --git a/code/modules/events/money_hacker.dm b/code/modules/events/money_hacker.dm index eba378ee9b6..21d55edbcc2 100644 --- a/code/modules/events/money_hacker.dm +++ b/code/modules/events/money_hacker.dm @@ -21,7 +21,8 @@ var/my_department = "[station_name()] firewall subroutines" for(var/obj/machinery/telecomms/message_server/MS in SSmachinery.all_telecomms) - if(!MS.use_power) continue + if(!MS.use_power || !(MS.z in affecting_z)) + continue MS.send_rc_message("Executive Officer's Desk", my_department, message, "", "", 2) @@ -32,6 +33,8 @@ endWhen = activeFor + 10 /datum/event/money_hacker/end(var/faked) + ..() + var/message if(affected_account && !affected_account.suspended && !faked) //hacker wins @@ -62,5 +65,6 @@ var/my_department = "[station_name()] firewall subroutines" for(var/obj/machinery/telecomms/message_server/MS in SSmachinery.all_telecomms) - if(!MS.use_power) continue + if(!MS.use_power || !(MS.z in affecting_z)) + continue MS.send_rc_message("Executive Officer's Desk", my_department, message, "", "", 2) diff --git a/code/modules/events/money_lotto.dm b/code/modules/events/money_lotto.dm index fc9d907f900..70b4cc9f4a4 100644 --- a/code/modules/events/money_lotto.dm +++ b/code/modules/events/money_lotto.dm @@ -4,6 +4,8 @@ var/deposit_success = 0 /datum/event/money_lotto/start() + ..() + winner_sum = pick(1, 50, 100, 500, 1000, 2000, 5000) if(SSeconomy.all_money_accounts.len) var/datum/money_account/D = SSeconomy.get_account(pick(SSeconomy.all_money_accounts)) diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm index 0dad0e6e0da..5c2e5550c93 100644 --- a/code/modules/events/prison_break.dm +++ b/code/modules/events/prison_break.dm @@ -43,6 +43,8 @@ /datum/event/prison_break/start() + ..() + for(var/area/A in GLOB.the_station_areas) if(is_type_in_list(A,areaType) && !is_type_in_list(A,areaNotType)) areas += A @@ -69,5 +71,7 @@ /datum/event/prison_break/end(var/faked) + ..() + for(var/area/A in shuffle(areas)) A.prison_break() diff --git a/code/modules/events/random_antagonist.dm b/code/modules/events/random_antagonist.dm index b77860e4110..87b626bcfe2 100644 --- a/code/modules/events/random_antagonist.dm +++ b/code/modules/events/random_antagonist.dm @@ -6,6 +6,8 @@ return /datum/event/random_antag/start() + ..() + var/list/valid_types = list() for(var/antag_type in GLOB.all_antag_types) var/datum/antagonist/antag = GLOB.all_antag_types[antag_type] diff --git a/code/modules/events/rescue_pod.dm b/code/modules/events/rescue_pod.dm index 3245c2c3792..cd90ab6385a 100644 --- a/code/modules/events/rescue_pod.dm +++ b/code/modules/events/rescue_pod.dm @@ -15,6 +15,8 @@ spawner = SSghostroles.get_spawner(spawner_name) /datum/event/rescue_pod/start() + ..() + if(istype(spawner)) spawner.enable() @@ -27,5 +29,7 @@ ..() /datum/event/rescue_pod/burglar/start() + ..() + if(istype(spawner)) spawner.enable() diff --git a/code/modules/events/rogue_drones.dm b/code/modules/events/rogue_drones.dm index afd473f0650..a7098dae1ee 100644 --- a/code/modules/events/rogue_drones.dm +++ b/code/modules/events/rogue_drones.dm @@ -4,6 +4,8 @@ ic_name = "combat drones" /datum/event/rogue_drone/start() + ..() + //spawn them at the same place as carp var/list/possible_spawns = list() for(var/obj/effect/landmark/C in GLOB.landmarks_list) @@ -26,9 +28,11 @@ our_sound = possible_sounds[message_index] else our_sound = possible_sounds[1] - command_announcement.Announce(message, "Rogue Drone Alert", new_sound = our_sound) + command_announcement.Announce(message, "Rogue Drone Alert", new_sound = our_sound, zlevels = affecting_z) /datum/event/rogue_drone/end(var/faked) + ..() + var/num_recovered = 0 for(var/drone in drones_list) var/mob/living/simple_animal/hostile/icarus_drone/malf/D = drone diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 2f4869e7679..b7d2586d8b2 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -5,8 +5,10 @@ ic_name = "a biohazard" /datum/event/spacevine/start() + ..() + spacevine_infestation() spacevines_spawned = 1 /datum/event/spacevine/announce() - level_seven_announcement() + level_seven_announcement(affecting_z) diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index 2cd41c4c4ce..09f67c2758a 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -16,6 +16,8 @@ command_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', zlevels = affecting_z) /datum/event/spider_infestation/start() + ..() + var/list/vents = list() for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in SSmachinery.processing) if(!temp_vent.welded && temp_vent.network && isStationLevel(temp_vent.loc.z)) diff --git a/code/modules/events/spontaneous_appendicitis.dm b/code/modules/events/spontaneous_appendicitis.dm index 4015f635e9b..cd71d5901a8 100644 --- a/code/modules/events/spontaneous_appendicitis.dm +++ b/code/modules/events/spontaneous_appendicitis.dm @@ -2,6 +2,8 @@ no_fake = 1 /datum/event/spontaneous_appendicitis/start() + ..() + for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list)) if((H.client && H.stat != DEAD) && (!player_is_antag(H.mind))) var/obj/item/organ/internal/appendix/A = H.internal_organs_by_name[BP_APPENDIX] diff --git a/code/modules/events/supply_drop.dm b/code/modules/events/supply_drop.dm index be9626d16d9..445d2731841 100644 --- a/code/modules/events/supply_drop.dm +++ b/code/modules/events/supply_drop.dm @@ -8,6 +8,8 @@ announceWhen = rand(0,80) /datum/event/supply_drop/start() + ..() + var/rarity = 4 var/quantity = rand(10,25) diff --git a/code/modules/events/visitor.dm b/code/modules/events/visitor.dm index fc5fc799390..897ca5d9aca 100644 --- a/code/modules/events/visitor.dm +++ b/code/modules/events/visitor.dm @@ -6,5 +6,7 @@ spawner = SSghostroles.get_spawner("visitor") /datum/event/visitor/start() + ..() + if(istype(spawner)) spawner.enable() diff --git a/code/modules/events/wallrot.dm b/code/modules/events/wallrot.dm index df509f42bdf..504d091df3f 100644 --- a/code/modules/events/wallrot.dm +++ b/code/modules/events/wallrot.dm @@ -10,6 +10,11 @@ command_announcement.Announce("Harmful fungi detected at coordinates ([origin_turf.x], [origin_turf.y], [origin_turf.z]). The structure may be contaminated.", "Biohazard Alert", new_sound = 'sound/AI/fungi.ogg', zlevels = affecting_z) /datum/event/wallrot/start() + ..() + + handle_wallrot() + +/datum/event/wallrot/proc/handle_wallrot() set waitfor = FALSE // 100 attempts diff --git a/code/modules/overmap/events/event.dm b/code/modules/overmap/events/event.dm index da75c362d06..84771457023 100644 --- a/code/modules/overmap/events/event.dm +++ b/code/modules/overmap/events/event.dm @@ -71,12 +71,7 @@ if(is_event_active(ship,event_type, hazard.difficulty))//event's already active, don't bother continue var/datum/event_meta/EM = new(hazard.difficulty, "Overmap event - [hazard.name]", event_type, add_to_queue = FALSE, is_one_shot = TRUE) - var/datum/event/E = new event_type(EM) - E.startWhen = 0 - E.endWhen = INFINITY - E.affecting_z = ship.map_z - if("victim" in E.vars)//for meteors and other overmap events that uses ships//might need a better solution - E.vars["victim"] = ship + var/datum/event/E = new event_type(EM, FALSE, ship, hazard) LAZYADD(ship_events[ship], E) /singleton/overmap_event_handler/proc/stop_hazard(var/obj/effect/overmap/visitable/ship/ship, var/obj/effect/overmap/event/hazard) @@ -297,10 +292,12 @@ opacity = 1 difficulty = EVENT_LEVEL_MAJOR -/obj/effect/overmap/event/gravity - name = "dark matter influx" - events = list(/datum/event/gravity) - can_be_destroyed = FALSE +// see comment at code/modules/events/gravity.dm +// tl;dr gravity is handled globally, meaning if the horizon loses gravity, everyone does +// /obj/effect/overmap/event/gravity +// name = "dark matter influx" +// events = list(/datum/event/gravity) +// can_be_destroyed = FALSE //These now are basically only used to spawn hazards. Will be useful when we need to spawn group of moving hazards /datum/overmap_event @@ -352,8 +349,11 @@ opacity = 1 hazards = /obj/effect/overmap/event/carp/major -/datum/overmap_event/gravity - name = "dark matter influx" - count = 12 - radius = 4 - hazards = /obj/effect/overmap/event/gravity +// see comment at code/modules/events/gravity.dm +// tl;dr gravity is handled globally, meaning if the horizon loses gravity, everyone does +// this needs to be fixed before we can uncomment this +// /datum/overmap_event/gravity +// name = "dark matter influx" +// count = 12 +// radius = 4 +// hazards = /obj/effect/overmap/event/gravity diff --git a/code/modules/overmap/ships/computers/sensors.dm b/code/modules/overmap/ships/computers/sensors.dm index 11bec3e79d7..8a04db4fedf 100644 --- a/code/modules/overmap/ships/computers/sensors.dm +++ b/code/modules/overmap/ships/computers/sensors.dm @@ -80,6 +80,11 @@ else if(sound_token) QDEL_NULL(sound_token) +/obj/machinery/computer/ship/sensors/proc/display_message(var/message) + if(OPERABLE(src)) + playsound(src, 'sound/machines/triplebeep.ogg', 50) + visible_message(SPAN_NOTICE("\The [src] beeps, [SPAN_ITALIC("\"" + message + "\"")]")) + /obj/machinery/computer/ship/sensors/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) diff --git a/code/modules/psionics/events/_psi.dm b/code/modules/psionics/events/_psi.dm index d6b92e15dc5..0d606a83cff 100644 --- a/code/modules/psionics/events/_psi.dm +++ b/code/modules/psionics/events/_psi.dm @@ -8,11 +8,13 @@ are advised to cease any sensitive activities and report to medical personnel in case of damage.", \ "Nralakk Federation Observation Probe TC-203 Sensor Array", new_sound = 'sound/misc/announcements/nightlight_old.ogg', zlevels = affecting_z) -/datum/event/psi/end() - priority_announcement.Announce( \ - "The psi-disturbance has ended and baseline normality has been re-asserted. \ - Anything you still can't cope with is therefore your own problem.", \ - "Nralakk Federation Observation Probe TC-203 Sensor Array", new_sound = 'sound/misc/announcements/nightlight_old.ogg', zlevels = affecting_z) +/datum/event/psi/announce_end() + . = ..() + if(.) + priority_announcement.Announce( \ + "The psi-disturbance has ended and baseline normality has been re-asserted. \ + Anything you still can't cope with is therefore your own problem.", \ + "Nralakk Federation Observation Probe TC-203 Sensor Array", new_sound = 'sound/misc/announcements/nightlight_old.ogg', zlevels = affecting_z) /datum/event/psi/tick() for(var/thing in SSpsi.processing) diff --git a/code/modules/psionics/events/mini_spasm.dm b/code/modules/psionics/events/mini_spasm.dm index 2a66640ddf8..fb3bfd0715e 100644 --- a/code/modules/psionics/events/mini_spasm.dm +++ b/code/modules/psionics/events/mini_spasm.dm @@ -21,6 +21,8 @@ "Nralakk Federation Observation Probe TC-203 Sensor Array", new_sound = 'sound/misc/announcements/security_level_old.ogg', zlevels = affecting_z) /datum/event/minispasm/start() + ..() + var/list/victims = list() for(var/obj/item/device/radio/radio in GLOB.listening_objects) if(radio.is_on()) @@ -55,7 +57,9 @@ sleep(45) victim.psi.check_psionic_trigger(100, "a psionic scream", redactive = TRUE) -/datum/event/minispasm/end() - command_announcement.Announce( \ - "PRIORITY ALERT: SIGNAL BROADCAST HAS CEASED. Personnel are cleared to resume use of non-hardened radio transmission equipment. Have a nice day.", \ - "Nralakk Federation Observation Probe TC-203 Sensor Array", new_sound = 'sound/misc/announcements/nightlight_old.ogg', zlevels = affecting_z) +/datum/event/minispasm/announce_end() + . = ..() + if(.) + command_announcement.Announce( \ + "PRIORITY ALERT: SIGNAL BROADCAST HAS CEASED. Personnel are cleared to resume use of non-hardened radio transmission equipment. Have a nice day.", \ + "Nralakk Federation Observation Probe TC-203 Sensor Array", new_sound = 'sound/misc/announcements/nightlight_old.ogg', zlevels = affecting_z) diff --git a/html/changelogs/geeves-overmap_announcement.yml b/html/changelogs/geeves-overmap_announcement.yml new file mode 100644 index 00000000000..e527c7bef72 --- /dev/null +++ b/html/changelogs/geeves-overmap_announcement.yml @@ -0,0 +1,8 @@ +author: Geeves + +delete-after: True + +changes: + - tweak: "Tuned up a lot of overmap event announcements, they will now announce to the appropriate ship. For shuttles, a small ping and a readout will come from the sensors console instead of a big announcement." + - bugfix: "Fixed a lot of events targetting the wrong ship, such as the ion storm one." + - tweak: "Temporarily disabled the gravity event, as it affects ships globally instead of per-ship." \ No newline at end of file