mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fix/rename some timing stuff
This commit is contained in:
@@ -36,25 +36,25 @@
|
||||
|
||||
return wtime + (time_offset + wusage) * world.tick_lag
|
||||
|
||||
var/roundstart_hour
|
||||
GLOBAL_VAR_INIT(roundstart_hour, pick(2,7,12,17))
|
||||
var/station_date = ""
|
||||
var/next_station_date_change = 1 DAY
|
||||
|
||||
#define duration2stationtime(time) time2text(station_time_in_ticks + time, "hh:mm")
|
||||
#define worldtime2stationtime(time) time2text(roundstart_hour HOURS + time, "hh:mm")
|
||||
#define round_duration_in_ticks (round_start_time ? world.time - round_start_time : 0)
|
||||
#define station_time_in_ticks (roundstart_hour HOURS + round_duration_in_ticks)
|
||||
#define duration2stationtime(time) time2text(station_time_in_ds + time, "hh:mm")
|
||||
#define worldtime2stationtime(time) time2text(GLOB.roundstart_hour HOURS + time, "hh:mm")
|
||||
#define round_duration_in_ds (GLOB.round_start_time ? world.time - GLOB.round_start_time : 0)
|
||||
#define station_time_in_ds (GLOB.roundstart_hour HOURS + round_duration_in_ds)
|
||||
|
||||
/proc/stationtime2text()
|
||||
return time2text(station_time_in_ticks, "hh:mm")
|
||||
return time2text(station_time_in_ds, "hh:mm") //For some reason, this is not accurate. It's expecting some other kind of times, maybe? Like ones from world.realtime?
|
||||
|
||||
/proc/stationdate2text()
|
||||
var/update_time = FALSE
|
||||
if(station_time_in_ticks > next_station_date_change)
|
||||
if(station_time_in_ds > next_station_date_change)
|
||||
next_station_date_change += 1 DAY
|
||||
update_time = TRUE
|
||||
if(!station_date || update_time)
|
||||
var/extra_days = round(station_time_in_ticks / (1 DAY)) DAYS
|
||||
var/extra_days = round(station_time_in_ds / (1 DAY)) DAYS
|
||||
var/timeofday = world.timeofday + extra_days
|
||||
station_date = num2text((text2num(time2text(timeofday, "YYYY"))+300)) + "-" + time2text(timeofday, "MM-DD") //VOREStation Edit
|
||||
return station_date
|
||||
@@ -84,19 +84,19 @@ proc/isDay(var/month, var/day)
|
||||
|
||||
var/next_duration_update = 0
|
||||
var/last_round_duration = 0
|
||||
var/round_start_time = 0
|
||||
GLOBAL_VAR_INIT(round_start_time, 0)
|
||||
|
||||
/hook/roundstart/proc/start_timer()
|
||||
round_start_time = world.time
|
||||
GLOB.round_start_time = world.time
|
||||
return 1
|
||||
|
||||
/proc/roundduration2text()
|
||||
if(!round_start_time)
|
||||
if(!GLOB.round_start_time)
|
||||
return "00:00"
|
||||
if(last_round_duration && world.time < next_duration_update)
|
||||
return last_round_duration
|
||||
|
||||
var/mills = round_duration_in_ticks // 1/10 of a second, not real milliseconds but whatever
|
||||
var/mills = round_duration_in_ds // 1/10 of a second, not real milliseconds but whatever
|
||||
//var/secs = ((mills % 36000) % 600) / 10 //Not really needed, but I'll leave it here for refrence.. or something
|
||||
var/mins = round((mills % 36000) / 600)
|
||||
var/hours = round(mills / 36000)
|
||||
@@ -108,10 +108,6 @@ var/round_start_time = 0
|
||||
next_duration_update = world.time + 1 MINUTES
|
||||
return last_round_duration
|
||||
|
||||
/hook/startup/proc/set_roundstart_hour()
|
||||
roundstart_hour = pick(2,7,12,17)
|
||||
return 1
|
||||
|
||||
/var/midnight_rollovers = 0
|
||||
/var/rollovercheck_last_timeofday = 0
|
||||
/proc/update_midnight_rollover()
|
||||
|
||||
@@ -17,14 +17,14 @@ datum/controller/transfer_controller/Destroy()
|
||||
datum/controller/transfer_controller/process()
|
||||
currenttick = currenttick + 1
|
||||
//VOREStation Edit START
|
||||
if (round_duration_in_ticks >= shift_last_vote - 2 MINUTES)
|
||||
if (round_duration_in_ds >= shift_last_vote - 2 MINUTES)
|
||||
shift_last_vote = 999999999999 //Setting to a stupidly high number since it'll be not used again.
|
||||
to_world("<b>Warning: You have one hour left in the shift. Wrap up your scenes in the next 60 minutes before the transfer is called.</b>") //VOREStation Edit
|
||||
if (round_duration_in_ticks >= shift_hard_end - 1 MINUTE)
|
||||
if (round_duration_in_ds >= shift_hard_end - 1 MINUTE)
|
||||
init_shift_change(null, 1)
|
||||
shift_hard_end = timerbuffer + config.vote_autotransfer_interval //If shuttle somehow gets recalled, let's force it to call again next time a vote would occur.
|
||||
timerbuffer = timerbuffer + config.vote_autotransfer_interval //Just to make sure a vote doesn't occur immediately afterwords.
|
||||
else if (round_duration_in_ticks >= timerbuffer - 1 MINUTE)
|
||||
else if (round_duration_in_ds >= timerbuffer - 1 MINUTE)
|
||||
SSvote.autotransfer()
|
||||
//VOREStation Edit END
|
||||
timerbuffer = timerbuffer + config.vote_autotransfer_interval
|
||||
|
||||
@@ -109,7 +109,7 @@ SUBSYSTEM_DEF(game_master)
|
||||
return FALSE
|
||||
|
||||
// Last minute antagging is bad for humans to do, so the GM will respect the start and end of the round.
|
||||
var/mills = round_duration_in_ticks
|
||||
var/mills = round_duration_in_ds
|
||||
var/mins = round((mills % 36000) / 600)
|
||||
var/hours = round(mills / 36000)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ SUBSYSTEM_DEF(nightshift)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/nightshift/fire(resumed = FALSE)
|
||||
if(round_duration_in_ticks < nightshift_first_check)
|
||||
if(round_duration_in_ds < nightshift_first_check)
|
||||
return
|
||||
check_nightshift()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
if(emergency_shuttle.shuttle && (emergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP || emergency_shuttle.shuttle.moving_status == SHUTTLE_INTRANSIT))
|
||||
return // Don't do anything if the shuttle's coming.
|
||||
|
||||
var/mills = round_duration_in_ticks
|
||||
var/mills = round_duration_in_ds
|
||||
var/mins = round((mills % 36000) / 600)
|
||||
var/hours = round(mills / 36000)
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
// Description: This writes to the logs list, so that people can see what people are doing on the Exonet ingame. Note that this is not an admin logging function.
|
||||
// Communicators are already logged seperately.
|
||||
/obj/machinery/exonet_node/proc/write_log(var/origin_address, var/target_address, var/data_type, var/content)
|
||||
//var/timestamp = time2text(station_time_in_ticks, "hh:mm:ss")
|
||||
//var/timestamp = time2text(station_time_in_ds, "hh:mm:ss")
|
||||
var/timestamp = "[stationdate2text()] [stationtime2text()]"
|
||||
var/msg = "[timestamp] | FROM [origin_address] TO [target_address] | TYPE: [data_type] | CONTENT: [content]"
|
||||
logs.Add(msg)
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
newMsg.body = msg
|
||||
newMsg.time_stamp = "[stationtime2text()]"
|
||||
newMsg.is_admin_message = adminMessage
|
||||
newMsg.post_time = round_duration_in_ticks // Should be almost universally unique
|
||||
newMsg.post_time = round_duration_in_ds // Should be almost universally unique
|
||||
if(message_type)
|
||||
newMsg.message_type = message_type
|
||||
if(photo)
|
||||
|
||||
@@ -22,7 +22,7 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT
|
||||
var/last_world_time = 0
|
||||
|
||||
/datum/event_container/process()
|
||||
if(!round_start_time)
|
||||
if(!GLOB.round_start_time)
|
||||
return //don't do events if the round hasn't even started yet
|
||||
|
||||
if(!next_event_time)
|
||||
|
||||
@@ -86,10 +86,10 @@
|
||||
power_draw_per_use = 4
|
||||
|
||||
/obj/item/integrated_circuit/time/clock/do_work()
|
||||
set_pin_data(IC_OUTPUT, 1, time2text(station_time_in_ticks, "hh:mm:ss") )
|
||||
set_pin_data(IC_OUTPUT, 2, text2num(time2text(station_time_in_ticks, "hh") ) )
|
||||
set_pin_data(IC_OUTPUT, 3, text2num(time2text(station_time_in_ticks, "mm") ) )
|
||||
set_pin_data(IC_OUTPUT, 4, text2num(time2text(station_time_in_ticks, "ss") ) )
|
||||
set_pin_data(IC_OUTPUT, 1, time2text(station_time_in_ds, "hh:mm:ss") )
|
||||
set_pin_data(IC_OUTPUT, 2, text2num(time2text(station_time_in_ds, "hh") ) )
|
||||
set_pin_data(IC_OUTPUT, 3, text2num(time2text(station_time_in_ds, "mm") ) )
|
||||
set_pin_data(IC_OUTPUT, 4, text2num(time2text(station_time_in_ds, "ss") ) )
|
||||
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
@@ -153,8 +153,7 @@ var/list/all_maps = list()
|
||||
|
||||
// We have to invent a time
|
||||
else
|
||||
var/seconds_stationtime = round(station_time_in_ticks*0.1) //Not actually ticks......
|
||||
var/datum/time/T = new(seconds_stationtime)
|
||||
var/datum/time/T = new (station_time_in_ds)
|
||||
return T
|
||||
|
||||
// Returns a boolean for if it's night or not on a particular zlevel
|
||||
@@ -162,7 +161,7 @@ var/list/all_maps = list()
|
||||
if(!z)
|
||||
z = 1
|
||||
var/datum/time/now = get_zlevel_time(z)
|
||||
var/percent = now.seconds_stored / now.seconds_in_day
|
||||
var/percent = now.seconds_stored / now.seconds_in_day //practically all of these are in DS
|
||||
|
||||
// First quarter, last quarter
|
||||
if(percent < 0.25 || percent > 0.75)
|
||||
|
||||
Reference in New Issue
Block a user