mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-29 08:09:34 +01:00
between() -> clamp() & swaps args 1 and 2 in uses
This commit is contained in:
@@ -140,7 +140,7 @@
|
||||
S.relocate()
|
||||
|
||||
/obj/item/shield_projector/proc/adjust_health(amount)
|
||||
shield_health = between(0, shield_health + amount, max_shield_health)
|
||||
shield_health = clamp(shield_health + amount, 0, max_shield_health)
|
||||
if(amount < 0)
|
||||
if(shield_health <= 0)
|
||||
destroy_shields()
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
/obj/effect/energy_field/proc/adjust_strength(amount, impact = 1)
|
||||
var/old_density = density
|
||||
strength = between(0, strength + amount, max_strength)
|
||||
strength = clamp(strength + amount, 0, max_strength)
|
||||
|
||||
//maptext = "[round(strength, 0.1)]/[max_strength]"
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
|
||||
// Small visual effect, makes the shield tiles brighten up by becoming more opaque for a moment, and spreads to nearby shields.
|
||||
/obj/effect/energy_field/proc/impact_effect(var/i, var/list/affected_shields = list())
|
||||
i = between(1, i, 10)
|
||||
i = clamp(1, i, 10)
|
||||
alpha = 200
|
||||
animate(src, alpha = initial(alpha), time = 1 SECOND)
|
||||
affected_shields |= src
|
||||
@@ -152,4 +152,3 @@
|
||||
for(var/obj/effect/energy_field/F in T)
|
||||
if(!(F in affected_shields))
|
||||
F.impact_effect(i, affected_shields) // Spread the effect to them.
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
power = 0
|
||||
return 0
|
||||
|
||||
var/shieldload = between(500, max_stored_power - storedpower, power_draw) //what we try to draw
|
||||
var/shieldload = clamp(max_stored_power - storedpower, 500, power_draw) //what we try to draw
|
||||
shieldload = PN.draw_power(shieldload) //what we actually get
|
||||
storedpower += shieldload
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
PN = C.powernet
|
||||
|
||||
if (PN)
|
||||
var/power_draw = between(0, max_charge - stored_charge, charge_rate) //what we are trying to draw
|
||||
var/power_draw = clamp(max_charge - stored_charge, 0, charge_rate) //what we are trying to draw
|
||||
power_draw = PN.draw_power(power_draw) //what we actually get
|
||||
stored_charge += power_draw
|
||||
|
||||
@@ -145,4 +145,4 @@
|
||||
return
|
||||
|
||||
src.set_dir(turn(src.dir, 270))
|
||||
return
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user