mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-04 14:33:30 +00:00
Makes math helpers defines for performance (#5654)
This commit is contained in:
@@ -532,7 +532,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
|
||||
if(!S || S.robotic < ORGAN_ROBOT || S.open == 3)
|
||||
return ..()
|
||||
|
||||
var/use_amt = min(src.amount, ceil(S.burn_dam/5), 5)
|
||||
var/use_amt = min(src.amount, CEILING(S.burn_dam/5, 1), 5)
|
||||
if(can_use(use_amt))
|
||||
if(S.robo_repair(5*use_amt, BURN, "some damaged wiring", src, user))
|
||||
src.use(use_amt)
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
use_power = light_max_power
|
||||
else
|
||||
var/temp_mod = ((plasma_temperature-5000)/20000)
|
||||
use_range = light_min_range + ceil((light_max_range-light_min_range)*temp_mod)
|
||||
use_power = light_min_power + ceil((light_max_power-light_min_power)*temp_mod)
|
||||
use_range = light_min_range + CEILING((light_max_range-light_min_range)*temp_mod, 1)
|
||||
use_power = light_min_power + CEILING((light_max_power-light_min_power)*temp_mod, 1)
|
||||
|
||||
if(last_range != use_range || last_power != use_power)
|
||||
set_light(use_range,use_power)
|
||||
@@ -318,8 +318,8 @@
|
||||
|
||||
/obj/effect/fusion_em_field/proc/Radiate()
|
||||
if(istype(loc, /turf))
|
||||
var/empsev = max(1, min(3, ceil(size/2)))
|
||||
for(var/atom/movable/AM in range(max(1,Floor(size/2)), loc))
|
||||
var/empsev = max(1, min(3, CEILING(size/2, 1)))
|
||||
for(var/atom/movable/AM in range(max(1,FLOOR(size/2, 1)), loc))
|
||||
|
||||
if(AM == src || AM == owned_core || !AM.simulated)
|
||||
continue
|
||||
@@ -386,7 +386,7 @@
|
||||
//determine a random amount to actually react this cycle, and remove it from the standard pool
|
||||
//this is a hack, and quite nonrealistic :(
|
||||
for(var/reactant in react_pool)
|
||||
react_pool[reactant] = rand(Floor(react_pool[reactant]/2),react_pool[reactant])
|
||||
react_pool[reactant] = rand(FLOOR(react_pool[reactant]/2, 1),react_pool[reactant])
|
||||
dormant_reactant_quantities[reactant] -= react_pool[reactant]
|
||||
if(!react_pool[reactant])
|
||||
react_pool -= reactant
|
||||
@@ -574,7 +574,7 @@
|
||||
/obj/effect/fusion_em_field/proc/Rupture()
|
||||
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
|
||||
set_light(15, 15, "#CCCCFF")
|
||||
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
||||
empulse(get_turf(src), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
|
||||
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
|
||||
RadiateAll()
|
||||
var/list/things_in_range = range(10, owned_core)
|
||||
@@ -584,7 +584,7 @@
|
||||
turfs_in_range.Add(T)
|
||||
|
||||
explosion(pick(things_in_range), -1, 5, 5, 5)
|
||||
empulse(pick(things_in_range), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
||||
empulse(pick(things_in_range), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
|
||||
spawn(25)
|
||||
explosion(pick(things_in_range), -1, 5, 5, 5)
|
||||
spawn(25)
|
||||
@@ -655,7 +655,7 @@
|
||||
/obj/effect/fusion_em_field/proc/BluespaceQuenchEvent() //!!FUN!! causes a number of explosions in an area around the core. Will likely destory or heavily damage the reactor.
|
||||
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
|
||||
set_light(15, 15, "#CCCCFF")
|
||||
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
||||
empulse(get_turf(src), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
|
||||
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
|
||||
RadiateAll()
|
||||
var/list/things_in_range = range(10, owned_core)
|
||||
@@ -665,7 +665,7 @@
|
||||
turfs_in_range.Add(T)
|
||||
for(var/loopcount = 1 to 10)
|
||||
explosion(pick(things_in_range), -1, 5, 5, 5)
|
||||
empulse(pick(things_in_range), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
|
||||
empulse(pick(things_in_range), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
|
||||
Destroy()
|
||||
owned_core.Shutdown()
|
||||
return
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
return PROCESS_KILL
|
||||
|
||||
if(istype(loc, /turf))
|
||||
radiation_repository.radiate(src, max(1,ceil(radioactivity/30)))
|
||||
radiation_repository.radiate(src, max(1,CEILING(radioactivity/30, 1)))
|
||||
|
||||
/obj/item/weapon/fuel_assembly/Destroy()
|
||||
processing_objects -= src
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/stack/material) && W.get_material_name() == DEFAULT_WALL_MATERIAL)
|
||||
var/amt = Ceiling(( initial(integrity) - integrity)/10)
|
||||
var/amt = CEILING(( initial(integrity) - integrity)/10, 1)
|
||||
if(!amt)
|
||||
to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user