Merge pull request #2232 from SinTwo/scheduler

510 scheduler
This commit is contained in:
EmperorJon
2016-08-08 10:36:36 +01:00
committed by GitHub
48 changed files with 206 additions and 238 deletions

BIN
btime.dll

Binary file not shown.

BIN
btime.so

Binary file not shown.

View File

@@ -1,18 +0,0 @@
// Comment this out if the external btime library is unavailable
#define PRECISE_TIMER_AVAILABLE
#ifdef PRECISE_TIMER_AVAILABLE
var/global/__btime__libName = "btime.[world.system_type==MS_WINDOWS?"dll":"so"]"
#define TimeOfHour (__extern__timeofhour)
#define __extern__timeofhour text2num(call(__btime__libName, "gettime")())
/hook/startup/proc/checkbtime()
try
// This will always return 1 unless the btime library cannot be accessed
if(TimeOfHour || 1) return 1
catch(var/exception/e)
log_to_dd("PRECISE_TIMER_AVAILABLE is defined in btime.dm, but calling the btime library failed: [e]")
log_to_dd("This is a fatal error. The world will now shut down.")
del(world)
#else
#define TimeOfHour (world.timeofday % 36000)
#endif

View File

@@ -26,4 +26,7 @@
#define INFINITY 1.#INF
#define TICKS_IN_DAY 24*60*60*10
#define TICKS_IN_SECOND 10
#define TICKS_IN_SECOND 10
#define SIMPLE_SIGN(X) ((X) < 0 ? -1 : 1)
#define SIGN(X) ((X) ? SIMPLE_SIGN(X) : 0)

View File

@@ -11,10 +11,9 @@
#define PROCESS_DEFAULT_HANG_ALERT_TIME 600 // 60 seconds
#define PROCESS_DEFAULT_HANG_RESTART_TIME 900 // 90 seconds
#define PROCESS_DEFAULT_SCHEDULE_INTERVAL 50 // 50 ticks
#define PROCESS_DEFAULT_SLEEP_INTERVAL 8 // 2 ticks
#define PROCESS_DEFAULT_CPU_THRESHOLD 90 // 90%
#define PROCESS_DEFAULT_SLEEP_INTERVAL 8 // 1/8th of a tick
// SCHECK macros
// This references src directly to work around a weird bug with try/catch
#define SCHECK_EVERY(this_many_calls) if(++src.calls_since_last_scheck >= this_many_calls) sleepCheck()
#define SCHECK SCHECK_EVERY(50)
#define SCHECK sleepCheck()

View File

