From 7b65343f45bb67f722521814084d02bdca75617c Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 13 Oct 2019 06:04:57 +0200 Subject: [PATCH] z-level checks. --- code/game/machinery/syndicatebeacon.dm | 34 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm index 67c9627423..8a33241d46 100644 --- a/code/game/machinery/syndicatebeacon.dm +++ b/code/game/machinery/syndicatebeacon.dm @@ -17,13 +17,10 @@ GLOBAL_VAR_INIT(singularity_counter, 0) stat = 0 verb_say = "states" var/cooldown = 0 - - var/active = 0 + var/active = FALSE + var/meteor_buff = FALSE var/icontype = "beacon" - - - /obj/machinery/power/singularity_beacon/proc/Activate(mob/user = null) if(active) return FALSE @@ -31,9 +28,8 @@ GLOBAL_VAR_INIT(singularity_counter, 0) if(user) to_chat(user, "The connected wire doesn't have enough current.") return FALSE - GLOB.singularity_counter++ - for(var/datum/round_event_control/meteor_wave/W in SSevents.control) - W.weight += round(initial(W.weight) * METEOR_DISASTER_MODIFIER) + if(is_station_level(z)) + increment_meteor_waves() for(var/obj/singularity/singulo in GLOB.singularities) if(singulo.z == z) singulo.target = src @@ -43,7 +39,6 @@ GLOBAL_VAR_INIT(singularity_counter, 0) to_chat(user, "You activate the beacon.") return TRUE - /obj/machinery/power/singularity_beacon/proc/Deactivate(mob/user) if(!active) return FALSE @@ -54,16 +49,25 @@ GLOBAL_VAR_INIT(singularity_counter, 0) active = FALSE if(user) to_chat(user, "You deactivate the beacon.") + if(meteor_buff) + decrement_meteor_waves() + return TRUE + +/obj/machinery/power/singularity_beacon/proc/increment_meteor_waves() + meteor_buff = TRUE + GLOB.singularity_counter++ + for(var/datum/round_event_control/meteor_wave/W in SSevents.control) + W.weight += round(initial(W.weight) * METEOR_DISASTER_MODIFIER) + +/obj/machinery/power/singularity_beacon/proc/decrement_meteor_waves() + meteor_buff = FALSE GLOB.singularity_counter-- for(var/datum/round_event_control/meteor_wave/W in SSevents.control) W.weight -= round(initial(W.weight) * METEOR_DISASTER_MODIFIER) - return TRUE - /obj/machinery/power/singularity_beacon/attack_ai(mob/user) return - /obj/machinery/power/singularity_beacon/attack_hand(mob/user) . = ..() if(.) @@ -104,6 +108,12 @@ GLOBAL_VAR_INIT(singularity_counter, 0) if(!active) return + var/is_on_station = is_station_level(z) + if(meteor_buff && !is_on_station) + decrement_meteor_waves() + else if(!meteor_buff && is_on_station) + increment_meteor_waves() + if(surplus() >= 1500) add_load(1500) if(cooldown <= world.time)