[MIRROR] Slightly optimizes adjust_clockwork_power (#5884)
* Slightly optimizes adjust_clockwork_power (#36250) * optimizations * Update power_helpers.dm * Slightly optimizes adjust_clockwork_power
This commit is contained in:
committed by
Poojawa
parent
a999863e5c
commit
75160fb5b0
@@ -4,21 +4,23 @@
|
||||
return amount ? GLOB.clockwork_power >= amount : GLOB.clockwork_power
|
||||
|
||||
/proc/adjust_clockwork_power(amount) //Adjusts the global clockwork power by this amount (min 0.)
|
||||
var/current_power
|
||||
if(GLOB.ratvar_approaches)
|
||||
amount *= 0.75 //The herald's beacon reduces power costs by 25% across the board!
|
||||
GLOB.clockwork_power = GLOB.ratvar_awakens ? INFINITY : max(0, GLOB.clockwork_power + amount)
|
||||
GLOB.clockwork_power = CLAMP(GLOB.clockwork_power, 0, MAX_CLOCKWORK_POWER)
|
||||
if(GLOB.ratvar_awakens)
|
||||
current_power = GLOB.clockwork_power = INFINITY
|
||||
else
|
||||
current_power = GLOB.clockwork_power = CLAMP(GLOB.clockwork_power + amount, 0, MAX_CLOCKWORK_POWER)
|
||||
for(var/obj/effect/clockwork/sigil/transmission/T in GLOB.all_clockwork_objects)
|
||||
T.update_icon()
|
||||
var/power_overwhelming = GLOB.clockwork_power
|
||||
var/unlock_message
|
||||
if(power_overwhelming >= SCRIPT_UNLOCK_THRESHOLD && !GLOB.script_scripture_unlocked)
|
||||
if(current_power >= SCRIPT_UNLOCK_THRESHOLD && !GLOB.script_scripture_unlocked)
|
||||
GLOB.script_scripture_unlocked = TRUE
|
||||
unlock_message = "<span class='large_brass bold'>The Ark swells as a key power threshold is reached. Script scriptures are now available.</span>"
|
||||
if(power_overwhelming >= APPLICATION_UNLOCK_THRESHOLD && !GLOB.application_scripture_unlocked)
|
||||
if(current_power >= APPLICATION_UNLOCK_THRESHOLD && !GLOB.application_scripture_unlocked)
|
||||
GLOB.application_scripture_unlocked = TRUE
|
||||
unlock_message = "<span class='large_brass bold'>The Ark surges as a key power threshold is reached. Application scriptures are now available.</span>"
|
||||
if(GLOB.servants_active)
|
||||
if(unlock_message && GLOB.servants_active)
|
||||
hierophant_message(unlock_message)
|
||||
return TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user