@@ -4,17 +4,56 @@
#define MINUTE *600
#define MINUTES *600
var/roundstart_hour = 0
//Returns the world time in english
proc/worldtime2text(time = world.time, timeshift = 1)
if(!roundstart_hour) roundstart_hour = pick(2,7,12,17)
return timeshift ? time2text(time+(36000*roundstart_hour), "hh:mm") : time2text(time, "hh:mm")
#define HOUR *36000
#define HOURS *36000
proc/worlddate2text()
return num2text((text2num(time2text(world.timeofday, "YYYY"))+544)) + "-" + time2text(world.timeofday, "MM-DD")
#define DAY *864000
#define DAYS *864000
proc/time_stamp()
return time2text(world.timeofday, "hh:mm:ss")
#define TimeOfGame (get_game_time())
#define TimeOfTick (world.tick_usage*0.01*world.tick_lag)
/proc/get_game_time()
var/global/time_offset = 0
var/global/last_time = 0
var/global/last_usage = 0
var/wtime = world.time
var/wusage = world.tick_usage * 0.01
if(last_time < wtime && last_usage > 1)
time_offset += last_usage - 1
last_time = wtime
last_usage = wusage
return wtime + (time_offset + wusage) * world.tick_lag
var/roundstart_hour
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)
/proc/stationtime2text()
return time2text(station_time_in_ticks, "hh:mm")
/proc/stationdate2text()
var/update_time = FALSE
if(station_time_in_ticks > 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/timeofday = world.timeofday + extra_days
station_date = num2text((text2num(time2text(timeofday, "YYYY"))+544)) + "-" + time2text(timeofday, "MM-DD")
return station_date
/proc/time_stamp()
return time2text(station_time_in_ticks, "hh:mm:ss")
/* Returns 1 if it is the selected month and day */
proc/isDay(var/month, var/day)
@@ -36,9 +75,7 @@ var/round_start_time = 0
round_start_time = world.time
return 1
#define round_duration_in_ticks (round_start_time ? world.time - round_start_time : 0)
/proc/round_duration_as_text()
/proc/roundduration2text()
if(!round_start_time)
return "00:00"
if(last_round_duration && world.time < next_duration_update)
@@ -55,3 +92,12 @@ var/round_start_time = 0
last_round_duration = "[hours]:[mins]"
next_duration_update = world.time + 1 MINUTES
return last_round_duration
//Can be useful for things dependent on process timing
/proc/process_schedule_interval(var/process_name)
var/datum/controller/process/process = processScheduler.getProcess(process_name)
return process.schedule_interval
/hook/startup/proc/set_roundstart_hour()
roundstart_hour = pick(2,7,12,17)
return 1

View File

@@ -1,19 +0,0 @@
/**
* _stubs.dm
*
* This file contains constructs that the process scheduler expects to exist
* in a standard ss13 fork.
*/
/**
* logTheThing
*
* In goonstation, this proc writes a message to either the world log or diary.
*
* Blame Keelin.
*/
/proc/logTheThing(type, source, target, text, diaryType)
if(diaryType)
log_debug("Diary: \[[diaryType]:[type]] [text]")
else
log_debug("Log: \[[type]] [text]")

View File

@@ -69,10 +69,10 @@
* recordkeeping vars
*/
// Records the time (1/10s timeofday) at which the process last finished sleeping
// Records the time (1/10s timeoftick) at which the process last finished sleeping
var/tmp/last_slept = 0
// Records the time (1/10s timeofday) at which the process last began running
// Records the time (1/10s timeofgame) at which the process last began running
var/tmp/run_start = 0
// Records the number of times this process has been killed and restarted
@@ -106,12 +106,8 @@
last_object = null
/datum/controller/process/proc/started()
var/timeofhour = TimeOfHour
// Initialize last_slept so we can know when to sleep
last_slept = timeofhour
// Initialize run_start so we can detect hung processes.
run_start = timeofhour
run_start = TimeOfGame
// Initialize defer count
cpu_defer_count = 0
@@ -163,18 +159,13 @@
setStatus(PROCESS_STATUS_HUNG)
/datum/controller/process/proc/handleHung()
var/timeofhour = TimeOfHour
var/datum/lastObj = last_object
var/lastObjType = "null"
if(istype(lastObj))
lastObjType = lastObj.type
// If timeofhour has rolled over, then we need to adjust.
if (timeofhour < run_start)
run_start -= 36000
var/msg = "[name] process hung at tick #[ticks]. Process was unresponsive for [(timeofhour - run_start) / 10] seconds and was restarted. Last task: [last_task]. Last Object Type: [lastObjType]"
logTheThing("debug", null, null, msg)
logTheThing("diary", null, null, msg, "debug")
var/msg = "[name] process hung at tick #[ticks]. Process was unresponsive for [(TimeOfGame - run_start) / 10] seconds and was restarted. Last task: [last_task]. Last Object Type: [lastObjType]"
log_debug(msg)
message_admins(msg)
main.restartProcess(src.name)
@@ -182,8 +173,8 @@
/datum/controller/process/proc/kill()
if (!killed)
var/msg = "[name] process was killed at tick #[ticks]."
logTheThing("debug", null, null, msg)
logTheThing("diary", null, null, msg, "debug")
log_debug(msg)
message_admins(msg)
//finished()
// Allow inheritors to clean up if needed
@@ -208,17 +199,12 @@
if (main.getCurrentTickElapsedTime() > main.timeAllowance)
sleep(world.tick_lag)
cpu_defer_count++
last_slept = TimeOfHour
last_slept = 0
else
var/timeofhour = TimeOfHour
// If timeofhour has rolled over, then we need to adjust.
if (timeofhour < last_slept)
last_slept -= 36000
if (timeofhour > last_slept + sleep_interval)
if (TimeOfTick > last_slept + sleep_interval)
// If we haven't slept in sleep_interval deciseconds, sleep to allow other work to proceed.
sleep(0)
last_slept = TimeOfHour
last_slept = TimeOfTick
/datum/controller/process/proc/update()
// Clear delta
@@ -239,10 +225,7 @@
/datum/controller/process/proc/getElapsedTime()
var/timeofhour = TimeOfHour
if (timeofhour < run_start)
return timeofhour - (run_start - 36000)
return timeofhour - run_start
return TimeOfGame - run_start
/datum/controller/process/proc/tickDetail()
return
@@ -343,6 +326,11 @@
stat("[name]", "T#[getTicks()] | AR [averageRunTime] | LR [lastRunTime] | HR [highestRunTime] | D [cpu_defer_count]")
/datum/controller/process/proc/catchException(var/exception/e, var/thrower)
if(istype(e)) // Real runtimes go to the real error handler
// There are two newlines here, because handling desc sucks
e.desc = " Caught by process: [name]\n\n" + e.desc
world.Error(e, e_src = thrower)
return
var/etext = "[e]"
var/eid = "[e]" // Exception ID, for tracking repeated exceptions
var/ptext = "" // "processing..." text, for what was being processed (if known)
@@ -369,4 +357,4 @@
/datum/controller/process/proc/catchBadType(var/datum/caught)
if(isnull(caught) || !istype(caught) || !isnull(caught.gcDestroyed))
return // Only bother with types we can identify and that don't belong
catchException("Type [caught.type] does not belong in process' queue")
catchException("Type [caught.type] does not belong in process' queue")

View File

@@ -43,8 +43,6 @@ var/global/datum/controller/processScheduler/processScheduler
var/tmp/currentTick = 0
var/tmp/currentTickStart = 0
var/tmp/timeAllowance = 0
var/tmp/cpuAverage = 0
@@ -247,7 +245,7 @@ var/global/datum/controller/processScheduler/processScheduler
/datum/controller/processScheduler/proc/recordStart(var/datum/controller/process/process, var/time = null)
if (isnull(time))
time = TimeOfHour
time = TimeOfGame
last_queued[process] = world.time
last_start[process] = time
else
@@ -256,11 +254,7 @@ var/global/datum/controller/processScheduler/processScheduler
/datum/controller/processScheduler/proc/recordEnd(var/datum/controller/process/process, var/time = null)
if (isnull(time))
time = TimeOfHour
// If world.timeofday has rolled over, then we need to adjust.
if (time < last_start[process])
last_start[process] -= 36000
time = TimeOfGame
var/lastRunTime = time - last_start[process]
@@ -349,29 +343,23 @@ var/global/datum/controller/processScheduler/processScheduler
updateCurrentTickData()
return 0
else
return TimeOfHour - currentTickStart
return TimeOfTick
/datum/controller/processScheduler/proc/updateCurrentTickData()
if (world.time > currentTick)
// New tick!
currentTick = world.time
currentTickStart = TimeOfHour
updateTimeAllowance()
cpuAverage = (world.cpu + cpuAverage + cpuAverage) / 3
/datum/controller/processScheduler/proc/updateTimeAllowance()
// Time allowance goes down linearly with world.cpu.
var/tmp/error = cpuAverage - 100
var/tmp/timeAllowanceDelta = sign(error) * -0.5 * world.tick_lag * max(0, 0.001 * abs(error))
var/tmp/timeAllowanceDelta = SIMPLE_SIGN(error) * -0.5 * world.tick_lag * max(0, 0.001 * abs(error))
//timeAllowance = world.tick_lag * min(1, 0.5 * ((200/max(1,cpuAverage)) - 1))
timeAllowance = min(timeAllowanceMax, max(0, timeAllowance + timeAllowanceDelta))
/datum/controller/processScheduler/proc/sign(var/x)
if (x == 0)
return 1
return x / abs(x)
/datum/controller/processScheduler/proc/statProcesses()
if(!isRunning)
stat("Processes", "Scheduler not running")
@@ -379,4 +367,7 @@ var/global/datum/controller/processScheduler/processScheduler
stat("Processes", "[processes.len] (R [running.len] / Q [queued.len] / I [idle.len])")
stat(null, "[round(cpuAverage, 0.1)] CPU, [round(timeAllowance, 0.1)/10] TA")
for(var/datum/controller/process/p in processes)
p.statProcess()
p.statProcess()
/datum/controller/processScheduler/proc/getProcess(var/process_name)
return nameToProcessMap[process_name]

View File

@@ -1,56 +0,0 @@
(function ($) {
function setRef(theRef) {
ref = theRef;
}
function jax(action, data) {
if (typeof data === 'undefined')
data = {};
var params = [];
for (var k in data) {
if (data.hasOwnProperty(k)) {
params.push(encodeURIComponent(k) + '=' + encodeURIComponent(data[k]));
}
}
var newLoc = '?src=' + ref + ';action=' + action + ';' + params.join(';');
window.location = newLoc;
}
function requestRefresh(e) {
jax("refresh", null);
}
function handleRefresh(processTable) {
$('#processTable').html(processTable);
initProcessTableButtons();
}
function requestKill(e) {
var button = $(e.currentTarget);
jax("kill", {name: button.data("process-name")});
}
function requestEnable(e) {
var button = $(e.currentTarget);
jax("enable", {name: button.data("process-name")});
}
function requestDisable(e) {
var button = $(e.currentTarget);
jax("disable", {name: button.data("process-name")});
}
function initProcessTableButtons() {
$(".kill-btn").on("click", requestKill);
$(".enable-btn").on("click", requestEnable);
$(".disable-btn").on("click", requestDisable);
}
window.setRef = setRef;
window.handleRefresh = handleRefresh;
$(function() {
initProcessTableButtons();
$('#btn-refresh').on("click", requestRefresh);
});
}(jQuery));

View File

@@ -410,7 +410,7 @@
visible_message("<span class='notice'>\The [src] rattles and prints out a sheet of paper.</span>")
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(loc)
P.info = "<CENTER><B>Body Scan - [href_list["name"]]</B></CENTER><BR>"
P.info += "<b>Time of scan:</b> [worldtime2text(world.time)]<br><br>"
P.info += "<b>Time of scan:</b> [worldtime2stationtime(world.time)]<br><br>"
P.info += "[printing_text]"
P.info += "<br><br><b>Notes:</b><br>"
P.name = "Body Scan - [href_list["name"]]"

View File

@@ -250,7 +250,7 @@
var/obj/item/weapon/paper/P = new(loc)
if (mode)
P.name = text("crew manifest ([])", worldtime2text())
P.name = text("crew manifest ([])", stationtime2text())
P.info = {"<h4>Crew Manifest</h4>
<br>
[data_core ? data_core.get_manifest(0) : ""]

View File

@@ -20,17 +20,17 @@
/obj/item/weapon/card/id/guest/examine(mob/user)
..(user)
if (world.time < expiration_time)
user << "<span class='notice'>This pass expires at [worldtime2text(expiration_time)].</span>"
user << "<span class='notice'>This pass expires at [worldtime2stationtime(expiration_time)].</span>"
else
user << "<span class='warning'>It expired at [worldtime2text(expiration_time)].</span>"
user << "<span class='warning'>It expired at [worldtime2stationtime(expiration_time)].</span>"
/obj/item/weapon/card/id/guest/read()
if(!Adjacent(usr))
return //Too far to read
if (world.time > expiration_time)
usr << "<span class='notice'>This pass expired at [worldtime2text(expiration_time)].</span>"
usr << "<span class='notice'>This pass expired at [worldtime2stationtime(expiration_time)].</span>"
else
usr << "<span class='notice'>This pass expires at [worldtime2text(expiration_time)].</span>"
usr << "<span class='notice'>This pass expires at [worldtime2stationtime(expiration_time)].</span>"
usr << "<span class='notice'>It grants access to following areas:</span>"
for (var/A in temp_access)
@@ -207,13 +207,13 @@
if ("issue")
if (giver)
var/number = add_zero("[rand(0,9999)]", 4)
var/entry = "\[[worldtime2text()]\] Pass #[number] issued by [giver.registered_name] ([giver.assignment]) to [giv_name]. Reason: [reason]. Grants access to following areas: "
var/entry = "\[[stationtime2text()]\] Pass #[number] issued by [giver.registered_name] ([giver.assignment]) to [giv_name]. Reason: [reason]. Grants access to following areas: "
for (var/i=1 to accesses.len)
var/A = accesses[i]
if (A)
var/area = get_access_desc(A)
entry += "[i > 1 ? ", [area]" : "[area]"]"
entry += ". Expires at [worldtime2text(world.time + duration*10*60)]."
entry += ". Expires at [worldtime2stationtime(world.time + duration*10*60)]."
internal_log.Add(entry)
var/obj/item/weapon/card/id/guest/pass = new(src.loc)

View File

@@ -454,7 +454,7 @@
var/counter = 1
while(src.active2.fields[text("com_[]", counter)])
counter++
src.active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [worldtime2text()], [game_year]<BR>[t1]")
src.active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [stationtime2text()], [game_year]<BR>[t1]")
if (href_list["del_c"])
if ((istype(src.active2, /datum/data/record) && src.active2.fields[text("com_[]", href_list["del_c"])]))

View File

@@ -391,7 +391,7 @@ What a mess.*/
var/counter = 1
while(active2.fields[text("com_[]", counter)])
counter++
active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [worldtime2text()], [game_year]<BR>[t1]")
active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [stationtime2text()], [game_year]<BR>[t1]")
if ("Delete Record (ALL)")
if (active1)

View File

@@ -461,7 +461,7 @@
var/counter = 1
while(src.active2.fields[text("com_[]", counter)])
counter++
src.active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [worldtime2text()], [game_year]<BR>[t1]")
src.active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [stationtime2text()], [game_year]<BR>[t1]")
if (href_list["del_c"])
if ((istype(src.active2, /datum/data/record) && src.active2.fields[text("com_[]", href_list["del_c"])]))

View File

@@ -410,7 +410,7 @@ What a mess.*/
var/counter = 1
while(active2.fields[text("com_[]", counter)])
counter++
active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [worldtime2text()], [game_year]<BR>[t1]")
active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD")] [stationtime2text()], [game_year]<BR>[t1]")
if ("Delete Record (ALL)")
if (active1)

View File

@@ -201,7 +201,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
D.transaction_log.Add(T)
//
T = new()
@@ -210,7 +210,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
vendor_account.transaction_log.Add(T)
newlap = new /obj/machinery/computer3/laptop/vended(src.loc)
@@ -350,7 +350,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
D.transaction_log.Add(T)
//
T = new()
@@ -359,7 +359,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
vendor_account.transaction_log.Add(T)
qdel(relap)

View File

@@ -466,8 +466,8 @@
//Make an announcement and log the person entering storage.
control_computer.frozen_crew += "[occupant.real_name], [occupant.mind.role_alt_title] - [worldtime2text()]"
control_computer._admin_logs += "[key_name(occupant)] ([occupant.mind.role_alt_title]) at [worldtime2text()]"
control_computer.frozen_crew += "[occupant.real_name], [occupant.mind.role_alt_title] - [stationtime2text()]"
control_computer._admin_logs += "[key_name(occupant)] ([occupant.mind.role_alt_title]) at [stationtime2text()]"
log_and_message_admins("[key_name(occupant)] ([occupant.mind.role_alt_title]) entered cryostorage.")
announce.autosay("[occupant.real_name], [occupant.mind.role_alt_title], [on_store_message]", "[on_store_name]")

View File

@@ -76,7 +76,7 @@
var/datum/feed_message/newMsg = new /datum/feed_message
newMsg.author = author
newMsg.body = msg
newMsg.time_stamp = "[worldtime2text()]"
newMsg.time_stamp = "[stationtime2text()]"
newMsg.is_admin_message = adminMessage
if(message_type)
newMsg.message_type = message_type

View File

@@ -150,7 +150,7 @@
return 1
if(STATUS_DISPLAY_TIME)
message1 = "TIME"
message2 = worldtime2text()
message2 = stationtime2text()
update_display(message1, message2)
return 1
return 0

View File

@@ -314,7 +314,7 @@
T.amount = "[currently_vending.price]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
customer_account.transaction_log.Add(T)
// Give the vendor the money. We use the account owner name, which means
@@ -337,7 +337,7 @@
T.amount = "[currently_vending.price]"
T.source_terminal = src.name
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
vendor_account.transaction_log.Add(T)
/obj/machinery/vending/attack_ai(mob/user as mob)

View File

@@ -66,7 +66,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
/obj/item/device/pda/examine(mob/user)
if(..(user, 1))
user << "The time [worldtime2text()] is displayed in the corner of the screen."
user << "The time [stationtime2text()] is displayed in the corner of the screen."
/obj/item/device/pda/medical
default_cartridge = /obj/item/weapon/cartridge/medical
@@ -523,7 +523,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
cartdata["charges"] = cartridge.charges ? cartridge.charges : 0
data["cartridge"] = cartdata
data["stationTime"] = worldtime2text()
data["stationTime"] = stationtime2text()
data["new_Message"] = new_message
data["new_News"] = new_news

View File

@@ -334,7 +334,7 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
data["video_comm"] = video_source ? "\ref[video_source.loc]" : null
data["imContacts"] = im_contacts_ui
data["imList"] = im_list_ui
data["time"] = worldtime2text()
data["time"] = stationtime2text()
data["ring"] = ringer
data["homeScreen"] = modules_ui
data["note"] = note // current notes

View File

@@ -158,7 +158,7 @@
nanoui_data["categories"] = categories
nanoui_data["discount_name"] = discount_item ? discount_item.name : ""
nanoui_data["discount_amount"] = (1-discount_amount)*100
nanoui_data["offer_expiry"] = worldtime2text(next_offer_time)
nanoui_data["offer_expiry"] = worldtime2stationtime(next_offer_time)
else if(nanoui_menu == 1)
var/items[0]
for(var/datum/uplink_item/item in category.items)

View File

@@ -86,7 +86,7 @@
var/scan_data = ""
if(timeofdeath)
scan_data += "<b>Time of death:</b> [worldtime2text(timeofdeath)]<br><br>"
scan_data += "<b>Time of death:</b> [worldtime2stationtime(timeofdeath)]<br><br>"
var/n = 1
for(var/wdata_idx in wdata)
@@ -133,7 +133,7 @@
if(damaging_weapon)
scan_data += "Severity: [damage_desc]<br>"
scan_data += "Hits by weapon: [total_hits]<br>"
scan_data += "Approximate time of wound infliction: [worldtime2text(age)]<br>"
scan_data += "Approximate time of wound infliction: [worldtime2stationtime(age)]<br>"
scan_data += "Affected limbs: [D.organ_names]<br>"
scan_data += "Possible weapons:<br>"
for(var/weapon_name in weapon_chances)

View File

@@ -392,7 +392,7 @@
if (ticker && ticker.current_state >= GAME_STATE_PLAYING)
var/dat = "<html><head><title>Round Status</title></head><body><h1><B>Round Status</B></h1>"
dat += "Current Game Mode: <B>[ticker.mode.name]</B><BR>"
dat += "Round Duration: <B>[round_duration_as_text()]</B><BR>"
dat += "Round Duration: <B>[roundduration2text()]</B><BR>"
dat += "<B>Emergency shuttle</B><BR>"
if (!emergency_shuttle.online())
dat += "<a href='?src=\ref[src];call_shuttle=1'>Call Shuttle</a><br>"

View File

@@ -131,7 +131,7 @@ log transactions
T.amount = I:worth
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
user << "<span class='info'>You insert [I] into [src].</span>"
@@ -260,7 +260,7 @@ log transactions
T.purpose = transfer_purpose
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
T.amount = "([transfer_amount])"
authenticated_account.transaction_log.Add(T)
else
@@ -302,7 +302,7 @@ log transactions
T.purpose = "Unauthorised login attempt"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
failed_account.transaction_log.Add(T)
else
usr << "\red \icon[src] Incorrect pin/account combination entered, [max_pin_attempts - number_incorrect_tries] attempts remaining."
@@ -322,7 +322,7 @@ log transactions
T.purpose = "Remote terminal access"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
usr << "\blue \icon[src] Access granted. Welcome user '[authenticated_account.owner_name].'"
@@ -350,7 +350,7 @@ log transactions
T.amount = "([amount])"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
else
usr << "\icon[src]<span class='warning'>You don't have enough funds to do that!</span>"
@@ -375,7 +375,7 @@ log transactions
T.amount = "([amount])"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
else
usr << "\icon[src]<span class='warning'>You don't have enough funds to do that!</span>"
@@ -387,7 +387,7 @@ log transactions
R.info += "<i>Account holder:</i> [authenticated_account.owner_name]<br>"
R.info += "<i>Account number:</i> [authenticated_account.account_number]<br>"
R.info += "<i>Balance:</i> $[authenticated_account.money]<br>"
R.info += "<i>Date and time:</i> [worldtime2text()], [current_date_string]<br><br>"
R.info += "<i>Date and time:</i> [stationtime2text()], [current_date_string]<br><br>"
R.info += "<i>Service terminal ID:</i> [machine_id]<br>"
//stamp the paper
@@ -410,7 +410,7 @@ log transactions
R.info = "<b>Transaction logs</b><br>"
R.info += "<i>Account holder:</i> [authenticated_account.owner_name]<br>"
R.info += "<i>Account number:</i> [authenticated_account.account_number]<br>"
R.info += "<i>Date and time:</i> [worldtime2text()], [current_date_string]<br><br>"
R.info += "<i>Date and time:</i> [stationtime2text()], [current_date_string]<br><br>"
R.info += "<i>Service terminal ID:</i> [machine_id]<br>"
R.info += "<table border=1 style='width:100%'>"
R.info += "<tr>"
@@ -486,7 +486,7 @@ log transactions
T.purpose = "Remote terminal access"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
view_screen = NO_SCREEN

View File

@@ -40,7 +40,7 @@
M.account_number = rand(111111, 999999)
else
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
T.source_terminal = source_db.machine_id
M.account_number = next_account_number
@@ -57,7 +57,7 @@
R.info += "<i>Account number:</i> [M.account_number]<br>"
R.info += "<i>Account pin:</i> [M.remote_access_pin]<br>"
R.info += "<i>Starting balance:</i> $[M.money]<br>"
R.info += "<i>Date and time:</i> [worldtime2text()], [current_date_string]<br><br>"
R.info += "<i>Date and time:</i> [stationtime2text()], [current_date_string]<br><br>"
R.info += "<i>Creation terminal ID:</i> [source_db.machine_id]<br>"
R.info += "<i>Authorised NT officer overseeing creation:</i> [source_db.held_card.registered_name]<br>"
@@ -80,7 +80,7 @@
for(var/datum/money_account/D in all_money_accounts)
if(D.account_number == attempt_account_number && !D.suspended)
D.money += amount
//create a transaction log entry
var/datum/transaction/T = new()
T.target_name = source_name
@@ -90,12 +90,12 @@
else
T.amount = "[amount]"
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
T.source_terminal = terminal_id
D.transaction_log.Add(T)
return 1
return 0
//this returns the first account datum that matches the supplied accnum/pin combination, it returns null if the combination did not match any account

View File

@@ -28,7 +28,7 @@
T.purpose = reason
T.amount = amount
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
T.source_terminal = machine_id
return T

View File

@@ -140,7 +140,7 @@
T.amount = transaction_amount
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
linked_account.transaction_log.Add(T)
else
usr << "\icon[src]<span class='warning'>\The [O] doesn't have that much money!</span>"
@@ -264,7 +264,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
D.transaction_log.Add(T)
//
T = new()
@@ -273,7 +273,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
linked_account.transaction_log.Add(T)
else
usr << "\icon[src]<span class='warning'>You don't have that much money!</span>"

View File

@@ -256,7 +256,7 @@
T.amount = "([transaction_amount])"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
D.transaction_log.Add(T)
// Create log entry in owner's account
@@ -266,7 +266,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
linked_account.transaction_log.Add(T)
// Save log
@@ -304,7 +304,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
linked_account.transaction_log.Add(T)
// Save log
@@ -414,7 +414,7 @@
<tr></tr>
<tr><td class="tx-name">Customer</td><td class="tx-data">[c_name]</td></tr>
<tr><td class="tx-name">Pay Method</td><td class="tx-data">[p_method]</td></tr>
<tr><td class="tx-name">Station Time</td><td class="tx-data">[worldtime2text()]</td></tr>
<tr><td class="tx-name">Station Time</td><td class="tx-data">[stationtime2text()]</td></tr>
</table>
<table width=300>
"}

View File

@@ -231,7 +231,7 @@
T.amount = "([transaction_amount])"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
D.transaction_log.Add(T)
// Create log entry in owner's account
@@ -241,7 +241,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
linked_account.transaction_log.Add(T)
// Save log
@@ -274,7 +274,7 @@
T.amount = "[transaction_amount]"
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
linked_account.transaction_log.Add(T)
// Save log
@@ -348,7 +348,7 @@
<tr></tr>
<tr><td class="tx-name">Customer</td><td class="tx-data">[c_name]</td></tr>
<tr><td class="tx-name">Pay Method</td><td class="tx-data">[p_method]</td></tr>
<tr><td class="tx-name">Station Time</td><td class="tx-data">[worldtime2text()]</td></tr>
<tr><td class="tx-name">Station Time</td><td class="tx-data">[stationtime2text()]</td></tr>
</table>
<table width=300>
"}

View File

@@ -44,7 +44,7 @@
if(EM.add_to_queue)
EC.available_events += EM
log_debug("Event '[EM.name]' has completed at [worldtime2text()].")
log_debug("Event '[EM.name]' has completed at [worldtime2stationtime(world.time)].")
/datum/event_manager/proc/delay_events(var/severity, var/delay)
var/list/datum/event_container/EC = event_containers[severity]
@@ -67,12 +67,12 @@
var/datum/event_meta/EM = E.event_meta
if(EM.name == "Nothing")
continue
var/message = "'[EM.name]' began at [worldtime2text(E.startedAt)] "
var/message = "'[EM.name]' began at [worldtime2stationtime(E.startedAt)] "
if(E.isRunning)
message += "and is still running."
else
if(E.endedAt - E.startedAt > MinutesToTicks(5)) // Only mention end time if the entire duration was more than 5 minutes
message += "and ended at [worldtime2text(E.endedAt)]."
message += "and ended at [worldtime2stationtime(E.endedAt)]."
else
message += "and ran to completion."
@@ -130,7 +130,7 @@
var/next_event_at = max(0, EC.next_event_time - world.time)
html += "<tr>"
html += "<td>[severity_to_string[severity]]</td>"
html += "<td>[worldtime2text(max(EC.next_event_time, world.time))]</td>"
html += "<td>[worldtime2stationtime(max(EC.next_event_time, world.time))]</td>"
html += "<td>[round(next_event_at / 600, 0.1)]</td>"
html += "<td>"
html += "<A align='right' href='?src=\ref[src];dec_timer=2;event=\ref[EC]'>--</A>"
@@ -178,7 +178,7 @@
html += "<tr>"
html += "<td>[severity_to_string[EM.severity]]</td>"
html += "<td>[EM.name]</td>"
html += "<td>[worldtime2text(ends_at)]</td>"
html += "<td>[worldtime2stationtime(ends_at)]</td>"
html += "<td>[ends_in]</td>"
html += "<td><A align='right' href='?src=\ref[src];stop=\ref[E]'>Stop</A></td>"
html += "</tr>"

View File

@@ -15,15 +15,15 @@
kill()
/datum/event/money_hacker/announce()
var/message = "A brute force hack has been detected (in progress since [worldtime2text()]). The target of the attack is: Financial account #[affected_account.account_number], \
var/message = "A brute force hack has been detected (in progress since [stationtime2text()]). The target of the attack is: Financial account #[affected_account.account_number], \
without intervention this attack will succeed in approximately 10 minutes. Required intervention: temporary suspension of affected accounts until the attack has ceased. \
Notifications will be sent as updates occur.<br>"
var/my_department = "[station_name()] firewall subroutines"
for(var/obj/machinery/message_server/MS in world)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)
/datum/event/money_hacker/tick()
if(world.time >= end_time)
@@ -51,7 +51,7 @@
T.date = pick("", current_date_string, date1, date2)
var/time1 = rand(0, 99999999)
var/time2 = "[round(time1 / 36000)+12]:[(time1 / 600 % 60) < 10 ? add_zero(time1 / 600 % 60, 1) : time1 / 600 % 60]"
T.time = pick("", worldtime2text(), time2)
T.time = pick("", stationtime2text(), time2)
T.source_terminal = pick("","[pick("Biesel","New Gibson")] GalaxyNet Terminal #[rand(111,999)]","your mums place","nantrasen high CommanD")
affected_account.transaction_log.Add(T)

