mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
Merge Conflict
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* _stubs.dm
|
||||
*
|
||||
* This file contains constructs that the process scheduler expects to exist
|
||||
* in a standard ss13 fork.
|
||||
*/
|
||||
/*
|
||||
/**
|
||||
* message_admins
|
||||
*
|
||||
* sends a message to admins
|
||||
*/
|
||||
/proc/message_admins(msg)
|
||||
world << msg
|
||||
*/
|
||||
/**
|
||||
* 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)
|
||||
world << "Diary: \[[diaryType]:[type]] [text]"
|
||||
else
|
||||
world << "Log: \[[type]] [text]"
|
||||
@@ -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
|
||||
|
||||
@@ -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,13 +343,12 @@ 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
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/datum/controller/process/bot/setup()
|
||||
name = "bot"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
|
||||
/datum/controller/process/bot/started()
|
||||
..()
|
||||
if(!aibots)
|
||||
aibots = list()
|
||||
|
||||
/datum/controller/process/bot/statProcess()
|
||||
..()
|
||||
stat(null, "[aibots && aibots.len] bots")
|
||||
|
||||
/datum/controller/process/bot/doWork()
|
||||
for(last_object in aibots)
|
||||
var/obj/machinery/bot/B = last_object
|
||||
if(istype(B) && isnull(B.gcDestroyed))
|
||||
// Some bots sleep when they process, but there's not many bots, so just spawn them off
|
||||
spawn(-1)
|
||||
try
|
||||
B.bot_process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, B)
|
||||
SCHECK
|
||||
else
|
||||
catchBadType(B)
|
||||
aibots -= B
|
||||
@@ -60,7 +60,7 @@ var/global/datum/controller/process/timer/timer_master
|
||||
event.thingToCall = thingToCall
|
||||
event.procToCall = procToCall
|
||||
event.timeToRun = world.time + wait
|
||||
event.hash = list2text(args)
|
||||
event.hash = jointext(args, null)
|
||||
if(args.len > 4)
|
||||
event.argList = args.Copy(5)
|
||||
|
||||
|
||||
@@ -167,8 +167,6 @@
|
||||
|
||||
var/disable_away_missions = 0 // disable away missions
|
||||
|
||||
var/autoconvert_notes = 0 //if all connecting player's notes should attempt to be converted to the database
|
||||
|
||||
var/ooc_allowed = 1
|
||||
var/looc_allowed = 1
|
||||
var/dooc_allowed = 1
|
||||
@@ -223,7 +221,7 @@
|
||||
if(type == "config")
|
||||
switch (name)
|
||||
if ("resource_urls")
|
||||
config.resource_urls = text2list(value, " ")
|
||||
config.resource_urls = splittext(value, " ")
|
||||
|
||||
if ("admin_legacy_system")
|
||||
config.admin_legacy_system = 1
|
||||
@@ -458,7 +456,7 @@
|
||||
config.comms_password = value
|
||||
|
||||
if("irc_bot_host")
|
||||
config.irc_bot_host = text2list(value, ";")
|
||||
config.irc_bot_host = splittext(value, ";")
|
||||
|
||||
if("main_irc")
|
||||
config.main_irc = value
|
||||
@@ -546,9 +544,6 @@
|
||||
if("disable_away_missions")
|
||||
config.disable_away_missions = 1
|
||||
|
||||
if("autoconvert_notes")
|
||||
config.autoconvert_notes = 1
|
||||
|
||||
if("disable_lobby_music")
|
||||
config.disable_lobby_music = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user