mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 13:05:36 +01:00
Optimizes grid check event a bit (+minor fixes) (#96075)
This commit is contained in:
@@ -27,4 +27,4 @@
|
||||
COOLDOWN_START(controller, announcement_spam_protection, 30 SECONDS)
|
||||
|
||||
/datum/round_event/grid_check/start()
|
||||
power_fail(30, 120)
|
||||
power_fail(60, 240) // 1 to 4 minutes
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
RegisterSignal(ai_tracking_tool, COMSIG_TRACKABLE_GLIDE_CHANGED, PROC_REF(tracked_glidesize_changed))
|
||||
|
||||
add_traits(list(TRAIT_PULL_BLOCKED, TRAIT_AI_ACCESS, TRAIT_HANDS_BLOCKED, TRAIT_CAN_GET_AI_TRACKING_MESSAGE, TRAIT_LOUD_BINARY), INNATE_TRAIT)
|
||||
AddElement(/datum/element/block_area_power_fail)
|
||||
|
||||
//Heads up to other binary chat listeners that a new AI is online and listening to Binary.
|
||||
if(announce_init_to_others && !is_centcom_level(z)) //Skip new syndicate AIs and also new AIs on centcom Z
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
var/long_term_power = 10
|
||||
///Automatically name the APC after the area is in
|
||||
var/auto_name = FALSE
|
||||
///Time to allow the APC to regain some power and to turn the channels back online
|
||||
///Time to allow the APC to regain some power and to turn the channels back online in seconds
|
||||
var/failure_timer = 0
|
||||
///Forces an update on the power use to ensure that the apc has enough power
|
||||
var/force_update = FALSE
|
||||
@@ -282,8 +282,8 @@
|
||||
|
||||
/obj/machinery/power/apc/on_saboteur(datum/source, disrupt_duration)
|
||||
. = ..()
|
||||
disrupt_duration *= 0.1 // so, turns out, failure timer is in seconds, not deciseconds; without this, disruptions last 10 times as long as they probably should
|
||||
energy_fail(disrupt_duration)
|
||||
// failure timer is in seconds, not deciseconds, so we need to convert
|
||||
energy_fail(disrupt_duration * 0.1)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/apc/on_set_is_operational(old_value)
|
||||
@@ -589,7 +589,7 @@
|
||||
if(!area?.requires_power)
|
||||
return
|
||||
if(failure_timer)
|
||||
failure_timer--
|
||||
failure_timer = max(0, failure_timer - seconds_per_tick)
|
||||
force_update = TRUE
|
||||
return
|
||||
|
||||
|
||||
@@ -127,16 +127,15 @@
|
||||
terminal.master = null
|
||||
terminal = null
|
||||
|
||||
/**
|
||||
* Temporarily disables all power to the room for a set duration
|
||||
*
|
||||
* Some rooms are immune to this effect due to having important machines
|
||||
*
|
||||
* * duration - the duration of the power failure in seconds (not deciseconds)
|
||||
*/
|
||||
/obj/machinery/power/apc/proc/energy_fail(duration)
|
||||
for(var/obj/machinery/failing_machine in area.contents)
|
||||
if(failing_machine.critical_machine)
|
||||
return
|
||||
|
||||
for(var/mob/living/silicon/ai as anything in GLOB.ai_list)
|
||||
if(get_area(ai) == area)
|
||||
return
|
||||
|
||||
failure_timer = max(failure_timer, round(duration))
|
||||
failure_timer = max(failure_timer, round(duration, SSMACHINES_DT))
|
||||
update()
|
||||
queue_icon_update()
|
||||
|
||||
@@ -147,10 +146,9 @@
|
||||
if(nightshift_lights == on)
|
||||
return //no change
|
||||
nightshift_lights = on
|
||||
for (var/list/zlevel_turfs as anything in area.get_zlevel_turf_lists())
|
||||
for(var/turf/area_turf as anything in zlevel_turfs)
|
||||
for(var/obj/machinery/light/night_light in area_turf)
|
||||
if(night_light.nightshift_allowed)
|
||||
night_light.nightshift_enabled = nightshift_lights
|
||||
night_light.update(FALSE)
|
||||
CHECK_TICK
|
||||
for(var/turf/area_turf as anything in area.get_turfs_from_all_zlevels())
|
||||
for(var/obj/machinery/light/night_light in area_turf)
|
||||
if(night_light.nightshift_allowed)
|
||||
night_light.nightshift_enabled = nightshift_lights
|
||||
night_light.update(FALSE)
|
||||
CHECK_TICK
|
||||
|
||||
Reference in New Issue
Block a user