View File

@@ -16,7 +16,7 @@
T.purpose = "Winner!"
T.amount = winner_sum
T.date = current_date_string
T.time = worldtime2text()
T.time = stationtime2text()
T.source_terminal = "Sif TCD Terminal #[rand(111,333)]"
D.transaction_log.Add(T)

View File

@@ -4,7 +4,7 @@
var/releaseWhen = 60
var/list/area/areas = list() //List of areas to affect. Filled by start()
var/eventDept = "Security" //Department name in announcement
var/list/areaName = list("Brig") //Names of areas mentioned in AI and Engineering announcements
var/list/areaType = list(/area/security/prison, /area/security/brig) //Area types to include.
@@ -47,7 +47,7 @@
if(areas && areas.len > 0)
var/my_department = "[station_name()] firewall subroutines"
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [worldtime2text()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.<br>"
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [stationtime2text()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.<br>"
for(var/obj/machinery/message_server/MS in world)
MS.send_rc_message("Engineering", my_department, rc_message, "", "", 2)
for(var/mob/living/silicon/ai/A in player_list)

View File

@@ -78,7 +78,7 @@
healths.icon_state = "health6"
timeofdeath = world.time
if(mind) mind.store_memory("Time of death: [worldtime2text()]", 0)
if(mind) mind.store_memory("Time of death: [stationtime2text()]", 0)
living_mob_list -= src
dead_mob_list |= src

View File

@@ -194,7 +194,7 @@
on_hear_radio(part_a, speaker_name, track, part_b, formatted)
/proc/say_timestamp()
return "<span class='say_quote'>\[[worldtime2text()]\]</span>"
return "<span class='say_quote'>\[[stationtime2text()]\]</span>"
/mob/proc/on_hear_radio(part_a, speaker_name, track, part_b, formatted)
src << "[part_a][speaker_name][part_b][formatted]"

View File

@@ -654,8 +654,8 @@
if(.)
if(statpanel("Status") && ticker && ticker.current_state != GAME_STATE_PREGAME)
stat("Station Time", worldtime2text())
stat("Round Duration", round_duration_as_text())
stat("Station Time", stationtime2text())
stat("Round Duration", roundduration2text())
if(client.holder)
if(statpanel("Status"))

View File

@@ -362,7 +362,7 @@
var/dat = "<html><body><center>"
dat += "<b>Welcome, [name].<br></b>"
dat += "Round Duration: [round_duration_as_text()]<br>"
dat += "Round Duration: [roundduration2text()]<br>"
if(emergency_shuttle) //In case Nanotrasen decides reposess CentComm's shuttles.
if(emergency_shuttle.going_to_centcom()) //Shuttle is going to centcomm, not recalled

View File

@@ -232,8 +232,8 @@
t = replacetext(t, "\[/i\]", "</I>")
t = replacetext(t, "\[u\]", "<U>")
t = replacetext(t, "\[/u\]", "</U>")
t = replacetext(t, "\[time\]", "[worldtime2text()]")
t = replacetext(t, "\[date\]", "[worlddate2text()]")
t = replacetext(t, "\[time\]", "[stationtime2text()]")
t = replacetext(t, "\[date\]", "[stationtime2text()]")
t = replacetext(t, "\[large\]", "<font size=\"4\">")
t = replacetext(t, "\[/large\]", "</font>")
t = replacetext(t, "\[sign\]", "<font face=\"[signfont]\"><i>[get_signature(P, user)]</i></font>")

View File

@@ -133,7 +133,7 @@
M.adjustOxyLoss(3 * removed)
M.Weaken(10)
M.silent = max(M.silent, 10)
M.tod = worldtime2text()
M.tod = stationtime2text()
/datum/reagent/toxin/zombiepowder/Destroy()
if(holder && holder.my_atom && ismob(holder.my_atom))

View File

@@ -389,7 +389,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
PR.name = "list of researched technologies"
PR.info = "<center><b>[station_name()] Science Laboratories</b>"
PR.info += "<h2>[ (text2num(href_list["print"]) == 2) ? "Detailed" : ] Research Progress Report</h2>"
PR.info += "<i>report prepared at [worldtime2text()] station time</i></center><br>"
PR.info += "<i>report prepared at [stationtime2text()] station time</i></center><br>"
if(text2num(href_list["print"]) == 2)
PR.info += GetResearchListInfo()
else

View File

@@ -32,7 +32,7 @@
//create a new scanlog entry
var/datum/depth_scan/D = new()
D.coords = "[M.x].[rand(0,9)]:[M.y].[rand(0,9)]:[10 * M.z].[rand(0,9)]"
D.time = worldtime2text()
D.time = stationtime2text()
D.record_index = positive_locations.len + 1
D.material = M.mineral ? M.mineral.display_name : "Rock"
@@ -54,7 +54,7 @@
//create a new scanlog entry
var/datum/depth_scan/D = new()
D.coords = "[10 * B.x].[rand(0,9)]:[10 * B.y].[rand(0,9)]:[10 * B.z].[rand(0,9)]"
D.time = worldtime2text()
D.time = stationtime2text()
D.record_index = positive_locations.len + 1
//these values are arbitrary

View File

@@ -157,8 +157,8 @@ var/world_topic_spam_protect_time = world.timeofday
// This is dumb, but spacestation13.com's banners break if player count isn't the 8th field of the reply, so... this has to go here.
s["players"] = 0
s["stationtime"] = worldtime2text()
s["roundduration"] = round_duration_as_text()
s["stationtime"] = stationtime2text()
s["roundduration"] = roundduration2text()
if(input["status"] == "2")
var/list/players = list()

View File

@@ -0,0 +1,36 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Sin4
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- tweak: "Scheduler ported from Baystation's port of Paradise's scheduler."

View File

@@ -21,7 +21,6 @@
#include "code\__defines\admin.dm"
#include "code\__defines\appearance.dm"
#include "code\__defines\atmos.dm"
#include "code\__defines\btime.dm"
#include "code\__defines\chemistry.dm"
#include "code\__defines\damage_organs.dm"
#include "code\__defines\dna.dm"
@@ -152,7 +151,6 @@
#include "code\controllers\Processes\ticker.dm"
#include "code\controllers\Processes\turf.dm"
#include "code\controllers\Processes\vote.dm"
#include "code\controllers\ProcessScheduler\core\_stubs.dm"
#include "code\controllers\ProcessScheduler\core\process.dm"
#include "code\controllers\ProcessScheduler\core\processScheduler.dm"
#include "code\datums\ai_law_sets.dm"