mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Upgrades SDQL2 and refactors it to a datum
This commit is contained in:
@@ -432,7 +432,7 @@ proc/isInSight(var/atom/A, var/atom/B)
|
||||
|
||||
/proc/Show2Group4Delay(obj/O, list/group, delay=0)
|
||||
if(!isobj(O)) return
|
||||
if(!group) group = clients
|
||||
if(!group) group = GLOB.clients
|
||||
for(var/client/C in group)
|
||||
C.screen += O
|
||||
if(delay)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
var/list/clients = list() //list of all clients
|
||||
var/list/admins = list() //list of all clients whom are admins
|
||||
var/list/directory = list() //list of all ckeys with associated client
|
||||
|
||||
//Since it didn't really belong in any other category, I'm putting this here
|
||||
//This is for procs to replace all the goddamn 'in world's that are chilling around the code
|
||||
|
||||
@@ -147,74 +147,31 @@ var/round_start_time = 0
|
||||
|
||||
//Takes a value of time in deciseconds.
|
||||
//Returns a text value of that number in hours, minutes, or seconds.
|
||||
/proc/DisplayTimeText(time_value, truncate = FALSE)
|
||||
var/second = (time_value)*0.1
|
||||
var/second_adjusted = null
|
||||
var/second_rounded = FALSE
|
||||
var/minute = null
|
||||
var/hour = null
|
||||
var/day = null
|
||||
|
||||
/proc/DisplayTimeText(time_value, round_seconds_to = 0.1)
|
||||
var/second = round(time_value * 0.1, round_seconds_to)
|
||||
if(!second)
|
||||
return "0 seconds"
|
||||
if(second >= 60)
|
||||
minute = FLOOR(second/60, 1)
|
||||
second = round(second - (minute*60), 0.1)
|
||||
second_rounded = TRUE
|
||||
if(second) //check if we still have seconds remaining to format, or if everything went into minute.
|
||||
second_adjusted = round(second) //used to prevent '1 seconds' being shown
|
||||
if(day || hour || minute)
|
||||
if(second_adjusted == 1 && second >= 1)
|
||||
second = " and 1 second"
|
||||
else if(second > 1)
|
||||
second = " and [second_adjusted] seconds"
|
||||
else //shows a fraction if seconds is < 1
|
||||
if(second_rounded) //no sense rounding again if it's already done
|
||||
second = " and [second] seconds"
|
||||
else
|
||||
second = " and [round(second, 0.1)] seconds"
|
||||
else
|
||||
if(second_adjusted == 1 && second >= 1)
|
||||
second = "[truncate ? "second" : "1 second"]"
|
||||
else if(second > 1)
|
||||
second = "[second_adjusted] seconds"
|
||||
else
|
||||
if(second_rounded)
|
||||
second = "[second] seconds"
|
||||
else
|
||||
second = "[round(second, 0.1)] seconds"
|
||||
else
|
||||
second = null
|
||||
|
||||
if(!minute)
|
||||
return "[second]"
|
||||
if(minute >= 60)
|
||||
hour = FLOOR(minute/60, 1)
|
||||
minute = (minute - (hour*60))
|
||||
if(minute) //alot simpler from here since you don't have to worry about fractions
|
||||
if(minute != 1)
|
||||
if((day || hour) && second)
|
||||
minute = ", [minute] minutes"
|
||||
else if((day || hour) && !second)
|
||||
minute = " and [minute] minutes"
|
||||
else
|
||||
minute = "[minute] minutes"
|
||||
else
|
||||
if((day || hour) && second)
|
||||
minute = ", 1 minute"
|
||||
else if((day || hour) && !second)
|
||||
minute = " and 1 minute"
|
||||
else
|
||||
minute = "[truncate ? "minute" : "1 minute"]"
|
||||
else
|
||||
minute = null
|
||||
|
||||
if(!hour)
|
||||
return "[minute][second]"
|
||||
if(hour >= 24)
|
||||
day = FLOOR(hour/24, 1)
|
||||
hour = (hour - (day*24))
|
||||
return "right now"
|
||||
if(second < 60)
|
||||
return "[second] second[(second != 1)? "s":""]"
|
||||
var/minute = FLOOR(second / 60, 1)
|
||||
second = MODULUS(second, 60)
|
||||
var/secondT
|
||||
if(second)
|
||||
secondT = " and [second] second[(second != 1)? "s":""]"
|
||||
if(minute < 60)
|
||||
return "[minute] minute[(minute != 1)? "s":""][secondT]"
|
||||
var/hour = FLOOR(minute / 60, 1)
|
||||
minute = MODULUS(minute, 60)
|
||||
var/minuteT
|
||||
if(minute)
|
||||
minuteT = " and [minute] minute[(minute != 1)? "s":""]"
|
||||
if(hour < 24)
|
||||
return "[hour] hour[(hour != 1)? "s":""][minuteT][secondT]"
|
||||
var/day = FLOOR(hour / 24, 1)
|
||||
hour = MODULUS(hour, 24)
|
||||
var/hourT
|
||||
if(hour)
|
||||
<<<<<<< HEAD
|
||||
if(hour != 1)
|
||||
if(day && (minute || second))
|
||||
hour = ", [hour] hours"
|
||||
@@ -240,3 +197,7 @@ var/round_start_time = 0
|
||||
day = "[truncate ? "day" : "1 day"]"
|
||||
|
||||
return "[day][hour][minute][second]"
|
||||
=======
|
||||
hourT = " and [hour] hour[(hour != 1)? "s":""]"
|
||||
return "[day] day[(day != 1)? "s":""][hourT][minuteT][secondT]"
|
||||
>>>>>>> ae64d73... Upgrades SDQL2 and refactors it to a datum (#5793)
|
||||
|
||||
@@ -1461,3 +1461,5 @@ var/mob/dview/dview_mob = new
|
||||
|
||||
/proc/pass()
|
||||
return
|
||||
|
||||
#define NAMEOF(datum, X) (#X || ##datum.##X)
|
||||
|
||||
Reference in New Issue
Block a user