[MIRROR] Grey Tide event light behavior changes and code tidiness [MDB IGNORE] (#18009)

* Grey Tide event light behavior changes and code tidiness (#71230)

## About The Pull Request

Makes a number of changes to the Grey Tide event, some of which are and
some of which aren't player facing.

Player facing bits:

- The lights will once again turn off when the event ends and the doors
begin opening. Originally, the lights would all shatter when the event
hit, providing a cover of darkness for opportunists to sneak around
under. Unfortunately this would prevent the AI from fixing the doors
until the lights were replaced, leading to headaches and the removal of
this functionality in #43159. Now, the lights are simply turned off at
the APC instead of shattered.
- The lights now flicker at certain intervals as the event is running,
rather than just right at the start.
- Announcement has been slightly modified to indicate that the event
hits more than just airlocks.
- Event runs way faster. Doors open all at once, rather than
one-at-a-time.

And now for the non player-facing bits:

- The filename is now grey_tide.dm instead of prison_break.dm. The event
was effectively re-branded to the Grey Tide event six years ago, but the
filename was unchaged.
- potential_areas is now a part of setup instead of a var on the
round_event.
- Cleans up instances of single-character varnames and stuff not in
snake case.
- The event now checks if it has any valid areas (will it work or not)
at the start, rather than at the end.
- The event now sends a global signal when run, rather than checking
everything in the entire world. It should run faster now.
- Everything that can be affected by the grey tide event now stores its
functionality on a signal handler, including the light flickers

## Why It's Good For The Game

Makes the grey tide event a bit more interesting and easier to take
advantage of. Cleans up the backend code a bit.

## Changelog
🆑 Rhials
balance: The lights will now flicker more frequently before a Grey Tide
event
balance: The lights will now be shut off via the APC when the Grey Tide
event opens up a department.
code: Makes some miscellaneous code improvements to the Grey Tide event
code: Grey tide event runs much faster
code: Renames prison_break.dm to grey_tide.dm
/🆑

Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>

* Grey Tide event light behavior changes and code tidiness

Co-authored-by: Rhials <Datguy33456@gmail.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-12-09 03:44:51 +00:00
committed by GitHub
co-authored by Mothblocks Rhials
parent 1f27a36800
commit 3e8d1e750e
9 changed files with 139 additions and 62 deletions
@@ -0,0 +1,7 @@
// Grey Tide event signals
/// Sent when the Grey Tide event begins affecting the station.
/// (list/area/greytide_areas)
#define COMSIG_GLOB_GREY_TIDE "grey_tide"
/// A different signal, used specifically for flickering the lights during the event
#define COMSIG_GLOB_GREY_TIDE_LIGHT "grey_tide_light"
+15
View File
@@ -6,6 +6,10 @@
var/airlock_state
var/frequency
/obj/machinery/door/airlock/Initialize(mapload)
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE, PROC_REF(grey_tide))
/// Forces the airlock to unbolt and open
/obj/machinery/door/airlock/proc/secure_open()
locked = FALSE
@@ -31,6 +35,17 @@
locked = FALSE
return ..()
/obj/machinery/door/airlock/proc/grey_tide(datum/source, list/grey_tide_areas)
SIGNAL_HANDLER
if(!is_station_level(z) || critical_machine)
return //Skip doors in critical positions, such as the SM chamber.
for(var/area_type in grey_tide_areas)
if(!istype(get_area(src), area_type))
continue
INVOKE_ASYNC(src, PROC_REF(prison_open)) //Sleep gets called further down in open(), so we have to invoke async
/obj/machinery/airlock_sensor
icon = 'icons/obj/airlock_machines.dmi'
icon_state = "airlock_sensor_off"
+13
View File
@@ -58,6 +58,8 @@
if(!length(doors) && !length(flashers) && length(closets))
atom_break()
RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE, PROC_REF(grey_tide))
//Main door timer loop, if it's timing and time is >0 reduce time by 1.
// if it's less than 0, open door, reset timer
// update the door_timer window and the icon
@@ -265,6 +267,17 @@
else
. = FALSE
/obj/machinery/status_display/door_timer/proc/grey_tide(datum/source, list/grey_tide_areas)
SIGNAL_HANDLER
if(!is_station_level(z))
return
for(var/area_type in grey_tide_areas)
if(!istype(get_area(src), area_type))
continue
timer_end(forced = TRUE)
#undef PRESET_SHORT
#undef PRESET_MEDIUM
#undef PRESET_LONG
@@ -7,3 +7,19 @@
armor = list(MELEE = 30, BULLET = 50, LASER = 50, ENERGY = 100, BOMB = 0, BIO = 0, FIRE = 80, ACID = 80)
secure = TRUE
damage_deflection = 20
/obj/structure/closet/secure_closet/Initialize(mapload)
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE, PROC_REF(grey_tide))
/obj/structure/closet/secure_closet/proc/grey_tide(datum/source, list/grey_tide_areas)
SIGNAL_HANDLER
if(!is_station_level(z))
return
for(var/area_type in grey_tide_areas)
if(!istype(get_area(src), area_type))
continue
locked = FALSE
update_appearance(UPDATE_ICON)
+61
View File
@@ -0,0 +1,61 @@
/datum/round_event_control/grey_tide
name = "Grey Tide"
typepath = /datum/round_event/grey_tide
max_occurrences = 2
min_players = 5
category = EVENT_CATEGORY_ENGINEERING
description = "Bolts open all doors in one or more departments."
/datum/round_event_control/grey_tide/can_spawn_event(players_amt)
. = ..()
for(var/datum/round_event/running_event in SSevents.running)
if(istype(running_event, /datum/round_event/grey_tide)) //Two of these at once messes up the list
return FALSE
/datum/round_event/grey_tide
announce_when = 50
end_when = 20
///The number of areas to be hit by the event.
var/severity = 1
///The area subtypes to be targeted by the event.
var/list/grey_tide_areas = list()
/datum/round_event/grey_tide/setup()
announce_when = rand(50, 60)
end_when = rand(20, 30)
severity = rand(1,3)
var/list/potential_areas = list(/area/station/command,
/area/station/engineering,
/area/station/medical,
/area/station/security,
/area/station/cargo,
/area/station/science,
)
for(var/i in 1 to severity)
grey_tide_areas += pick_n_take(potential_areas)
/datum/round_event/grey_tide/announce(fake)
priority_announce("Gr3y.T1d3 virus detected in [station_name()] secure locking encryption subroutines. Severity level of [severity]. Recommend station AI involvement.", "Security Alert")
/datum/round_event/grey_tide/start()
if(!length(grey_tide_areas))
stack_trace("Could not initiate grey-tide. No areas in the list!")
kill()
/datum/round_event/grey_tide/tick()
if(!ISMULTIPLE(activeFor, 12))
return
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_GREY_TIDE_LIGHT, grey_tide_areas)
// Objects currently impacted by the greytide event:
// /obj/machinery/door/airlock -- Signal bolts open the door
// /obj/machinery/status_display/door_timer -- Signal instantly ends the timer, releasing the occupant
// /obj/structure/closet/secure_closet -- Signal unlocks locked lockers
// /obj/machinery/power/apc -- Signal turns the lighting channel off
/datum/round_event/grey_tide/end()
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_GREY_TIDE, grey_tide_areas)
-60
View File
@@ -1,60 +0,0 @@
/datum/round_event_control/grey_tide
name = "Grey Tide"
typepath = /datum/round_event/grey_tide
max_occurrences = 2
min_players = 5
category = EVENT_CATEGORY_ENGINEERING
description = "Bolts open all doors in one or more departments."
/datum/round_event/grey_tide
announce_when = 50
end_when = 20
var/list/area/areasToOpen = list()
var/list/potential_areas = list(/area/station/command,
/area/station/engineering,
/area/station/medical,
/area/station/security,
/area/station/cargo,
/area/station/science)
var/severity = 1
/datum/round_event/grey_tide/setup()
announce_when = rand(50, 60)
end_when = rand(20, 30)
severity = rand(1,3)
for(var/i in 1 to severity)
var/picked_area = pick_n_take(potential_areas)
for(var/area/A as anything in GLOB.areas)
if(istype(A, picked_area))
areasToOpen += A
/datum/round_event/grey_tide/announce(fake)
if(areasToOpen && areasToOpen.len > 0)
priority_announce("Gr3y.T1d3 virus detected in [station_name()] door subroutines. Severity level of [severity]. Recommend station AI involvement.", "Security Alert")
else
log_world("ERROR: Could not initiate grey-tide. No areas in the list!")
kill()
/datum/round_event/grey_tide/start()
for(var/area/A in areasToOpen)
for(var/obj/machinery/light/L in A)
L.flicker(10)
/datum/round_event/grey_tide/end()
for(var/area/A in areasToOpen)
for(var/obj/O in A)
if(istype(O, /obj/structure/closet/secure_closet))
var/obj/structure/closet/secure_closet/temp = O
temp.locked = FALSE
temp.update_appearance()
else if(istype(O, /obj/machinery/door/airlock))
var/obj/machinery/door/airlock/temp = O
if(temp.critical_machine) //Skip doors in critical positions, such as the SM chamber.
continue
temp.prison_open()
else if(istype(O, /obj/machinery/status_display/door_timer))
var/obj/machinery/status_display/door_timer/temp = O
temp.timer_end(forced = TRUE)
+16
View File
@@ -186,6 +186,8 @@
if(abs(offset_old) != APC_PIXEL_OFFSET)
log_mapping("APC: ([src]) at [AREACOORD(src)] with dir ([dir] | [uppertext(dir2text(dir))]) has pixel_[dir & (WEST|EAST) ? "x" : "y"] value [offset_old] - should be [dir & (SOUTH|EAST) ? "-" : ""][APC_PIXEL_OFFSET]. Use the directional/ helpers!")
RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE, PROC_REF(grey_tide))
/obj/machinery/power/apc/Destroy()
GLOB.apcs_list -= src
@@ -206,6 +208,7 @@
QDEL_NULL(cell)
if(terminal)
disconnect_terminal()
. = ..()
/obj/machinery/power/apc/handle_atom_del(atom/deleting_atom)
@@ -615,6 +618,19 @@
/obj/machinery/power/apc/proc/report()
return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_total]) : [cell? cell.percent() : "N/C"] ([charging])"
/obj/machinery/power/apc/proc/grey_tide(datum/source, list/grey_tide_areas)
SIGNAL_HANDLER
if(!is_station_level(z))
return
for(var/area_type in grey_tide_areas)
if(!istype(get_area(src), area_type))
continue
lighting = APC_CHANNEL_OFF //Escape (or sneak in) under the cover of darkness
update_appearance(UPDATE_ICON)
update()
/*Power module, used for APC construction*/
/obj/item/electronics/apc
name = "power control module"
+9 -1
View File
@@ -91,6 +91,9 @@
if(!start_with_cell || no_low_power)
has_mock_cell = FALSE
if(is_station_level(z))
RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE_LIGHT, PROC_REF(grey_tide)) //Only put the signal on station lights
RegisterSignal(src, COMSIG_LIGHT_EATER_ACT, PROC_REF(on_light_eater))
AddElement(/datum/element/atmos_sensitive, mapload)
return INITIALIZE_HINT_LATELOAD
@@ -676,8 +679,13 @@
tube?.burn()
return
/obj/machinery/light/proc/grey_tide(datum/source, list/grey_tide_areas)
SIGNAL_HANDLER
for(var/area_type in grey_tide_areas)
if(!istype(get_area(src), area_type))
continue
INVOKE_ASYNC(src, PROC_REF(flicker))
/obj/machinery/light/floor
name = "floor light"
+2 -1
View File
@@ -240,6 +240,7 @@
#include "code\__DEFINES\dcs\signals\signals_customizable.dm"
#include "code\__DEFINES\dcs\signals\signals_cytology.dm"
#include "code\__DEFINES\dcs\signals\signals_datum.dm"
#include "code\__DEFINES\dcs\signals\signals_event.dm"
#include "code\__DEFINES\dcs\signals\signals_fish.dm"
#include "code\__DEFINES\dcs\signals\signals_food.dm"
#include "code\__DEFINES\dcs\signals\signals_gib.dm"
@@ -3079,6 +3080,7 @@
#include "code\modules\events\fake_virus.dm"
#include "code\modules\events\false_alarm.dm"
#include "code\modules\events\gravity_generator_blackout.dm"
#include "code\modules\events\grey_tide.dm"
#include "code\modules\events\grid_check.dm"
#include "code\modules\events\heart_attack.dm"
#include "code\modules\events\immovable_rod.dm"
@@ -3088,7 +3090,6 @@
#include "code\modules\events\meteor_wave.dm"
#include "code\modules\events\mice_migration.dm"
#include "code\modules\events\portal_storm.dm"
#include "code\modules\events\prison_break.dm"
#include "code\modules\events\processor_overload.dm"
#include "code\modules\events\radiation_storm.dm"
#include "code\modules\events\scrubber_clog.dm"