From 7916ee76a1ef3a022eacfd02371ff4c0c55b9f89 Mon Sep 17 00:00:00 2001 From: Migratingcocofruit Date: Sat, 19 Oct 2024 20:20:58 +0300 Subject: [PATCH] moves the announcement threshold to a global var. Fixes ghost interaction. --- .../transmission_laser.dm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/code/goonstation/modules/power/power_transmission_laser/transmission_laser.dm b/code/goonstation/modules/power/power_transmission_laser/transmission_laser.dm index 5122dc3542c..0e1cfb7f27c 100644 --- a/code/goonstation/modules/power/power_transmission_laser/transmission_laser.dm +++ b/code/goonstation/modules/power/power_transmission_laser/transmission_laser.dm @@ -1,5 +1,8 @@ #define MINIMUM_POWER 1 MW +/// How much energy do you have to sell in order to get an announcement. Increases each time we reach it. +GLOBAL_VAR_INIT(announcement_threshold, 1 MJ) + /obj/machinery/power/transmission_laser name = "power transmission laser" desc = "Sends power over a giant laser beam to an NT power processing facility." @@ -52,8 +55,6 @@ /// How much energy have we sold in total (Joules) var/total_energy = 0 - /// How much energy do you have to sell in order to get an announcement - var/announcement_threshold = 1 MJ /// How much credits we have earned in total var/total_earnings = 0 @@ -211,21 +212,21 @@ // The message we send var/message var/flavor_text - if(announcement_threshold == 1 MJ) + if(GLOB.announcement_threshold == 1 MJ) message = "PTL account successfully made" flavor_text = "From now on, you will receive regular updates on the power exported via the onboard PTL. Good luck [station_name()]!" - announcement_threshold = 100 MJ + GLOB.announcement_threshold = 100 MJ - message = "New milestone reached!\n[DisplayJoules(announcement_threshold)]\n[flavor_text]" + message = "New milestone reached!\n[DisplayJoules(GLOB.announcement_threshold)]\n[flavor_text]" announcer.Announce(message) - announcement_threshold = min(announcement_threshold * 5, announcement_threshold + 200 GJ) + GLOB.announcement_threshold = min(GLOB.announcement_threshold * 5, GLOB.announcement_threshold + 200 GJ) /obj/machinery/power/transmission_laser/attack_hand(mob/user) ui_interact(user) -/obj/machinery/power/apc/attack_ghost(mob/user) +/obj/machinery/power/transmission_laser/attack_ghost(mob/user) ui_interact(user) /obj/machinery/power/transmission_laser/ui_interact(mob/user, datum/tgui/ui) @@ -305,7 +306,7 @@ if(stat & BROKEN) return - if(total_energy >= announcement_threshold) + if(total_energy >= GLOB.announcement_threshold) send_ptl_announcement() var/last_disp = return_charge()