Files
VOREStation/code/modules/events/gravity.dm
Drathek 7c8bb85de3 Whitespace Standardization [MDB IGNORE] (#15748)
* Update settings

* Whitespace changes

* Comment out merger hooks in gitattributes

Corrupt maps would have to be resolved in repo before hooks could be updated

* Revert "Whitespace changes"

This reverts commit afbdd1d844.

* Whitespace again minus example

* Gitignore example changelog

* Restore changelog merge setting

* Keep older dmi hook attribute until hooks can be updated

* update vscode settings too

* Renormalize remaining

* Revert "Gitignore example changelog"

This reverts commit de22ad375d.

* Attempt to normalize example.yml (and another file I guess)

* Try again
2024-02-20 11:28:51 +01:00

63 lines
1.9 KiB
Plaintext

/datum/event/gravity
announceWhen = 5
var/list/zLevels
var/list/generators = list()
/datum/event/gravity/setup()
// Setup which levels we will disrupt gravit on.
zLevels = using_map.station_levels.Copy()
for(var/datum/planet/P in SSplanets.planets)
zLevels -= P.expected_z_levels
for(var/obj/machinery/gravity_generator/main/GG in machines)
if((GG.z in zLevels) && GG.on)
generators += GG
if(generators.len)
endWhen = rand(5 MINUTES, 20 MINUTES)
else
endWhen = rand(15, 60)
/datum/event/gravity/announce()
if(generators.len)
command_announcement.Announce("Feedback surge detected in mass-distributions systems. Artificial gravity has been disabled. \
Please wait for the system to reinitialize, or contact your engineering department.", "Gravity Failure")
else
command_announcement.Announce("Feedback surge detected in mass-distributions systems. Artificial gravity has been disabled whilst the system \
reinitializes. Please stand by while the gravity system reinitializes.", "Gravity Failure")
/datum/event/gravity/start()
gravity_is_on = 0
if(generators.len)
for(var/obj/machinery/gravity_generator/main/GG in generators)
if((GG.z in zLevels) && GG.on)
GG.breaker = FALSE
GG.set_power()
GG.charge_count = 10
else
for(var/area/A in world)
if(A.z in zLevels)
A.gravitychange(gravity_is_on)
/datum/event/gravity/end()
if(!gravity_is_on)
gravity_is_on = 1
var/did_anything = FALSE
if(generators.len)
for(var/obj/machinery/gravity_generator/main/GG in generators)
if(!GG.on)
GG.breaker = TRUE
GG.set_power()
GG.charge_count = 90
did_anything = TRUE
else
for(var/area/A in world)
if(A.z in zLevels)
A.gravitychange(gravity_is_on)
did_anything = TRUE
if(did_anything)
command_announcement.Announce("Gravity generators are again functioning within normal parameters. Sorry for any inconvenience.", "Gravity Restored")