Merge branch 'master' of https://github.com/PolarisSS13/Polaris into 2/17/2018_make_AI_great_again

# Conflicts resolved:
#	icons/mob/modifier_effects.dmi
This commit is contained in:
Neerti
2018-06-15 18:28:00 -04:00
613 changed files with 16003 additions and 11384 deletions
-67
View File
@@ -1,67 +0,0 @@
/var/global/machinery_sort_required = 0
/datum/controller/process/machinery/setup()
name = "machinery"
schedule_interval = 20 // every 2 seconds
start_delay = 12
/datum/controller/process/machinery/doWork()
internal_sort()
internal_process_pipenets()
internal_process_machinery()
internal_process_power()
internal_process_power_drain()
/datum/controller/process/machinery/proc/internal_sort()
if(machinery_sort_required)
machinery_sort_required = 0
machines = dd_sortedObjectList(machines)
/datum/controller/process/machinery/proc/internal_process_machinery()
for(last_object in machines)
var/obj/machinery/M = last_object
if(M && !QDELETED(M))
if(M.process() == PROCESS_KILL)
//M.inMachineList = 0 We don't use this debugging function
machines.Remove(M)
continue
if(M && M.use_power)
M.auto_use_power()
SCHECK
/datum/controller/process/machinery/proc/internal_process_power()
for(last_object in powernets)
var/datum/powernet/powerNetwork = last_object
if(istype(powerNetwork) && !QDELETED(powerNetwork))
powerNetwork.reset()
SCHECK
continue
powernets.Remove(powerNetwork)
/datum/controller/process/machinery/proc/internal_process_power_drain()
// Currently only used by powersinks. These items get priority processed before machinery
for(last_object in processing_power_items)
var/obj/item/I = last_object
if(!I.pwr_drain()) // 0 = Process Kill, remove from processing list.
processing_power_items.Remove(I)
SCHECK
/datum/controller/process/machinery/proc/internal_process_pipenets()
for(last_object in pipe_networks)
var/datum/pipe_network/pipeNetwork = last_object
if(istype(pipeNetwork) && !QDELETED(pipeNetwork))
pipeNetwork.process()
SCHECK
continue
pipe_networks.Remove(pipeNetwork)
/datum/controller/process/machinery/statProcess()
..()
stat(null, "[machines.len] machines")
stat(null, "[powernets.len] powernets")
stat(null, "[pipe_networks.len] pipenets")
stat(null, "[processing_power_items.len] power item\s")
+33 -18
View File
@@ -21,6 +21,7 @@ var/datum/controller/process/planet/planet_controller = null
for(var/datum/planet/P in planets)
if(OT.z in P.expected_z_levels)
P.planet_floors |= OT
OT.vis_contents |= P.weather_holder.visuals
break
outdoor_turfs.Cut() //Why were you in there INCORRECTLY?
@@ -36,6 +37,7 @@ var/datum/controller/process/planet/planet_controller = null
var/datum/planet/P = planet
if(T.z in P.expected_z_levels)
P.planet_floors -= T
T.vis_contents -= P.weather_holder.visuals
/datum/controller/process/planet/doWork()
if(outdoor_turfs.len || planetary_walls.len)
@@ -44,31 +46,44 @@ var/datum/controller/process/planet/planet_controller = null
for(var/datum/planet/P in planets)
P.process(schedule_interval / 10)
SCHECK //Your process() really shouldn't take this long...
//Weather style needs redrawing
if(P.needs_work & PLANET_PROCESS_WEATHER)
P.needs_work &= ~PLANET_PROCESS_WEATHER
var/image/new_overlay = image(icon = P.weather_holder.current_weather.icon, icon_state = P.weather_holder.current_weather.icon_state)
new_overlay.plane = PLANE_PLANETLIGHTING
//Redraw weather icons
for(var/T in P.planet_floors)
var/turf/simulated/turf = T
// turf.overlays -= turf.weather_overlay
turf.weather_overlay = new_overlay
// turf.overlays += turf.weather_overlay
turf.update_icon()
SCHECK
//Sun light needs changing
if(P.needs_work & PLANET_PROCESS_SUN)
P.needs_work &= ~PLANET_PROCESS_SUN
//Redraw sun overlay
var/new_range = P.sun["range"]
// Remove old value from corners
var/list/sunlit_corners = P.sunlit_corners
var/old_lum_r = -P.sun["lum_r"]
var/old_lum_g = -P.sun["lum_g"]
var/old_lum_b = -P.sun["lum_b"]
if(old_lum_r || old_lum_g || old_lum_b)
for(var/C in P.sunlit_corners)
var/datum/lighting_corner/LC = C
LC.update_lumcount(old_lum_r, old_lum_g, old_lum_b)
SCHECK
sunlit_corners.Cut()
// Calculate new values to apply
var/new_brightness = P.sun["brightness"]
var/new_color = P.sun["color"]
for(var/T in P.planet_floors)
var/turf/simulated/turf = T
turf.set_light(new_range, new_brightness, new_color)
var/lum_r = new_brightness * GetRedPart (new_color) / 255
var/lum_g = new_brightness * GetGreenPart(new_color) / 255
var/lum_b = new_brightness * GetBluePart (new_color) / 255
var/static/update_gen = -1 // Used to prevent double-processing corners. Otherwise would happen when looping over adjacent turfs.
for(var/I in P.planet_floors)
var/turf/simulated/T = I
if(!T.lighting_corners_initialised)
T.generate_missing_corners()
for(var/C in T.get_corners())
var/datum/lighting_corner/LC = C
if(LC.update_gen != update_gen && LC.active)
sunlit_corners += LC
LC.update_gen = update_gen
LC.update_lumcount(lum_r, lum_g, lum_b)
SCHECK
update_gen--
P.sun["lum_r"] = lum_r
P.sun["lum_g"] = lum_g
P.sun["lum_b"] = lum_b
//Temperature needs updating
if(P.needs_work & PLANET_PROCESS_TEMP)
+7
View File
@@ -97,6 +97,7 @@ var/list/gamemode_cache = list()
var/guests_allowed = 1
var/debugparanoid = 0
var/panic_bunker = 0
var/paranoia_logging = 0
var/serverurl
var/server
@@ -737,6 +738,12 @@ var/list/gamemode_cache = list()
if("radiation_lower_limit")
radiation_lower_limit = text2num(value)
if ("panic_bunker")
config.panic_bunker = 1
if ("paranoia_logging")
config.paranoia_logging = 1
else
log_misc("Unknown setting in configuration: '[name]'")
@@ -84,7 +84,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
evac = 1
emergency_shuttle_called.Announce(replacetext(using_map.emergency_shuttle_called_message, "%ETA%", "[estimated_time] minute\s"))
for(var/area/A in world)
for(var/area/A in all_areas)
if(istype(A, /area/hallway))
A.readyalert()
@@ -116,7 +116,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
if (evac)
emergency_shuttle_recalled.Announce(using_map.emergency_shuttle_recall_message)
for(var/area/A in world)
for(var/area/A in all_areas)
if(istype(A, /area/hallway))
A.readyreset()
evac = 0
+14 -8
View File
@@ -385,7 +385,7 @@ var/datum/controller/master/Master = new()
if (SS_flags & SS_NO_FIRE)
subsystemstocheck -= SS
continue
if (!(SS_flags & SS_TICKER) && (SS_flags & SS_KEEP_TIMING) && SS.last_fire + (SS.wait * 0.75) > world.time)
if ((SS_flags & (SS_TICKER|SS_KEEP_TIMING)) == SS_KEEP_TIMING && SS.last_fire + (SS.wait * 0.75) > world.time)
continue
SS.enqueue()
. = 1
@@ -428,7 +428,7 @@ var/datum/controller/master/Master = new()
// in those cases, so we just let them run)
if (queue_node_flags & SS_NO_TICK_CHECK)
if (queue_node.tick_usage > TICK_LIMIT_RUNNING - TICK_USAGE && ran_non_ticker)
queue_node.queued_priority += queue_priority_count * 0.10
queue_node.queued_priority += queue_priority_count * 0.1
queue_priority_count -= queue_node_priority
queue_priority_count += queue_node.queued_priority
current_tick_budget -= queue_node_priority
@@ -446,26 +446,32 @@ var/datum/controller/master/Master = new()
else
tick_precentage = tick_remaining
current_ticklimit = TICK_USAGE + tick_precentage
// Reduce tick allocation for subsystems that overran on their last tick.
tick_precentage = max(tick_precentage*0.5, tick_precentage-queue_node.tick_overrun)
current_ticklimit = round(TICK_USAGE + tick_precentage)
if (!(queue_node_flags & SS_TICKER))
ran_non_ticker = TRUE
ran = TRUE
tick_usage = TICK_USAGE
queue_node_paused = (queue_node.state == SS_PAUSED || queue_node.state == SS_PAUSING)
last_type_processed = queue_node
queue_node.state = SS_RUNNING
tick_usage = TICK_USAGE
var/state = queue_node.ignite(queue_node_paused)
tick_usage = TICK_USAGE - tick_usage
if (state == SS_RUNNING)
state = SS_IDLE
current_tick_budget -= queue_node_priority
tick_usage = TICK_USAGE - tick_usage
if (tick_usage < 0)
tick_usage = 0
queue_node.tick_overrun = max(0, MC_AVG_FAST_UP_SLOW_DOWN(queue_node.tick_overrun, tick_usage-tick_precentage))
queue_node.state = state
if (state == SS_PAUSED)
@@ -494,11 +500,11 @@ var/datum/controller/master/Master = new()
if (queue_node_flags & SS_TICKER)
queue_node.next_fire = world.time + (world.tick_lag * queue_node.wait)
else if (queue_node_flags & SS_POST_FIRE_TIMING)
queue_node.next_fire = world.time + queue_node.wait
queue_node.next_fire = world.time + queue_node.wait + (world.tick_lag * (queue_node.tick_overrun/100))
else if (queue_node_flags & SS_KEEP_TIMING)
queue_node.next_fire += queue_node.wait
else
queue_node.next_fire = queue_node.queued_time + queue_node.wait
queue_node.next_fire = queue_node.queued_time + queue_node.wait + (world.tick_lag * (queue_node.tick_overrun/100))
queue_node.queued_time = 0
-59
View File
@@ -49,67 +49,8 @@ datum/controller/game_controller/proc/setup()
// #endif
datum/controller/game_controller/proc/setup_objects()
// #if !UNIT_TEST
// var/initialized_objects = 0
// #endif
// Set up antagonists.
populate_antag_type_list()
//Set up spawn points.
populate_spawn_points()
/*
admin_notice("<span class='danger'>Initializing Floor Decals</span>", R_DEBUG)
var/list/turfs_with_decals = list()
for(var/obj/effect/floor_decal/D in world)
var/T = D.add_to_turf_decals()
if(T) turfs_with_decals |= T
CHECK_SLEEP_MASTER
for(var/item in turfs_with_decals)
var/turf/T = item
if(T.decals) T.apply_decals()
CHECK_SLEEP_MASTER
floor_decals_initialized = TRUE
sleep(1)
admin_notice("<span class='danger'>Initializing objects</span>", R_DEBUG)
for(var/atom/movable/object in world)
if(!QDELETED(object))
object.initialize()
CHECK_SLEEP_MASTER
sleep(1)
admin_notice("<span class='danger'>Initializing areas</span>", R_DEBUG)
for(var/area/area in all_areas)
area.initialize()
CHECK_SLEEP_MASTER
sleep(1)
admin_notice("<span class='danger'>Initializing atmos machinery connections.</span>", R_DEBUG)
for(var/obj/machinery/atmospherics/machine in machines)
machine.atmos_init()
CHECK_SLEEP_MASTER
admin_notice("<span class='danger'>Initializing pipe networks</span>", R_DEBUG)
for(var/obj/machinery/atmospherics/machine in machines)
machine.build_network()
CHECK_SLEEP_MASTER
admin_notice("<span class='danger'>Initializing atmos machinery.</span>", R_DEBUG)
for(var/obj/machinery/atmospherics/unary/U in machines)
if(istype(U, /obj/machinery/atmospherics/unary/vent_pump))
var/obj/machinery/atmospherics/unary/vent_pump/T = U
T.broadcast_status()
else if(istype(U, /obj/machinery/atmospherics/unary/vent_scrubber))
var/obj/machinery/atmospherics/unary/vent_scrubber/T = U
T.broadcast_status()
CHECK_SLEEP_MASTER
admin_notice("<span class='danger'>Initializing turbolifts</span>", R_DEBUG)
for(var/thing in turbolifts)
var/obj/turbolift_map_holder/lift = thing
if(!QDELETED(lift))
lift.initialize()
CHECK_SLEEP_MASTER
*/
+4 -3
View File
@@ -1,9 +1,9 @@
/datum/controller/subsystem
// Metadata; you should define these.
name = "fire coderbus" //name of the subsystem
var/init_order = 0 //order of initialization. Higher numbers are initialized first, lower numbers later. Can be decimal and negative values.
var/init_order = INIT_ORDER_DEFAULT //order of initialization. Higher numbers are initialized first, lower numbers later. Can be decimal and negative values.
var/wait = 20 //time to wait (in deciseconds) between each call to fire(). Must be a positive integer.
var/priority = 50 //When mutiple subsystems need to run in the same tick, higher priority subsystems will run first and be given a higher share of the tick before MC_TICK_CHECK triggers a sleep
var/priority = FIRE_PRIORITY_DEFAULT //When mutiple subsystems need to run in the same tick, higher priority subsystems will run first and be given a higher share of the tick before MC_TICK_CHECK triggers a sleep
var/flags = 0 //see MC.dm in __DEFINES Most flags must be set on world start to take full effect. (You can also restart the mc to force them to process again)
var/runlevels = RUNLEVELS_DEFAULT //points of the game at which the SS can fire
@@ -17,6 +17,7 @@
var/next_fire = 0 //scheduled world.time for next fire()
var/cost = 0 //average time to execute
var/tick_usage = 0 //average tick usage
var/tick_overrun = 0 //average tick overrun
var/state = SS_IDLE //tracks the current state of the ss, running, paused, etc.
var/paused_ticks = 0 //ticks this ss is taking to run right now.
var/paused_tick_usage //total tick_usage of all of our runs while pausing this run
@@ -167,7 +168,7 @@
if(can_fire && !(SS_NO_FIRE & flags))
msg = "[round(cost,1)]ms|[round(tick_usage,1)]%|[round(ticks,0.1)]\t[msg]"
msg = "[round(cost,1)]ms|[round(tick_usage,1)]%([round(tick_overrun,1)]%)|[round(ticks,0.1)]\t[msg]"
else
msg = "OFFLINE\t[msg]"
+7 -3
View File
@@ -9,7 +9,7 @@
SUBSYSTEM_DEF(air)
name = "Air"
init_order = INIT_ORDER_AIR
priority = 35
priority = FIRE_PRIORITY_AIR
wait = 2 SECONDS // seconds (We probably can speed this up actually)
flags = SS_BACKGROUND // TODO - Should this really be background? It might be important.
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
@@ -27,6 +27,9 @@ SUBSYSTEM_DEF(air)
// Updating zone tiles requires temporary storage location of self-zone-blocked turfs across resumes. Used only by process_tiles_to_update.
var/list/selfblock_deferred = null
// This is used to tell Travis WHERE the edges are.
var/list/startup_active_edge_log = list()
/datum/controller/subsystem/air/PreInit()
air_master = src
@@ -35,7 +38,7 @@ SUBSYSTEM_DEF(air)
current_cycle = 0
var/simulated_turf_count = 0
for(var/turf/simulated/S in world)
for(var/turf/simulated/S in turfs)
simulated_turf_count++
S.update_air_properties()
CHECK_TICK
@@ -56,8 +59,9 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
for(var/connection_edge/E in active_edges)
edge_log += "Active Edge [E] ([E.type])"
for(var/turf/T in E.connecting_turfs)
edge_log += "+--- Connecting Turf [T] @ [T.x], [T.y], [T.z]"
edge_log += "+--- Connecting Turf [T] ([T.type]) @ [T.x], [T.y], [T.z] ([T.loc])"
log_debug("Active Edges on ZAS Startup\n" + edge_log.Join("\n"))
startup_active_edge_log = edge_log.Copy()
..()
+1 -1
View File
@@ -14,7 +14,7 @@ SUBSYSTEM_DEF(airflow)
wait = 2
flags = SS_NO_INIT
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
priority = 30
priority = FIRE_PRIORITY_AIRFLOW
var/list/processing = list()
var/list/currentrun = list()
+1 -1
View File
@@ -46,7 +46,7 @@ SUBSYSTEM_DEF(atoms)
CHECK_TICK
else
count = 0
for(var/atom/A in world)
for(var/atom/A in world) // This must be world, since this operation adds all the atoms to their specific lists.
if(!A.initialized)
InitAtom(A, mapload_arg)
++count
+1 -1
View File
@@ -3,7 +3,7 @@
//
SUBSYSTEM_DEF(garbage)
name = "Garbage"
priority = 15
priority = FIRE_PRIORITY_GARBAGE
wait = 2 SECONDS
flags = SS_POST_FIRE_TIMING|SS_BACKGROUND|SS_NO_INIT
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
+5 -5
View File
@@ -12,7 +12,7 @@
SUBSYSTEM_DEF(machines)
name = "Machines"
priority = 100
priority = FIRE_PRIORITY_MACHINES
init_order = INIT_ORDER_MACHINES
flags = SS_KEEP_TIMING
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
@@ -90,10 +90,10 @@ SUBSYSTEM_DEF(machines)
msg += "PO:[round(cost_power_objects,1)]"
msg += "} "
msg += "PI:[global.pipe_networks.len]|"
msg += "MC:[global.machines.len]|"
msg += "MC:[global.processing_machines.len]|"
msg += "PN:[global.powernets.len]|"
msg += "PO:[global.processing_power_items.len]|"
msg += "MC/MS:[round((cost ? global.machines.len/cost_machinery : 0),0.1)]"
msg += "MC/MS:[round((cost ? global.processing_machines.len/cost_machinery : 0),0.1)]"
..(jointext(msg, null))
/datum/controller/subsystem/machines/proc/process_pipenets(resumed = 0)
@@ -115,7 +115,7 @@ SUBSYSTEM_DEF(machines)
/datum/controller/subsystem/machines/proc/process_machinery(resumed = 0)
if (!resumed)
src.current_run = global.machines.Copy()
src.current_run = global.processing_machines.Copy()
var/list/current_run = src.current_run
while(current_run.len)
@@ -125,7 +125,7 @@ SUBSYSTEM_DEF(machines)
if(M.use_power)
M.auto_use_power()
else
global.machines.Remove(M)
global.processing_machines.Remove(M)
if(!QDELETED(M))
M.is_processing = null
if(MC_TICK_CHECK)
+1 -1
View File
@@ -1,6 +1,6 @@
SUBSYSTEM_DEF(orbit)
name = "Orbits"
priority = 8 // FIRE_PRIORITY_ORBIT
priority = FIRE_PRIORITY_ORBIT
wait = 2
flags = SS_NO_INIT|SS_TICKER
+1 -1
View File
@@ -8,7 +8,7 @@ var/global/datum/controller/subsystem/shuttles/shuttle_controller
SUBSYSTEM_DEF(shuttles)
name = "Shuttles"
wait = 2 SECONDS
priority = 5
priority = FIRE_PRIORITY_SHUTTLES
init_order = INIT_ORDER_SHUTTLES
flags = SS_KEEP_TIMING|SS_NO_TICK_CHECK
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
+1 -1
View File
@@ -30,7 +30,7 @@ SUBSYSTEM_DEF(xenoarch)
. = ..()
/datum/controller/subsystem/xenoarch/proc/SetupXenoarch()
for(var/turf/simulated/mineral/M in world)
for(var/turf/simulated/mineral/M in turfs)
if(!M.density)
continue