Merge remote-tracking branch 'tgstation/master' into nanoui_update

This commit is contained in:
Bjorn Neergaard
2015-11-27 15:31:35 -05:00
111 changed files with 10003 additions and 8601 deletions
+19 -7
View File
@@ -36,12 +36,14 @@ calculate the longest number of ticks the MC can wait between each cycle without
*/
/datum/controller/game_controller/proc/calculateGCD()
var/GCD
//shortest fire rate is the lower of two ticks or 1ds
var/minimumInterval = min(world.tick_lag*2,1)
for(var/datum/subsystem/SS in subsystems)
if(SS.wait)
GCD = Gcd(round(SS.wait*10), GCD)
GCD = round(GCD)
if(GCD < world.tick_lag*10)
GCD = world.tick_lag*10
if(GCD < minimumInterval*10)
GCD = minimumInterval*10
processing_interval = GCD/10
/datum/controller/game_controller/proc/setup(zlevel)
@@ -94,12 +96,12 @@ calculate the longest number of ticks the MC can wait between each cycle without
while(1) //far more efficient than recursively calling ourself
if(processing_interval > 0)
++iteration
var/startingtick = world.time
start_time = world.timeofday
var/SubSystemRan = 0
for(var/datum/subsystem/SS in subsystems)
if(SS.can_fire > 0)
if(SS.next_fire <= world.time)
if(SS.next_fire <= world.time && SS.last_fire+(SS.wait*0.5) <= world.time)
SubSystemRan = 1
timer = world.timeofday
last_thing_processed = SS.type
@@ -109,19 +111,29 @@ calculate the longest number of ticks the MC can wait between each cycle without
if (SS.dynamic_wait)
var/oldwait = SS.wait
var/GlobalCostDelta = (SSCostPerSecond-(SS.cost/(SS.wait/10)))-1
var/NewWait = MC_AVERAGE(oldwait,(SS.cost-SS.dwait_buffer+GlobalCostDelta)*SS.dwait_delta)
var/NewWait = (SS.cost-SS.dwait_buffer+GlobalCostDelta)*SS.dwait_delta
NewWait = NewWait*(world.cpu/100+1)
NewWait = MC_AVERAGE(oldwait,NewWait)
SS.wait = Clamp(NewWait,SS.dwait_lower,SS.dwait_upper)
if (oldwait != SS.wait)
calculateGCD()
SS.next_fire += SS.wait
++SS.times_fired
//we caused byond to miss a tick, stop processing for a bit
if (startingtick < world.time || start_time+1 < world.timeofday)
break
sleep(-1)
cost = MC_AVERAGE(cost, world.timeofday - start_time)
if (SubSystemRan)
calculateSScost()
sleep(processing_interval)
var/extrasleep = 0
if (startingtick < world.time || start_time+1 < world.timeofday)
//we caused byond to miss a tick, sleep a bit extra
extrasleep += world.tick_lag*2
if (world.cpu > 80)
extrasleep += extrasleep+processing_interval
sleep(processing_interval+extrasleep)
else
sleep(50)
-22
View File
@@ -1,22 +0,0 @@
var/datum/subsystem/bots/SSbot
/datum/subsystem/bots
name = "Bots"
priority = 8
var/list/processing = list()
/datum/subsystem/bots/New()
NEW_SS_GLOBAL(SSbot)
/datum/subsystem/bots/stat_entry(msg)
..("P:[processing.len]")
/datum/subsystem/bots/fire()
var/seconds = wait * 0.1
for(var/thing in processing)
if(thing && !thing:gc_destroyed)
spawn(-1)
thing:bot_process(seconds)
continue
processing.Remove(thing)
@@ -149,6 +149,10 @@
width = 3
height = 4
/obj/docking_port/mobile/pod/request()
if(security_level == SEC_LEVEL_RED || security_level == SEC_LEVEL_DELTA && z == ZLEVEL_STATION)
return ..()
/obj/docking_port/mobile/pod/New()
if(id == "pod")
WARNING("[type] id has not been changed from the default. Use the id convention \"pod1\" \"pod2\" etc.")
@@ -157,13 +161,6 @@
/obj/docking_port/mobile/pod/cancel()
return
/*
findTransitDock()
. = SSshuttle.getDock("[id]_transit")
if(.) return .
return ..()
*/
/obj/machinery/computer/shuttle/pod
name = "pod control computer"
admin_controlled = 1
@@ -176,23 +173,18 @@
/obj/machinery/computer/shuttle/pod/update_icon()
return
/obj/machinery/computer/shuttle/pod/emag_act(mob/user as mob)
user << "<span class='warning'> Access requirements overridden. The pod may now be launched manually at any time.</span>"
admin_controlled = 0
icon_state = "dorm_emag"
/obj/docking_port/stationary/random
name = "escape pod"
id = "pod"
dwidth = 1
width = 3
height = 4
var/target_area = /area/mine/unexplored
/obj/docking_port/stationary/random/initialize()
..()
var/target_area = /area/mine/unexplored
var/turfs = get_area_turfs(target_area)
var/T=pick(turfs)
var/list/turfs = get_area_turfs(target_area)
var/turf/T = pick(turfs)
src.loc = T
//Pod suits/pickaxes