mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
`maths.dm`: Rewrite `Gcd(x)` to remove recursive behaviour. Remove `RaiseToPower(x)` and its usage from `event_manager.dm`. Rename `Lerp()` to `Interpolate()`. Add `Square(x)`, which squares a number. Rearrange most of the functions in the file. (trigonometric functions together, etc.) `type2type.dm`: Rewrite `num2hex()` and optimise `hex2num()` for superior clarity and a 100% speed improvement. Correct indenting, spaces, make switches more concise. `time.dm`: Remove old, slanderous commented-out function `/proc/time_stamp()` `lists.dm`: Add the macros, `BITTEST(bitfield,index)`, `BITSET(...)`, `BITRESET(...)` and `BITFLIP(...)` for bit-manipulation and use them where 20+ files do it manually, for arguments of reader clarity and standardness.
25 lines
735 B
Plaintext
25 lines
735 B
Plaintext
#define SECOND *10
|
|
#define SECONDS *10
|
|
|
|
#define MINUTE *600
|
|
#define MINUTES *600
|
|
|
|
//Returns the world time in english
|
|
proc/worldtime2text(time = world.time)
|
|
return "[round(time / 36000)+12]:[(time / 600 % 60) < 10 ? add_zero(time / 600 % 60, 1) : time / 600 % 60]"
|
|
|
|
proc/time_stamp()
|
|
return time2text(world.timeofday, "hh:mm:ss")
|
|
|
|
/* Returns 1 if it is the selected month and day */
|
|
proc/isDay(var/month, var/day)
|
|
if(isnum(month) && isnum(day))
|
|
var/MM = text2num(time2text(world.timeofday, "MM")) // get the current month
|
|
var/DD = text2num(time2text(world.timeofday, "DD")) // get the current day
|
|
if(month == MM && day == DD)
|
|
return 1
|
|
|
|
// Uncomment this out when debugging!
|
|
//else
|
|
//return 1
|