mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-30 15:38:02 +01:00
Makes math helpers defines for performance
This commit is contained in:
@@ -152,7 +152,7 @@
|
||||
// Makes shields become gradually more red as the projector's health decreases.
|
||||
/obj/item/shield_projector/proc/update_shield_colors()
|
||||
// This is done at the projector instead of the shields themselves to avoid needing to calculate this more than once every update.
|
||||
var/lerp_weight = shield_health / max_shield_health
|
||||
var/interpolate_weight = shield_health / max_shield_health
|
||||
|
||||
var/list/low_color_list = hex2rgb(low_color)
|
||||
var/low_r = low_color_list[1]
|
||||
@@ -164,9 +164,9 @@
|
||||
var/high_g = high_color_list[2]
|
||||
var/high_b = high_color_list[3]
|
||||
|
||||
var/new_r = Interpolate(low_r, high_r, weight = lerp_weight)
|
||||
var/new_g = Interpolate(low_g, high_g, weight = lerp_weight)
|
||||
var/new_b = Interpolate(low_b, high_b, weight = lerp_weight)
|
||||
var/new_r = LERP(low_r, high_r, interpolate_weight)
|
||||
var/new_g = LERP(low_g, high_g, interpolate_weight)
|
||||
var/new_b = LERP(low_b, high_b, interpolate_weight)
|
||||
|
||||
var/new_color = rgb(new_r, new_g, new_b)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user