mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
BAY LIGHTING PEOPLE
This commit is contained in:
26
code/controllers/Processes/lighting (OLD).dm
Normal file
26
code/controllers/Processes/lighting (OLD).dm
Normal file
@@ -0,0 +1,26 @@
|
||||
/datum/controller/process/lighting/setup()
|
||||
name = "lighting"
|
||||
schedule_interval = 5 // every .5 second
|
||||
lighting_controller.Initialize()
|
||||
|
||||
/datum/controller/process/lighting/doWork()
|
||||
lighting_controller.lights_workload_max = \
|
||||
max(lighting_controller.lights_workload_max, lighting_controller.lights.len)
|
||||
|
||||
for(var/datum/light_source/L in lighting_controller.lights)
|
||||
if(L && L.check())
|
||||
lighting_controller.lights.Remove(L)
|
||||
|
||||
scheck()
|
||||
|
||||
lighting_controller.changed_turfs_workload_max = \
|
||||
max(lighting_controller.changed_turfs_workload_max, lighting_controller.changed_turfs.len)
|
||||
|
||||
for(var/turf/T in lighting_controller.changed_turfs)
|
||||
if(T && T.lighting_changed)
|
||||
T.shift_to_subarea()
|
||||
|
||||
scheck()
|
||||
|
||||
if(lighting_controller.changed_turfs && lighting_controller.changed_turfs.len)
|
||||
lighting_controller.changed_turfs.len = 0 // reset the changed list
|
||||
@@ -1,28 +1,29 @@
|
||||
/datum/controller/process/lighting
|
||||
schedule_interval = 5 // every .5 second
|
||||
|
||||
/datum/controller/process/lighting/setup()
|
||||
name = "lighting"
|
||||
lighting_controller.Initialize()
|
||||
schedule_interval = LIGHTING_INTERVAL
|
||||
|
||||
create_lighting_overlays()
|
||||
|
||||
/datum/controller/process/lighting/doWork()
|
||||
lighting_controller.lights_workload_max = \
|
||||
max(lighting_controller.lights_workload_max, lighting_controller.lights.len)
|
||||
|
||||
for(var/datum/light_source/L in lighting_controller.lights)
|
||||
if(L && L.check())
|
||||
lighting_controller.lights.Remove(L)
|
||||
for(var/datum/light_source/L in lighting_update_lights)
|
||||
if(L.needs_update)
|
||||
if(L.destroyed)
|
||||
L.remove_lum()
|
||||
else if(L.check() || L.force_update)
|
||||
L.remove_lum()
|
||||
L.apply_lum()
|
||||
L.force_update = 0
|
||||
L.needs_update = 0
|
||||
|
||||
scheck()
|
||||
|
||||
lighting_controller.changed_turfs_workload_max = \
|
||||
max(lighting_controller.changed_turfs_workload_max, lighting_controller.changed_turfs.len)
|
||||
lighting_update_lights.Cut()
|
||||
|
||||
for(var/turf/T in lighting_controller.changed_turfs)
|
||||
if(T && T.lighting_changed)
|
||||
T.shift_to_subarea()
|
||||
for(var/atom/movable/lighting_overlay/O in lighting_update_overlays)
|
||||
if(O.needs_update)
|
||||
O.update_overlay()
|
||||
O.needs_update = 0
|
||||
|
||||
scheck()
|
||||
|
||||
if(lighting_controller.changed_turfs && lighting_controller.changed_turfs.len)
|
||||
lighting_controller.changed_turfs.len = 0 // reset the changed list
|
||||
lighting_update_overlays.Cut()
|
||||
|
||||
@@ -58,21 +58,4 @@ var/global/datum/controller/failsafe/failsafe
|
||||
masterControllerAlertLevel = 0
|
||||
masterControllerIteration = master_controller.iteration
|
||||
|
||||
if(lighting_controller.processing)
|
||||
if(lightingControllerIteration == lighting_controller.iteration) // Lighting controller hasn't finished processing in the defined interval.
|
||||
switch(lightingControllerAlertLevel)
|
||||
if(0 to 3)
|
||||
lightingControllerAlertLevel++
|
||||
if(4)
|
||||
admins << "<font color='red' size='2'><b>Warning. The lighting_controller controller has not fired in the last [lightingControllerAlertLevel * processing_interval] ticks. Automatic restart in [processing_interval] ticks.</b></font>"
|
||||
lightingControllerAlertLevel = 5
|
||||
if(5)
|
||||
admins << "<font color='red' size='2'><b>Warning. The lighting_controller controller has still not fired within the last [lightingControllerAlertLevel * processing_interval] ticks. Killing and restarting...</b></font>"
|
||||
new /datum/controller/lighting() // Replace the old lighting_controller (hence killing the old one's process).
|
||||
lighting_controller.process() // Start it rolling again.
|
||||
lightingControllerAlertLevel = 0
|
||||
else
|
||||
lightingControllerAlertLevel = 0
|
||||
lightingControllerIteration = lighting_controller.iteration
|
||||
|
||||
sleep(processing_interval)
|
||||
|
||||
@@ -49,7 +49,7 @@ datum/shuttle_controller/proc/incall(coeff = 1)
|
||||
//turning on the red lights in hallways
|
||||
if(alert == 0)
|
||||
for(var/area/A in areas)
|
||||
if(istype(A, /area/hallway) && !A.lighting_subarea)
|
||||
if(istype(A, /area/hallway))
|
||||
A.readyalert()
|
||||
|
||||
datum/shuttle_controller/proc/shuttlealert(var/X)
|
||||
@@ -76,7 +76,7 @@ datum/shuttle_controller/proc/recall()
|
||||
setdirection(-1)
|
||||
online = 1
|
||||
for(var/area/A in areas)
|
||||
if(istype(A, /area/hallway) && !A.lighting_subarea)
|
||||
if(istype(A, /area/hallway))
|
||||
A.readyreset()
|
||||
return
|
||||
else //makes it possible to send shuttle back.
|
||||
@@ -232,6 +232,8 @@ datum/shuttle_controller/emergency_shuttle/process()
|
||||
var/turf/D = locate(T.x, throwy - 1, 1)
|
||||
//var/turf/E = get_step(D, SOUTH)
|
||||
for(var/atom/A as mob|obj in T)
|
||||
if(istype(A, /atom/movable/lighting_overlay)) //This'd be a whole nother level of dumb
|
||||
continue
|
||||
if(ismob(A))
|
||||
var/mob/M=A
|
||||
M.gib()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//TODO: rewrite and standardise all controller datums to the datum/controller type
|
||||
//TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) - MC done - lighting done
|
||||
|
||||
/client/proc/restart_controller(controller in list("Master","Failsafe","Lighting","Supply Shuttle"))
|
||||
/client/proc/restart_controller(controller in list("Master","Failsafe","Supply Shuttle"))
|
||||
set category = "Debug"
|
||||
set name = "Restart Controller"
|
||||
set desc = "Restart one of the various periodic loop controllers for the game (be careful!)"
|
||||
@@ -17,10 +17,6 @@
|
||||
if("Failsafe")
|
||||
new /datum/controller/failsafe()
|
||||
feedback_add_details("admin_verb","RFailsafe")
|
||||
if("Lighting")
|
||||
new /datum/controller/lighting()
|
||||
lighting_controller.process()
|
||||
feedback_add_details("admin_verb","RLighting")
|
||||
if("Supply Shuttle")
|
||||
supply_shuttle.process()
|
||||
feedback_add_details("admin_verb","RSupply")
|
||||
@@ -28,7 +24,7 @@
|
||||
return
|
||||
|
||||
|
||||
/client/proc/debug_controller(controller in list("Air", "Cameras", "Configuration", "Emergency Shuttle", "failsafe", "Garbage", "Jobs", "lighting", "master", "pAI", "Radio", "Scheduler", "Sun", "Supply Shuttle", "Ticker"))
|
||||
/client/proc/debug_controller(controller in list("Air", "Cameras", "Configuration", "Emergency Shuttle", "failsafe", "Garbage", "Jobs", "master", "pAI", "Radio", "Scheduler", "Sun", "Supply Shuttle", "Ticker"))
|
||||
set category = "Debug"
|
||||
set name = "debug controller"
|
||||
set desc = "debug the various periodic loop controllers for the game (be careful!)."
|
||||
@@ -46,9 +42,6 @@
|
||||
if("Ticker")
|
||||
debug_variables(ticker)
|
||||
feedback_add_details("admin_verb","DTicker")
|
||||
if ("lighting")
|
||||
debug_variables(lighting_controller)
|
||||
feedback_add_details("admin_verb", "dlighting")
|
||||
if("Air")
|
||||
debug_variables(air_master)
|
||||
feedback_add_details("admin_verb","DAir")
|
||||
|
||||
Reference in New Issue
Block a user