mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Merge pull request #26324 from Cyberboss/MC_SPLIT_TICK
Adds defines for evenly splitting up a subsystem's time to fire
This commit is contained in:
@@ -1,4 +1,14 @@
|
|||||||
#define MC_TICK_CHECK ( ( world.tick_usage > GLOB.CURRENT_TICKLIMIT || src.state != SS_RUNNING ) ? pause() : 0 )
|
#define MC_TICK_CHECK ( ( world.tick_usage > GLOB.CURRENT_TICKLIMIT || src.state != SS_RUNNING ) ? pause() : 0 )
|
||||||
|
|
||||||
|
#define MC_SPLIT_TICK_INIT(phase_count) var/original_tick_limit = GLOB.CURRENT_TICKLIMIT; var/split_tick_phases = ##phase_count
|
||||||
|
#define MC_SPLIT_TICK \
|
||||||
|
if(split_tick_phases > 1){\
|
||||||
|
GLOB.CURRENT_TICKLIMIT = ((original_tick_limit - world.tick_usage) / split_tick_phases) + world.tick_usage;\
|
||||||
|
--split_tick_phases;\
|
||||||
|
} else {\
|
||||||
|
GLOB.CURRENT_TICKLIMIT = original_tick_limit;\
|
||||||
|
}
|
||||||
|
|
||||||
// Used to smooth out costs to try and avoid oscillation.
|
// Used to smooth out costs to try and avoid oscillation.
|
||||||
#define MC_AVERAGE_FAST(average, current) (0.7 * (average) + 0.3 * (current))
|
#define MC_AVERAGE_FAST(average, current) (0.7 * (average) + 0.3 * (current))
|
||||||
#define MC_AVERAGE(average, current) (0.8 * (average) + 0.2 * (current))
|
#define MC_AVERAGE(average, current) (0.8 * (average) + 0.2 * (current))
|
||||||
|
|||||||
@@ -29,10 +29,9 @@ SUBSYSTEM_DEF(lighting)
|
|||||||
..()
|
..()
|
||||||
|
|
||||||
/datum/controller/subsystem/lighting/fire(resumed, init_tick_checks)
|
/datum/controller/subsystem/lighting/fire(resumed, init_tick_checks)
|
||||||
var/real_tick_limit
|
MC_SPLIT_TICK_INIT(3)
|
||||||
if(!init_tick_checks)
|
if(!init_tick_checks)
|
||||||
real_tick_limit = GLOB.CURRENT_TICKLIMIT
|
MC_SPLIT_TICK
|
||||||
GLOB.CURRENT_TICKLIMIT = ((real_tick_limit - world.tick_usage) / 3) + world.tick_usage
|
|
||||||
var/i = 0
|
var/i = 0
|
||||||
for (i in 1 to GLOB.lighting_update_lights.len)
|
for (i in 1 to GLOB.lighting_update_lights.len)
|
||||||
var/datum/light_source/L = GLOB.lighting_update_lights[i]
|
var/datum/light_source/L = GLOB.lighting_update_lights[i]
|
||||||
@@ -58,7 +57,7 @@ SUBSYSTEM_DEF(lighting)
|
|||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
if(!init_tick_checks)
|
if(!init_tick_checks)
|
||||||
GLOB.CURRENT_TICKLIMIT = ((real_tick_limit - world.tick_usage)/2)+world.tick_usage
|
MC_SPLIT_TICK
|
||||||
|
|
||||||
for (i in 1 to GLOB.lighting_update_corners.len)
|
for (i in 1 to GLOB.lighting_update_corners.len)
|
||||||
var/datum/lighting_corner/C = GLOB.lighting_update_corners[i]
|
var/datum/lighting_corner/C = GLOB.lighting_update_corners[i]
|
||||||
@@ -75,7 +74,7 @@ SUBSYSTEM_DEF(lighting)
|
|||||||
|
|
||||||
|
|
||||||
if(!init_tick_checks)
|
if(!init_tick_checks)
|
||||||
GLOB.CURRENT_TICKLIMIT = real_tick_limit
|
MC_SPLIT_TICK
|
||||||
|
|
||||||
for (i in 1 to GLOB.lighting_update_objects.len)
|
for (i in 1 to GLOB.lighting_update_objects.len)
|
||||||
var/atom/movable/lighting_object/O = GLOB.lighting_update_objects[i]
|
var/atom/movable/lighting_object/O = GLOB.lighting_update_objects[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user