Improve Object Initialization (#1368)

Okay. You can read the entire theory over in this issue: #1365

But basically. All objects to be initialized are now added to a list in their New() proc on world/New(). This is substantially smaller than the entire world. This allows game_controller/setup_objects() to crawl a much larger list, and speeds it up by 6 seconds (from 9.5 to 3.5 seconds). The impact on world/New() is, on average, under 1 second.

Also fixes #1365 and #1363 as a result of reworking the initialization call logic in atoms_movable.dm. initialize() is now more secure, and can handle recursive calls at any point in time.
This commit is contained in:
skull132
2017-01-02 00:45:36 +02:00
committed by GitHub
parent a79808984e
commit 44f22c2128
4 changed files with 21 additions and 6 deletions
+7 -2
View File
@@ -46,13 +46,18 @@ datum/controller/game_controller/proc/setup()
datum/controller/game_controller/proc/setup_objects()
admin_notice("<span class='danger'>Initializing objects</span>", R_DEBUG)
sleep(-1)
for(var/atom/movable/object in world)
objects_initialized = 1
for(var/A in objects_init_list)
var/atom/movable/object = A
if(isnull(object.gcDestroyed))
object.initialize()
objects_init_list.Cut()
admin_notice("<span class='danger'>Initializing areas</span>", R_DEBUG)
sleep(-1)
for(var/area/area in all_areas)
for(var/A in all_areas)
var/area/area = A
area.initialize()
admin_notice("<span class='danger'>Initializing pipe networks</span>", R_DEBUG)