mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-05-12 18:20:09 +01:00
f71ea26f72
## About The Pull Request Removes all of the duplicate global lists for specific machine types where the only thing they do is store all machines of that type. Adds machine tracking to SSmachines in the form of a list for all machines, and then an associative list for machines by their type. Previously we have machines in multiple global lists, such as airlocks being in GLOB.doors, GLOB.airlocks, GLOB.machines. This makes that not a thing, and also means that iterating through GLOB.machines looking for a specific type is no longer as expensive.
35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
/datum/round_event_control/gravity_generator_blackout
|
|
name = "Gravity Generator Blackout"
|
|
typepath = /datum/round_event/gravity_generator_blackout
|
|
weight = 30
|
|
category = EVENT_CATEGORY_ENGINEERING
|
|
description = "Turns off the gravity generator."
|
|
min_wizard_trigger_potency = 0
|
|
max_wizard_trigger_potency = 4
|
|
|
|
/datum/round_event_control/gravity_generator_blackout/can_spawn_event(players_amt, allow_magic = FALSE)
|
|
. = ..()
|
|
if(!.)
|
|
return .
|
|
|
|
var/station_generator_exists = FALSE
|
|
for(var/obj/machinery/gravity_generator/main/the_generator as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/gravity_generator/main))
|
|
if(is_station_level(the_generator.z))
|
|
station_generator_exists = TRUE
|
|
|
|
if(!station_generator_exists)
|
|
return FALSE
|
|
|
|
/datum/round_event/gravity_generator_blackout
|
|
announce_when = 1
|
|
start_when = 1
|
|
announce_chance = 33
|
|
|
|
/datum/round_event/gravity_generator_blackout/announce(fake)
|
|
priority_announce("Gravnospheric anomalies detected near [station_name()]. Manual reset of generators is required.", "Anomaly Alert", ANNOUNCER_GRANOMALIES)
|
|
|
|
/datum/round_event/gravity_generator_blackout/start()
|
|
for(var/obj/machinery/gravity_generator/main/the_generator as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/gravity_generator/main))
|
|
if(is_station_level(the_generator.z))
|
|
the_generator.blackout()
|