mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-24 05:24:14 +01:00
we never checked if the round began before calling round time closes #7524 closes #7523
187 lines
5.3 KiB
Plaintext
187 lines
5.3 KiB
Plaintext
///number of deciseconds in a day
|
|
#define MIDNIGHT_ROLLOVER 864000
|
|
|
|
///displays the current time into the round, with a lot of extra code just there for ensuring it looks okay after an entire day passes
|
|
#define ROUND_TIME(...) ( "[STATION_TIME_PASSED() > MIDNIGHT_ROLLOVER ? "[round(STATION_TIME_PASSED()/MIDNIGHT_ROLLOVER)]:[gameTimestamp(wtime = STATION_TIME_PASSED())]" : gameTimestamp(wtime = STATION_TIME_PASSED())]" )
|
|
|
|
///Returns the time that has passed since the game started
|
|
#define STATION_TIME_PASSED(...) (SSticker.HasRoundStarted() ? (world.time - SSticker.round_start_time) : 0)
|
|
|
|
/// Define that just has the current in-universe year for use in whatever context you might want to display that in. (For example, 2022 -> 2562 given a 540 year offset)
|
|
#define CURRENT_STATION_YEAR (GLOB.year_integer + STATION_YEAR_OFFSET)
|
|
|
|
/// In-universe, SS13 rp is set 544 years in the future from the real-world day, hence this number for determining the year-offset for the in-game year.
|
|
#define STATION_YEAR_OFFSET 544
|
|
|
|
#define JANUARY 1
|
|
#define FEBRUARY 2
|
|
#define MARCH 3
|
|
#define APRIL 4
|
|
#define MAY 5
|
|
#define JUNE 6
|
|
#define JULY 7
|
|
#define AUGUST 8
|
|
#define SEPTEMBER 9
|
|
#define OCTOBER 10
|
|
#define NOVEMBER 11
|
|
#define DECEMBER 12
|
|
|
|
/**
|
|
* Days of the week to make it easier to reference them.
|
|
* When using time2text(), please use "DDD" to find the weekday. Refrain from using "Day"
|
|
*/
|
|
#define MONDAY "Mon"
|
|
#define TUESDAY "Tue"
|
|
#define WEDNESDAY "Wed"
|
|
#define THURSDAY "Thu"
|
|
#define FRIDAY "Fri"
|
|
#define SATURDAY "Sat"
|
|
#define SUNDAY "Sun"
|
|
|
|
#define MILLISECONDS *0.01
|
|
|
|
#define DECISECONDS *1 //the base unit all of these defines are scaled by, because byond uses that as a unit of measurement for some fucking reason
|
|
|
|
#define SECOND SECONDS
|
|
#define SECONDS *10
|
|
|
|
#define MINUTE MINUTES
|
|
#define MINUTES SECONDS*60
|
|
|
|
#define HOUR MINUTES
|
|
#define HOURS MINUTES*60
|
|
|
|
#define DAY DAYS
|
|
#define DAYS HOURS*24
|
|
|
|
#define YEARS DAYS*365 //fuck leap days, they were removed in 2069
|
|
|
|
#define TICK TICKS
|
|
#define TICKS *world.tick_lag
|
|
|
|
/// Convert deciseconds to ticks
|
|
#define DS2TICKS(DS) ((DS)/world.tick_lag)
|
|
/// Convert ticks to deciseconds
|
|
#define TICKS2DS(T) ((T) TICKS)
|
|
|
|
#define MS2DS(T) ((T) MILLISECONDS)
|
|
|
|
/*Timezones*/
|
|
|
|
/// Line Islands Time
|
|
#define TIMEZONE_LINT 14
|
|
|
|
// Chatham Daylight Time
|
|
#define TIMEZONE_CHADT 13.75
|
|
|
|
/// Tokelau Time
|
|
#define TIMEZONE_TKT 13
|
|
|
|
/// Tonga Time
|
|
#define TIMEZONE_TOT 13
|
|
|
|
/// New Zealand Daylight Time
|
|
#define TIMEZONE_NZDT 13
|
|
|
|
/// New Zealand Standard Time
|
|
#define TIMEZONE_NZST 12
|
|
|
|
/// Norfolk Time
|
|
#define TIMEZONE_NFT 11
|
|
|
|
/// Lord Howe Standard Time
|
|
#define TIMEZONE_LHST 10.5
|
|
|
|
/// Australian Eastern Standard Time
|
|
#define TIMEZONE_AEST 10
|
|
|
|
/// Australian Central Standard Time
|
|
#define TIMEZONE_ACST 9.5
|
|
|
|
/// Australian Central Western Standard Time
|
|
#define TIMEZONE_ACWST 8.75
|
|
|
|
/// Australian Western Standard Time
|
|
#define TIMEZONE_AWST 8
|
|
|
|
/// Christmas Island Time
|
|
#define TIMEZONE_CXT 7
|
|
|
|
/// Cocos Islands Time
|
|
#define TIMEZONE_CCT 6.5
|
|
|
|
/// Central European Summer Time
|
|
#define TIMEZONE_CEST 2
|
|
|
|
/// Coordinated Universal Time
|
|
#define TIMEZONE_UTC 0
|
|
|
|
/// Eastern Daylight Time
|
|
#define TIMEZONE_EDT -4
|
|
|
|
/// Eastern Standard Time
|
|
#define TIMEZONE_EST -5
|
|
|
|
/// Central Daylight Time
|
|
#define TIMEZONE_CDT -5
|
|
|
|
/// Central Standard Time
|
|
#define TIMEZONE_CST -6
|
|
|
|
/// Mountain Daylight Time
|
|
#define TIMEZONE_MDT -6
|
|
|
|
/// Mountain Standard Time
|
|
#define TIMEZONE_MST -7
|
|
|
|
/// Pacific Daylight Time
|
|
#define TIMEZONE_PDT -7
|
|
|
|
/// Pacific Standard Time
|
|
#define TIMEZONE_PST -8
|
|
|
|
/// Alaska Daylight Time
|
|
#define TIMEZONE_AKDT -8
|
|
|
|
/// Alaska Standard Time
|
|
#define TIMEZONE_AKST -9
|
|
|
|
/// Hawaii-Aleutian Daylight Time
|
|
#define TIMEZONE_HDT -9
|
|
|
|
/// Hawaii Standard Time
|
|
#define TIMEZONE_HST -10
|
|
|
|
/// Cook Island Time
|
|
#define TIMEZONE_CKT -10
|
|
|
|
/// Niue Time
|
|
#define TIMEZONE_NUT -11
|
|
|
|
/// Anywhere on Earth
|
|
#define TIMEZONE_ANYWHERE_ON_EARTH -12
|
|
|
|
/// in the grim darkness of the thirteenth space station there is no timezones, since they break IC game times. Use this for all IC/round time values
|
|
#define NO_TIMEZONE 0
|
|
|
|
#define GAMETIMESTAMP(format, wtime) time2text(wtime, format)
|
|
#define WORLDTIME2TEXT(format) GAMETIMESTAMP(format, world.time)
|
|
#define WORLDTIMEOFDAY2TEXT(format) GAMETIMESTAMP(format, world.timeofday)
|
|
#define TIME_STAMP(format, showds) showds ? "[WORLDTIMEOFDAY2TEXT(format)]:[world.timeofday % 10]" : WORLDTIMEOFDAY2TEXT(format)
|
|
#define STATION_TIME(display_only, wtime) ((((wtime - SSticker.SSticker.round_start_time) * SSticker.station_time_rate_multiplier) + SSticker.gametime_offset) % 864000)
|
|
#define STATION_TIME_TIMESTAMP(format, wtime) time2text(STATION_TIME(TRUE, wtime), format)
|
|
|
|
/// use for rapid actions that make messages to throttle messages
|
|
#define CHATSPAM_THROTTLE_DEFAULT (!(world.time % 5))
|
|
/// ditto
|
|
#define CHATSPAM_THROTTLE(every) (!(world.time % every))
|
|
|
|
// maths.dm
|
|
//* REALTIMEOFDAY, because we don't have chrono::steady_clock *//
|
|
//* Automatically adjusts to the server rolling over midnight *//
|
|
//* so this is monotonically increasing wall-time. *//
|
|
#define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK))
|
|
|
|
#define MIDNIGHT_ROLLOVER_CHECK ( GLOB.rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : GLOB.midnight_rollovers )
|
|
#define MIDNIGHT_ROLLOVER_CHECK_STANDALONE if(GLOB.rollovercheck_last_timeofday != world.timeofday) update_midnight_rollover()
|