From d777d90eb2e97981d0d80923b2f949d17a0bc834 Mon Sep 17 00:00:00 2001 From: oranges Date: Wed, 27 Apr 2016 10:56:31 +1200 Subject: [PATCH] Give ceiling a second argument for multiples Cut my life into pieces This is my last resort, Suffocation, no breathing Don't give a fuck if I cut my arm bleeding This is my last resort, Props to MrStonedOne for pointing this out and also /vg/ station for the original implementation - 1d92fdc37 (commit hash in vg code) --- code/__HELPERS/maths.dm | 4 ++-- code/game/machinery/computer/telecrystalconsoles.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index 8e27b4e2acb..60bce0fa978 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -17,8 +17,8 @@ var/list/sqrtTable = list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, var/a = arccos(x / sqrt(x*x + y*y)) return y >= 0 ? a : -a -/proc/Ceiling(x) - return -round(-x) +/proc/Ceiling(x, y=1) + return -round(-x / y) * y #define Clamp(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) ) diff --git a/code/game/machinery/computer/telecrystalconsoles.dm b/code/game/machinery/computer/telecrystalconsoles.dm index 67d4aebd8db..19b2364b032 100644 --- a/code/game/machinery/computer/telecrystalconsoles.dm +++ b/code/game/machinery/computer/telecrystalconsoles.dm @@ -145,7 +145,7 @@ var/list/possible_uplinker_IDs = list("Alfa","Bravo","Charlie","Delta","Echo","F ..() var/danger danger = joined_player_list.len - ticker.mode.syndicates.len - while(!IsMultiple(++danger,10))//Just round up to the nearest multiple of ten. + danger = Ceiling(danger, 10) scaleTC(danger) /obj/machinery/computer/telecrystals/boss/proc/scaleTC(amt)//Its own proc, since it'll probably need a lot of tweaks for balance, use a fancier algorhithm, etc.