Asset Cache speed (tgstation/tgstation#35003 + more)

This commit is contained in:
tigercat2000
2018-11-15 12:18:00 -08:00
parent 693eae879a
commit 9fb54c4c82
5 changed files with 42 additions and 41 deletions

View File

@@ -55,17 +55,10 @@ var/global/pipe_processing_killed = 0
space_manager.do_transition_setup()
setup_asset_cache()
setupfactions()
setup_economy()
for(var/i=0, i<max_secret_rooms, i++)
make_mining_asteroid_secret()
populate_spawn_points()
/datum/controller/game_controller/proc/setup_asset_cache()
var/watch = start_watch()
log_startup_progress("Populating asset cache...")
populate_asset_cache()
log_startup_progress(" Populated [asset_cache.len] assets in [stop_watch(watch)]s.")
populate_spawn_points()

View File

@@ -0,0 +1,17 @@
SUBSYSTEM_DEF(assets)
name = "Assets"
init_order = INIT_ORDER_ASSETS
flags = SS_NO_FIRE
var/list/cache = list()
var/list/preload = list()
/datum/controller/subsystem/assets/Initialize(timeofday)
for(var/type in typesof(/datum/asset) - list(/datum/asset, /datum/asset/simple))
var/datum/asset/A = new type()
A.register()
preload = cache.Copy() //don't preload assets generated during the round
for(var/client/C in GLOB.clients)
addtimer(CALLBACK(GLOBAL_PROC, .proc/getFilesSlow, C, preload, FALSE), 10)
..()