Simpler lighting process, bug fixes, & modular computer tweaks (#1809)

Fixes #1806
Fixes #1730
Fixes #1747
Partially addresses #1763
Addresses #1283
Fixes #1799
Fixes #1816
Fixes #1813
This commit is contained in:
Lohikar
2017-02-24 12:24:31 -06:00
committed by skull132
parent a52092b294
commit 65e0f3de97
63 changed files with 270 additions and 146 deletions
-5
View File
@@ -127,11 +127,6 @@ world/loop_checks = 0
stat(null, "[garbage_collect ? "On" : "Off"], [destroyed.len] queued")
stat(null, "Dels: [total_dels], [soft_dels] soft, [hard_dels] hard, [tick_dels] last run")
// Tests if an atom has been deleted.
/proc/deleted(atom/A)
return !A || !isnull(A.gcDestroyed)
// Should be treated as a replacement for the 'del' keyword.
// Datums passed to this will be given a chance to clean up references to allow the GC to collect them.
/proc/qdel(var/datum/A)
+6 -29
View File
@@ -14,31 +14,23 @@
/datum/controller/process/lighting
schedule_interval = LIGHTING_INTERVAL
var/list/curr_lights = list()
var/list/curr_corners = list()
var/list/curr_overlays = list()
var/list/resume_pos = 0
/datum/controller/process/lighting/setup()
name = "lighting"
lighting_process = src
/datum/controller/process/lighting/statProcess()
..()
stat(null, "Server tick usage is [world.tick_usage].")
stat(null, "[all_lighting_overlays.len] overlays ([all_lighting_corners.len] corners)")
stat(null, "Lights: [lighting_update_lights.len] queued, [curr_lights.len] processing")
stat(null, "Corners: [lighting_update_corners.len] queued, [curr_corners.len] processing")
stat(null, "Overlays: [lighting_update_overlays.len] queued, [curr_overlays.len] processing")
stat(null, "Lights: [lighting_update_lights.len] queued")
stat(null, "Corners: [lighting_update_corners.len] queued")
stat(null, "Overlays: [lighting_update_overlays.len] queued")
/datum/controller/process/lighting/doWork()
// -- SOURCES --
if (resume_pos == STAGE_NONE)
curr_lights = lighting_update_lights
lighting_update_lights = list()
resume_pos = STAGE_SOURCE
var/list/curr_lights = lighting_update_lights
var/list/curr_corners = lighting_update_corners
var/list/curr_overlays = lighting_update_overlays
while (curr_lights.len)
var/datum/light_source/L = curr_lights[curr_lights.len]
@@ -58,13 +50,6 @@
F_SCHECK
// -- CORNERS --
if (resume_pos == STAGE_SOURCE)
curr_corners = lighting_update_corners
lighting_update_corners = list()
resume_pos = STAGE_CORNER
while (curr_corners.len)
var/datum/lighting_corner/C = curr_corners[curr_corners.len]
curr_corners.len--
@@ -75,12 +60,6 @@
F_SCHECK
if (resume_pos == STAGE_CORNER)
curr_overlays = lighting_update_overlays
lighting_update_overlays = list()
resume_pos = STAGE_OVERLAY
while (curr_overlays.len)
var/atom/movable/lighting_overlay/O = curr_overlays[curr_overlays.len]
curr_overlays.len--
@@ -90,8 +69,6 @@
F_SCHECK
resume_pos = 0
#undef STAGE_NONE
#undef STAGE_SOURCE
#undef STAGE_CORNER
+6 -6
View File
@@ -10,7 +10,7 @@ var/global/list/ticking_machines = list()
#define STAGE_PIPENET 5
/proc/add_machine(var/obj/machinery/M)
if (NULL_OR_GC(M))
if (QDELETED(M))
return
var/type = M.get_process_type()
@@ -52,7 +52,7 @@ var/global/list/ticking_machines = list()
var/obj/machinery/M = processing_machinery[processing_machinery.len]
processing_machinery.len--
if (NULL_OR_GC(M))
if (QDELETED(M))
remove_machine(M)
continue
@@ -73,7 +73,7 @@ var/global/list/ticking_machines = list()
var/obj/machinery/M = processing_power_users[processing_power_users.len]
processing_power_users.len--
if (NULL_OR_GC(M))
if (QDELETED(M))
remove_machine(M)
continue
@@ -90,7 +90,7 @@ var/global/list/ticking_machines = list()
var/datum/powernet/PN = processing_powernets[processing_powernets.len]
processing_powernets.len--
if (NULL_OR_GC(PN))
if (QDELETED(PN))
powernets -= PN
continue
@@ -105,7 +105,7 @@ var/global/list/ticking_machines = list()
var/obj/item/I = processing_powersinks[processing_powersinks.len]
processing_powersinks.len--
if (NULL_OR_GC(I) || !I.pwr_drain())
if (QDELETED(I) || !I.pwr_drain())
processing_power_items -= I
F_SCHECK
@@ -118,7 +118,7 @@ var/global/list/ticking_machines = list()
var/datum/pipe_network/PN = processing_pipenets[processing_pipenets.len]
processing_pipenets.len--
if (NULL_OR_GC(PN))
if (QDELETED(PN))
pipe_networks -= PN
continue
+4 -3
View File
@@ -23,13 +23,14 @@
var/datum/scheduled_task/task = queued_tasks[queued_tasks.len]
queued_tasks.len--
if (QDELETED(task))
scheduled_tasks -= task
continue
if (world.time > task.trigger_time)
unschedule(task)
// why are these separated.
task.pre_process()
F_SCHECK // fuck it, it's a cheap call.
task.process()
F_SCHECK
task.post_process()
F_SCHECK