mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Fixes merge conflict in admin_verbs.dm
This commit is contained in:
@@ -48,7 +48,10 @@
|
||||
// This controls how often the process will yield (call sleep(0)) while it is running.
|
||||
// Every concurrent process should sleep periodically while running in order to allow other
|
||||
// processes to execute concurrently.
|
||||
var/tmp/sleep_interval
|
||||
var/tmp/sleep_interval = PROCESS_DEFAULT_SLEEP_INTERVAL
|
||||
|
||||
// Defer usage; the tick usage at which this process will defer until the next tick
|
||||
var/tmp/defer_usage = PROCESS_DEFAULT_DEFER_USAGE
|
||||
|
||||
// hang_warning_time - this is the time (in 1/10 seconds) after which the server will begin to show "maybe hung" in the context window
|
||||
var/tmp/hang_warning_time = PROCESS_DEFAULT_HANG_WARNING_TIME
|
||||
@@ -59,19 +62,13 @@
|
||||
// hang_restart_time - After this much time(in 1/10 seconds), the server will automatically kill and restart the process.
|
||||
var/tmp/hang_restart_time = PROCESS_DEFAULT_HANG_RESTART_TIME
|
||||
|
||||
// How many times in the current run has the process deferred work till the next tick?
|
||||
var/tmp/cpu_defer_count = 0
|
||||
|
||||
// How many SCHECKs have been skipped (to limit btime calls)
|
||||
var/tmp/calls_since_last_scheck = 0
|
||||
// Number of deciseconds to delay before starting the process
|
||||
var/start_delay = 0
|
||||
|
||||
/**
|
||||
* recordkeeping vars
|
||||
*/
|
||||
|
||||
// Records the time (1/10s timeoftick) at which the process last finished sleeping
|
||||
var/tmp/last_slept = 0
|
||||
|
||||
// Records the time (1/10s timeofgame) at which the process last began running
|
||||
var/tmp/run_start = 0
|
||||
|
||||
@@ -85,11 +82,29 @@
|
||||
|
||||
var/tmp/last_object
|
||||
|
||||
// How many times in the current run has the process deferred work till the next tick?
|
||||
var/tmp/cpu_defer_count = 0
|
||||
|
||||
// Counts the number of times an exception has occurred; gets reset after 10
|
||||
var/tmp/list/exceptions = list()
|
||||
|
||||
// Number of deciseconds to delay before starting the process
|
||||
var/start_delay = 0
|
||||
// The next tick_usage the process will sleep at
|
||||
var/tmp/next_sleep_usage
|
||||
|
||||
// Last run duration, in seconds
|
||||
var/tmp/last_run_time = 0
|
||||
|
||||
// Last 20 run durations
|
||||
var/tmp/list/last_twenty_run_times = list()
|
||||
|
||||
// Highest run duration, in seconds
|
||||
var/tmp/highest_run_time = 0
|
||||
|
||||
// Tick usage at start of current run (updates upon deferring)
|
||||
var/tmp/tick_usage_start
|
||||
|
||||
// Accumulated tick usage from before each deferral
|
||||
var/tmp/tick_usage_accumulated = 0
|
||||
|
||||
/datum/controller/process/New(var/datum/controller/processScheduler/scheduler)
|
||||
..()
|
||||
@@ -97,14 +112,15 @@
|
||||
previousStatus = "idle"
|
||||
idle()
|
||||
name = "process"
|
||||
schedule_interval = 50
|
||||
sleep_interval = world.tick_lag / PROCESS_DEFAULT_SLEEP_INTERVAL
|
||||
last_slept = 0
|
||||
run_start = 0
|
||||
ticks = 0
|
||||
last_task = 0
|
||||
last_object = null
|
||||
|
||||
/datum/controller/process/Destroy()
|
||||
..()
|
||||
return QDEL_HINT_HARDDEL_NOW
|
||||
|
||||
/datum/controller/process/proc/started()
|
||||
// Initialize run_start so we can detect hung processes.
|
||||
run_start = TimeOfGame
|
||||
@@ -112,6 +128,10 @@
|
||||
// Initialize defer count
|
||||
cpu_defer_count = 0
|
||||
|
||||
// Prepare usage tracking (defer() updates these)
|
||||
tick_usage_start = world.tick_usage
|
||||
tick_usage_accumulated = 0
|
||||
|
||||
running()
|
||||
main.processStarted(src)
|
||||
|
||||
@@ -119,11 +139,23 @@
|
||||
|
||||
/datum/controller/process/proc/finished()
|
||||
ticks++
|
||||
recordRunTime()
|
||||
idle()
|
||||
main.processFinished(src)
|
||||
|
||||
onFinish()
|
||||
|
||||
/datum/controller/process/proc/recordRunTime()
|
||||
// Convert from tick usage (100/tick) to seconds of CPU time used
|
||||
var/total_usage = (tick_usage_accumulated + (world.tick_usage - tick_usage_start)) / 1000 * world.tick_lag
|
||||
|
||||
last_run_time = total_usage
|
||||
if(total_usage > highest_run_time)
|
||||
highest_run_time = total_usage
|
||||
if(last_twenty_run_times.len == 20)
|
||||
last_twenty_run_times.Cut(1, 2)
|
||||
last_twenty_run_times += total_usage
|
||||
|
||||
/datum/controller/process/proc/doWork()
|
||||
|
||||
/datum/controller/process/proc/setup()
|
||||
@@ -167,6 +199,7 @@
|
||||
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)
|
||||
log_runtime(EXCEPTION(msg), src)
|
||||
|
||||
main.restartProcess(src.name)
|
||||
|
||||
@@ -175,17 +208,16 @@
|
||||
var/msg = "[name] process was killed at tick #[ticks]."
|
||||
log_debug(msg)
|
||||
message_admins(msg)
|
||||
log_runtime(EXCEPTION(msg), src)
|
||||
//finished()
|
||||
|
||||
// Allow inheritors to clean up if needed
|
||||
onKill()
|
||||
|
||||
// This should del
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
// Do not call this directly - use SHECK or SCHECK_EVERY
|
||||
/datum/controller/process/proc/sleepCheck(var/tickId = 0)
|
||||
calls_since_last_scheck = 0
|
||||
// Do not call this directly - use SHECK
|
||||
/datum/controller/process/proc/defer()
|
||||
if(killed)
|
||||
// The kill proc is the only place where killed is set.
|
||||
// The kill proc should have deleted this datum, and all sleeping procs that are
|
||||
@@ -196,15 +228,14 @@
|
||||
handleHung()
|
||||
CRASH("Process [name] hung and was restarted.")
|
||||
|
||||
if(main.getCurrentTickElapsedTime() > main.timeAllowance)
|
||||
tick_usage_accumulated += (world.tick_usage - tick_usage_start)
|
||||
if(world.tick_usage < defer_usage)
|
||||
sleep(0)
|
||||
else
|
||||
sleep(world.tick_lag)
|
||||
cpu_defer_count++
|
||||
last_slept = 0
|
||||
else
|
||||
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 = TimeOfTick
|
||||
tick_usage_start = world.tick_usage
|
||||
next_sleep_usage = min(world.tick_usage + sleep_interval, defer_usage)
|
||||
|
||||
/datum/controller/process/proc/update()
|
||||
// Clear delta
|
||||
@@ -231,14 +262,14 @@
|
||||
return
|
||||
|
||||
/datum/controller/process/proc/getContext()
|
||||
return "<tr><td>[name]</td><td>[main.averageRunTime(src)]</td><td>[main.last_run_time[src]]</td><td>[main.highest_run_time[src]]</td><td>[ticks]</td></tr>\n"
|
||||
return "<tr><td>[name]</td><td>[getAverageRunTime()]</td><td>[last_run_time]</td><td>[highest_run_time]</td><td>[ticks]</td></tr>\n"
|
||||
|
||||
/datum/controller/process/proc/getContextData()
|
||||
return list(
|
||||
"name" = name,
|
||||
"averageRunTime" = main.averageRunTime(src),
|
||||
"lastRunTime" = main.last_run_time[src],
|
||||
"highestRunTime" = main.highest_run_time[src],
|
||||
"averageRunTime" = getAverageRunTime(),
|
||||
"lastRunTime" = last_run_time,
|
||||
"highestRunTime" = highest_run_time,
|
||||
"ticks" = ticks,
|
||||
"schedule" = schedule_interval,
|
||||
"status" = getStatusText(),
|
||||
@@ -286,7 +317,6 @@
|
||||
name = target.name
|
||||
schedule_interval = target.schedule_interval
|
||||
sleep_interval = target.sleep_interval
|
||||
last_slept = 0
|
||||
run_start = 0
|
||||
times_killed = target.times_killed
|
||||
ticks = target.ticks
|
||||
@@ -309,21 +339,33 @@
|
||||
disabled = 0
|
||||
|
||||
/datum/controller/process/proc/getAverageRunTime()
|
||||
return main.averageRunTime(src)
|
||||
var/t = 0
|
||||
var/c = 0
|
||||
for(var/time in last_twenty_run_times)
|
||||
t += time
|
||||
c++
|
||||
|
||||
if(c > 0)
|
||||
return t / c
|
||||
return c
|
||||
|
||||
/datum/controller/process/proc/getLastRunTime()
|
||||
return main.getProcessLastRunTime(src)
|
||||
return last_run_time
|
||||
|
||||
/datum/controller/process/proc/getHighestRunTime()
|
||||
return main.getProcessHighestRunTime(src)
|
||||
return highest_run_time
|
||||
|
||||
/datum/controller/process/proc/getTicks()
|
||||
return ticks
|
||||
|
||||
/datum/controller/process/proc/statProcess()
|
||||
var/averageRunTime = round(getAverageRunTime(), 0.1)/10
|
||||
var/lastRunTime = round(getLastRunTime(), 0.1)/10
|
||||
var/highestRunTime = round(getHighestRunTime(), 0.1)/10
|
||||
stat("[name]", "T#[getTicks()] | AR [averageRunTime] | LR [lastRunTime] | HR [highestRunTime] | D [cpu_defer_count]")
|
||||
var/averageRunTime = round(getAverageRunTime(), 0.001)
|
||||
var/lastRunTime = round(last_run_time, 0.001)
|
||||
var/highestRunTime = round(highest_run_time, 0.001)
|
||||
var/deferTime = round(cpu_defer_count / 10 * world.tick_lag, 0.01)
|
||||
if(!statclick)
|
||||
statclick = new (src)
|
||||
stat("[name]", statclick.update("T#[getTicks()] | AR [averageRunTime] | LR [lastRunTime] | HR [highestRunTime] | D [deferTime]"))
|
||||
|
||||
/datum/controller/process/proc/catchException(var/exception/e, var/thrower)
|
||||
if(istype(e)) // Real runtimes go to the real error handler
|
||||
@@ -355,4 +397,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")
|
||||
|
||||
@@ -20,18 +20,6 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
// Process last queued times (world time)
|
||||
var/tmp/datum/controller/process/list/last_queued = new
|
||||
|
||||
// Process last start times (real time)
|
||||
var/tmp/datum/controller/process/list/last_start = new
|
||||
|
||||
// Process last run durations
|
||||
var/tmp/datum/controller/process/list/last_run_time = new
|
||||
|
||||
// Per process list of the last 20 durations
|
||||
var/tmp/datum/controller/process/list/last_twenty_run_times = new
|
||||
|
||||
// Process highest run time
|
||||
var/tmp/datum/controller/process/list/highest_run_time = new
|
||||
|
||||
// How long to sleep between runs (set to tick_lag in New)
|
||||
var/tmp/scheduler_sleep_interval
|
||||
|
||||
@@ -41,22 +29,16 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
// Setup for these processes will be deferred until all the other processes are set up.
|
||||
var/tmp/list/deferredSetupList = new
|
||||
|
||||
var/tmp/currentTick = 0
|
||||
|
||||
var/tmp/timeAllowance = 0
|
||||
|
||||
var/tmp/cpuAverage = 0
|
||||
|
||||
var/tmp/timeAllowanceMax = 0
|
||||
|
||||
/datum/controller/processScheduler/New()
|
||||
..()
|
||||
// When the process scheduler is first new'd, tick_lag may be wrong, so these
|
||||
// get re-initialized when the process scheduler is started.
|
||||
// (These are kept here for any processes that decide to process before round start)
|
||||
scheduler_sleep_interval = world.tick_lag
|
||||
timeAllowance = world.tick_lag * 0.5
|
||||
timeAllowanceMax = world.tick_lag
|
||||
|
||||
/datum/controller/processScheduler/Destroy()
|
||||
..()
|
||||
return QDEL_HINT_HARDDEL_NOW
|
||||
|
||||
/**
|
||||
* deferSetupFor
|
||||
@@ -72,7 +54,7 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
/datum/controller/processScheduler/proc/setup()
|
||||
// There can be only one
|
||||
if(processScheduler && (processScheduler != src))
|
||||
del(src)
|
||||
qdel(src)
|
||||
return 0
|
||||
|
||||
var/process
|
||||
@@ -88,20 +70,12 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
isRunning = 1
|
||||
// tick_lag will have been set by now, so re-initialize these
|
||||
scheduler_sleep_interval = world.tick_lag
|
||||
timeAllowance = world.tick_lag * 0.5
|
||||
timeAllowanceMax = world.tick_lag
|
||||
updateStartDelays()
|
||||
spawn(0)
|
||||
process()
|
||||
|
||||
/datum/controller/processScheduler/proc/process()
|
||||
updateCurrentTickData()
|
||||
|
||||
for(var/i=world.tick_lag,i<world.tick_lag*50,i+=world.tick_lag)
|
||||
spawn(i) updateCurrentTickData()
|
||||
while(isRunning)
|
||||
// Hopefully spawning this for 50 ticks in the future will make it the first thing in the queue.
|
||||
spawn(world.tick_lag*50) updateCurrentTickData()
|
||||
checkRunningProcesses()
|
||||
queueProcesses()
|
||||
runQueuedProcesses()
|
||||
@@ -148,20 +122,6 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
process.idle()
|
||||
idle.Add(process)
|
||||
|
||||
// init recordkeeping vars
|
||||
last_start.Add(process)
|
||||
last_start[process] = 0
|
||||
last_run_time.Add(process)
|
||||
last_run_time[process] = 0
|
||||
last_twenty_run_times.Add(process)
|
||||
last_twenty_run_times[process] = list()
|
||||
highest_run_time.Add(process)
|
||||
highest_run_time[process] = 0
|
||||
|
||||
// init starts and stops record starts
|
||||
recordStart(process, 0)
|
||||
recordEnd(process, 0)
|
||||
|
||||
// Set up process
|
||||
process.setup()
|
||||
|
||||
@@ -178,24 +138,9 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
queued.Remove(oldProcess)
|
||||
idle.Add(newProcess)
|
||||
|
||||
last_start.Remove(oldProcess)
|
||||
last_start.Add(newProcess)
|
||||
last_start[newProcess] = 0
|
||||
|
||||
last_run_time.Add(newProcess)
|
||||
last_run_time[newProcess] = last_run_time[oldProcess]
|
||||
last_run_time.Remove(oldProcess)
|
||||
|
||||
last_twenty_run_times.Add(newProcess)
|
||||
last_twenty_run_times[newProcess] = last_twenty_run_times[oldProcess]
|
||||
last_twenty_run_times.Remove(oldProcess)
|
||||
|
||||
highest_run_time.Add(newProcess)
|
||||
highest_run_time[newProcess] = highest_run_time[oldProcess]
|
||||
highest_run_time.Remove(oldProcess)
|
||||
|
||||
recordStart(newProcess, 0)
|
||||
recordEnd(newProcess, 0)
|
||||
newProcess.last_run_time = oldProcess.last_run_time
|
||||
newProcess.last_twenty_run_times = oldProcess.last_twenty_run_times
|
||||
newProcess.highest_run_time = oldProcess.highest_run_time
|
||||
|
||||
nameToProcessMap[newProcess.name] = newProcess
|
||||
|
||||
@@ -210,11 +155,10 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
|
||||
/datum/controller/processScheduler/proc/processStarted(var/datum/controller/process/process)
|
||||
setRunningProcessState(process)
|
||||
recordStart(process)
|
||||
last_queued[process] = world.time
|
||||
|
||||
/datum/controller/processScheduler/proc/processFinished(var/datum/controller/process/process)
|
||||
setIdleProcessState(process)
|
||||
recordEnd(process)
|
||||
|
||||
/datum/controller/processScheduler/proc/setIdleProcessState(var/datum/controller/process/process)
|
||||
if(process in running)
|
||||
@@ -243,64 +187,6 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
if(!(process in running))
|
||||
running += process
|
||||
|
||||
/datum/controller/processScheduler/proc/recordStart(var/datum/controller/process/process, var/time = null)
|
||||
if(isnull(time))
|
||||
time = TimeOfGame
|
||||
last_queued[process] = world.time
|
||||
last_start[process] = time
|
||||
else
|
||||
last_queued[process] = (time == 0 ? 0 : world.time)
|
||||
last_start[process] = time
|
||||
|
||||
/datum/controller/processScheduler/proc/recordEnd(var/datum/controller/process/process, var/time = null)
|
||||
if(isnull(time))
|
||||
time = TimeOfGame
|
||||
|
||||
var/lastRunTime = time - last_start[process]
|
||||
|
||||
if(lastRunTime < 0)
|
||||
lastRunTime = 0
|
||||
|
||||
recordRunTime(process, lastRunTime)
|
||||
|
||||
/**
|
||||
* recordRunTime
|
||||
* Records a run time for a process
|
||||
*/
|
||||
/datum/controller/processScheduler/proc/recordRunTime(var/datum/controller/process/process, time)
|
||||
last_run_time[process] = time
|
||||
if(time > highest_run_time[process])
|
||||
highest_run_time[process] = time
|
||||
|
||||
var/list/lastTwenty = last_twenty_run_times[process]
|
||||
if(lastTwenty.len == 20)
|
||||
lastTwenty.Cut(1, 2)
|
||||
lastTwenty.len++
|
||||
lastTwenty[lastTwenty.len] = time
|
||||
|
||||
/**
|
||||
* averageRunTime
|
||||
* returns the average run time (over the last 20) of the process
|
||||
*/
|
||||
/datum/controller/processScheduler/proc/averageRunTime(var/datum/controller/process/process)
|
||||
var/lastTwenty = last_twenty_run_times[process]
|
||||
|
||||
var/t = 0
|
||||
var/c = 0
|
||||
for(var/time in lastTwenty)
|
||||
t += time
|
||||
c++
|
||||
|
||||
if(c > 0)
|
||||
return t / c
|
||||
return c
|
||||
|
||||
/datum/controller/processScheduler/proc/getProcessLastRunTime(var/datum/controller/process/process)
|
||||
return last_run_time[process]
|
||||
|
||||
/datum/controller/processScheduler/proc/getProcessHighestRunTime(var/datum/controller/process/process)
|
||||
return highest_run_time[process]
|
||||
|
||||
/datum/controller/processScheduler/proc/getStatusData()
|
||||
var/list/data = new
|
||||
|
||||
@@ -338,33 +224,12 @@ var/global/datum/controller/processScheduler/processScheduler
|
||||
var/datum/controller/process/process = nameToProcessMap[processName]
|
||||
process.disable()
|
||||
|
||||
/datum/controller/processScheduler/proc/getCurrentTickElapsedTime()
|
||||
if(world.time > currentTick)
|
||||
updateCurrentTickData()
|
||||
return 0
|
||||
else
|
||||
return TimeOfTick
|
||||
|
||||
/datum/controller/processScheduler/proc/updateCurrentTickData()
|
||||
if(world.time > currentTick)
|
||||
// New tick!
|
||||
currentTick = world.time
|
||||
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 = 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/statProcesses()
|
||||
if(!isRunning)
|
||||
stat("Processes", "Scheduler not running")
|
||||
return
|
||||
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")
|
||||
if(!statclick)
|
||||
statclick = new (src)
|
||||
stat("Processes", statclick.update("[processes.len] (R [running.len] / Q [queued.len] / I [idle.len])"))
|
||||
for(var/datum/controller/process/p in processes)
|
||||
p.statProcess()
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/datum/controller/process/fast_process/setup()
|
||||
name = "fast processing"
|
||||
schedule_interval = 2 //every 0.2 seconds
|
||||
start_delay = 9
|
||||
log_startup_progress("Fast Processing starting up.")
|
||||
|
||||
/datum/controller/process/fast_process/statProcess()
|
||||
..()
|
||||
stat(null, "[fast_processing.len] fast machines")
|
||||
|
||||
/datum/controller/process/fast_process/doWork()
|
||||
for(last_object in fast_processing)
|
||||
var/obj/O = last_object
|
||||
try
|
||||
O.process()
|
||||
catch(var/exception/e)
|
||||
catchException(e, O)
|
||||
@@ -0,0 +1,23 @@
|
||||
var/global/datum/controller/process/fire/fire_master
|
||||
|
||||
/datum/controller/process/fire
|
||||
var/list/burning = list()
|
||||
|
||||
/datum/controller/process/fire/setup()
|
||||
name = "fire"
|
||||
schedule_interval = 20 //every 2 seconds
|
||||
fire_master = src
|
||||
log_startup_progress("Fire process starting up.")
|
||||
|
||||
/datum/controller/process/fire/statProcess()
|
||||
..()
|
||||
stat(null, "[burning.len] burning objects")
|
||||
|
||||
/datum/controller/process/fire/doWork()
|
||||
for(var/obj/burningobj in burning)
|
||||
if(burningobj.burn_state == ON_FIRE)
|
||||
if(burningobj.burn_world_time < world.time)
|
||||
burningobj.burn()
|
||||
SCHECK
|
||||
else
|
||||
burning.Remove(burningobj)
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/datum/controller/process/machinery/statProcess()
|
||||
..()
|
||||
stat(null, "[machines.len] machines")
|
||||
stat(null, "[machine_processing.len] machines")
|
||||
stat(null, "[powernets.len] powernets, [deferred_powernet_rebuilds.len] deferred")
|
||||
|
||||
/datum/controller/process/machinery/doWork()
|
||||
@@ -19,15 +19,15 @@
|
||||
/datum/controller/process/machinery/proc/process_sort()
|
||||
if(machinery_sort_required)
|
||||
machinery_sort_required = 0
|
||||
machines = dd_sortedObjectList(machines)
|
||||
machine_processing = dd_sortedObjectList(machine_processing)
|
||||
|
||||
/datum/controller/process/machinery/proc/process_machines()
|
||||
for(last_object in machines)
|
||||
for(last_object in machine_processing)
|
||||
var/obj/machinery/M = last_object
|
||||
if(istype(M) && isnull(M.gcDestroyed))
|
||||
try
|
||||
if(M.process() == PROCESS_KILL)
|
||||
machines.Remove(M)
|
||||
machine_processing.Remove(M)
|
||||
continue
|
||||
|
||||
if(M.use_power)
|
||||
@@ -36,9 +36,9 @@
|
||||
catchException(e, M)
|
||||
else
|
||||
catchBadType(M)
|
||||
machines -= M
|
||||
machine_processing -= M
|
||||
|
||||
SCHECK_EVERY(100)
|
||||
SCHECK
|
||||
|
||||
/datum/controller/process/machinery/proc/process_power()
|
||||
for(last_object in deferred_powernet_rebuilds)
|
||||
|
||||
@@ -164,7 +164,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
continue
|
||||
|
||||
var/turf/T = get_turf(thing)
|
||||
if(T && T.z == ZLEVEL_STATION)
|
||||
if(T && is_station_level(T.z))
|
||||
callShuttle = 0
|
||||
break
|
||||
|
||||
@@ -209,7 +209,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
if(!M.roundstart_move)
|
||||
continue
|
||||
for(var/obj/docking_port/stationary/S in stationary)
|
||||
if(S.z != ZLEVEL_STATION && findtext(S.id, M.id))
|
||||
if(!is_station_level(S.z) && findtext(S.id, M.id))
|
||||
S.width = M.width
|
||||
S.height = M.height
|
||||
S.dwidth = M.dwidth
|
||||
|
||||
@@ -62,7 +62,10 @@ var/global/datum/controller/process/timer/timer_master
|
||||
event.thingToCall = thingToCall
|
||||
event.procToCall = procToCall
|
||||
event.timeToRun = world.time + wait
|
||||
event.hash = jointext(args, null)
|
||||
var/hashlist = args.Copy()
|
||||
|
||||
hashlist[1] = "[thingToCall](\ref[thingToCall])"
|
||||
event.hash = jointext(hashlist, null)
|
||||
if(args.len > 4)
|
||||
event.argList = args.Copy(5)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//Used for all kinds of weather, ex. lavaland ash storms.
|
||||
// TODO: This could probably be better-integrated with the space manager
|
||||
var/global/datum/controller/process/weather/weather_master
|
||||
|
||||
/datum/controller/process/weather
|
||||
@@ -32,7 +33,7 @@ var/global/datum/controller/process/weather/weather_master
|
||||
var/list/possible_weather_for_this_z = list()
|
||||
for(var/V in existing_weather)
|
||||
var/datum/weather/WE = V
|
||||
if(WE.target_z == Z && WE.probability) //Another check so that it doesn't run extra weather
|
||||
if(WE.target_level == Z && WE.probability) //Another check so that it doesn't run extra weather
|
||||
possible_weather_for_this_z[WE] = WE.probability
|
||||
var/datum/weather/W = pickweight(possible_weather_for_this_z)
|
||||
run_weather(W.name)
|
||||
|
||||
@@ -103,6 +103,7 @@ var/const/PUBLIC_HIGH_FREQ = 1489
|
||||
var/const/RADIO_HIGH_FREQ = 1600
|
||||
|
||||
var/const/SYND_FREQ = 1213
|
||||
var/const/SYNDTEAM_FREQ = 1244
|
||||
var/const/DTH_FREQ = 1341
|
||||
var/const/AI_FREQ = 1343
|
||||
var/const/ERT_FREQ = 1345
|
||||
@@ -132,6 +133,7 @@ var/list/radiochannels = list(
|
||||
"Response Team" = ERT_FREQ,
|
||||
"Special Ops" = DTH_FREQ,
|
||||
"Syndicate" = SYND_FREQ,
|
||||
"SyndTeam" = SYNDTEAM_FREQ,
|
||||
"Supply" = SUP_FREQ,
|
||||
"Service" = SRV_FREQ,
|
||||
"AI Private" = AI_FREQ,
|
||||
@@ -143,7 +145,7 @@ var/list/radiochannels = list(
|
||||
var/list/CENT_FREQS = list(ERT_FREQ, DTH_FREQ)
|
||||
|
||||
// Antag channels, i.e. Syndicate
|
||||
var/list/ANTAG_FREQS = list(SYND_FREQ)
|
||||
var/list/ANTAG_FREQS = list(SYND_FREQ, SYNDTEAM_FREQ)
|
||||
|
||||
//Department channels, arranged lexically
|
||||
var/list/DEPT_FREQS = list(AI_FREQ, COMM_FREQ, ENG_FREQ, MED_FREQ, SEC_FREQ, SCI_FREQ, SRV_FREQ, SUP_FREQ)
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
var/ToRban = 0
|
||||
var/automute_on = 0 //enables automuting/spam prevention
|
||||
var/jobs_have_minimal_access = 0 //determines whether jobs use minimal access or expanded access.
|
||||
var/round_abandon_penalty_period = 30 MINUTES // Time from round start during which ghosting out is penalized
|
||||
|
||||
var/reactionary_explosions = 0 //If we use reactionary explosions, explosions that react to walls and doors
|
||||
|
||||
@@ -85,7 +86,6 @@
|
||||
var/donationsurl = "http://example.org"
|
||||
var/repositoryurl = "http://example.org"
|
||||
|
||||
var/media_base_url = "http://example.org"
|
||||
var/overflow_server_url
|
||||
var/forbid_singulo_possession = 0
|
||||
|
||||
@@ -496,9 +496,6 @@
|
||||
if("assistant_ratio")
|
||||
config.assistantratio = text2num(value)
|
||||
|
||||
if("media_base_url")
|
||||
media_base_url = value
|
||||
|
||||
if("allow_drone_spawn")
|
||||
config.allow_drone_spawn = text2num(value)
|
||||
|
||||
@@ -508,18 +505,6 @@
|
||||
if("max_maint_drones")
|
||||
config.max_maint_drones = text2num(value)
|
||||
|
||||
if("station_levels")
|
||||
config.station_levels = text2numlist(value, ";")
|
||||
|
||||
if("admin_levels")
|
||||
config.admin_levels = text2numlist(value, ";")
|
||||
|
||||
if("contact_levels")
|
||||
config.contact_levels = text2numlist(value, ";")
|
||||
|
||||
if("player_levels")
|
||||
config.player_levels = text2numlist(value, ";")
|
||||
|
||||
if("expected_round_length")
|
||||
config.expected_round_length = MinutesToTicks(text2num(value))
|
||||
|
||||
@@ -573,6 +558,9 @@
|
||||
if("max_loadout_points")
|
||||
config.max_loadout_points = text2num(value)
|
||||
|
||||
if("round_abandon_penalty_period")
|
||||
config.round_abandon_penalty_period = MinutesToTicks(text2num(value))
|
||||
|
||||
else
|
||||
diary << "Unknown setting in configuration: '[name]'"
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ var/global/pipe_processing_killed = 0
|
||||
var/iteration = 0
|
||||
var/processing_interval = 0
|
||||
|
||||
// Dummy object to let us click it to debug while in the stat panel
|
||||
var/obj/effect/statclick/debug/statclick
|
||||
|
||||
/datum/controller/proc/recover() // If we are replacing an existing controller (due to a crash) we attempt to preserve as much as we can.
|
||||
|
||||
/datum/controller/game_controller
|
||||
@@ -24,7 +27,7 @@ var/global/pipe_processing_killed = 0
|
||||
//There can be only one master_controller. Out with the old and in with the new.
|
||||
if(master_controller != src)
|
||||
if(istype(master_controller))
|
||||
del(master_controller)
|
||||
qdel(master_controller)
|
||||
master_controller = src
|
||||
|
||||
var/watch=0
|
||||
@@ -38,16 +41,32 @@ var/global/pipe_processing_killed = 0
|
||||
if(!syndicate_code_phrase) syndicate_code_phrase = generate_code_phrase()
|
||||
if(!syndicate_code_response) syndicate_code_response = generate_code_phrase()
|
||||
|
||||
/datum/controller/game_controller/Destroy()
|
||||
..()
|
||||
return QDEL_HINT_HARDDEL_NOW
|
||||
|
||||
/datum/controller/game_controller/proc/setup()
|
||||
world.tick_lag = config.Ticklag
|
||||
|
||||
zlevels.initialize()
|
||||
|
||||
preloadTemplates()
|
||||
if(!config.disable_away_missions)
|
||||
createRandomZlevel()
|
||||
// Create 6 extra space levels to put space ruins on
|
||||
if(!config.disable_space_ruins)
|
||||
seedRuins(7, rand(0, 3), /area/space, space_ruins_templates)
|
||||
var/timer = start_watch()
|
||||
log_startup_progress("Creating random space levels...")
|
||||
seedRuins(level_name_to_num(EMPTY_AREA), rand(0, 3), /area/space, space_ruins_templates)
|
||||
log_startup_progress("Loaded random space levels in [stop_watch(timer)]s.")
|
||||
|
||||
// We'll keep this around for the time when we finally expunge all
|
||||
// code that checks on hard-defined z positions
|
||||
|
||||
// var/num_extra_space = 6
|
||||
// for(var/i = 1, i <= num_extra_space, i++)
|
||||
// var/zlev = space_manager.add_new_zlevel("[EMPTY_AREA] #[i]", linkage = CROSSLINKED)
|
||||
// seedRuins(zlev, rand(0, 3), /area/space, space_ruins_templates)
|
||||
|
||||
space_manager.do_transition_setup()
|
||||
|
||||
setup_objects()
|
||||
setupgenetics()
|
||||
|
||||
+10
-10
@@ -256,7 +256,7 @@ var/global/list/round_voters = list() //Keeps track of the individuals voting fo
|
||||
|
||||
log_vote(text)
|
||||
to_chat(world, {"<font color='purple'><b>[text]</b>
|
||||
<a href='?src=\ref[src];vote=open'>Click here or type vote to place your vote.</a>
|
||||
<a href='?src=[UID()];vote=open'>Click here or type vote to place your vote.</a>
|
||||
You have [config.vote_period/10] seconds to vote.</font>"})
|
||||
switch(vote_type)
|
||||
if("crew_transfer")
|
||||
@@ -308,34 +308,34 @@ var/global/list/round_voters = list() //Keeps track of the individuals voting fo
|
||||
if(mode)
|
||||
dat += "<div id='vote_div'>[vote_html(C)]</div><hr>"
|
||||
if(admin)
|
||||
dat += "(<a href='?src=\ref[src];vote=cancel'>Cancel Vote</a>) "
|
||||
dat += "(<a href='?src=[UID()];vote=cancel'>Cancel Vote</a>) "
|
||||
else
|
||||
dat += "<div id='vote_div'><h2>Start a vote:</h2><hr><ul><li>"
|
||||
//restart
|
||||
if(admin || config.allow_vote_restart)
|
||||
dat += "<a href='?src=\ref[src];vote=restart'>Restart</a>"
|
||||
dat += "<a href='?src=[UID()];vote=restart'>Restart</a>"
|
||||
else
|
||||
dat += "<font color='grey'>Restart (Disallowed)</font>"
|
||||
dat += "</li><li>"
|
||||
if(admin || config.allow_vote_restart)
|
||||
dat += "<a href='?src=\ref[src];vote=crew_transfer'>Crew Transfer</a>"
|
||||
dat += "<a href='?src=[UID()];vote=crew_transfer'>Crew Transfer</a>"
|
||||
else
|
||||
dat += "<font color='grey'>Crew Transfer (Disallowed)</font>"
|
||||
if(admin)
|
||||
dat += "\t(<a href='?src=\ref[src];vote=toggle_restart'>[config.allow_vote_restart?"Allowed":"Disallowed"]</a>)"
|
||||
dat += "\t(<a href='?src=[UID()];vote=toggle_restart'>[config.allow_vote_restart?"Allowed":"Disallowed"]</a>)"
|
||||
dat += "</li><li>"
|
||||
//gamemode
|
||||
if(admin || config.allow_vote_mode)
|
||||
dat += "<a href='?src=\ref[src];vote=gamemode'>GameMode</a>"
|
||||
dat += "<a href='?src=[UID()];vote=gamemode'>GameMode</a>"
|
||||
else
|
||||
dat += "<font color='grey'>GameMode (Disallowed)</font>"
|
||||
if(admin)
|
||||
dat += "\t(<a href='?src=\ref[src];vote=toggle_gamemode'>[config.allow_vote_mode?"Allowed":"Disallowed"]</a>)"
|
||||
dat += "\t(<a href='?src=[UID()];vote=toggle_gamemode'>[config.allow_vote_mode?"Allowed":"Disallowed"]</a>)"
|
||||
|
||||
dat += "</li>"
|
||||
//custom
|
||||
if(admin)
|
||||
dat += "<li><a href='?src=\ref[src];vote=custom'>Custom</a></li>"
|
||||
dat += "<li><a href='?src=[UID()];vote=custom'>Custom</a></li>"
|
||||
dat += "</ul></div><hr>"
|
||||
var/datum/browser/popup = new(C.mob, "vote", "Voting Panel", nref=src)
|
||||
popup.set_content(dat)
|
||||
@@ -356,9 +356,9 @@ var/global/list/round_voters = list() //Keeps track of the individuals voting fo
|
||||
if(!votes)
|
||||
votes = 0
|
||||
if(current_votes[C.ckey] == i)
|
||||
. += "<li><b><a href='?src=\ref[src];vote=[i]'>[choices[i]] ([votes] vote\s)</a></b></li>"
|
||||
. += "<li><b><a href='?src=[UID()];vote=[i]'>[choices[i]] ([votes] vote\s)</a></b></li>"
|
||||
else
|
||||
. += "<li><a href='?src=\ref[src];vote=[i]'>[choices[i]] ([votes] vote\s)</a></li>"
|
||||
. += "<li><a href='?src=[UID()];vote=[i]'>[choices[i]] ([votes] vote\s)</a></li>"
|
||||
|
||||
. += "</ul>"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user