Improve asteroid generation performance

This commit is contained in:
Lohikar
2017-03-04 15:45:01 -06:00
parent 76a891930e
commit 4aeab0d6ce
8 changed files with 172 additions and 80 deletions
+4 -6
View File
@@ -81,6 +81,7 @@ datum/controller/game_controller/proc/setup_objects()
admin_notice(span("danger", "Done."))
if(config.generate_asteroid)
var/time = world.time
// These values determine the specific area that the map is applied to.
// If you do not use the official Baycode moonbase map, you will need to change them.
//Create the mining Z-level.
@@ -92,12 +93,9 @@ datum/controller/game_controller/proc/setup_objects()
new /datum/random_map/noise/ore(null, 0, 0, 5, 64, 64)
new /datum/random_map/noise/ore(null, 0, 0, 4, 64, 64)
new /datum/random_map/noise/ore(null, 0, 0, 3, 64, 64)
// Update all turfs to ensure everything looks good post-generation. Yes,
// it's brute-forcey, but frankly the alternative is a mine turf rewrite.
for(var/turf/simulated/mineral/M in world) // Ugh.
M.updateMineralOverlays()
for(var/turf/simulated/floor/asteroid/M in world) // Uuuuuugh.
M.updateMineralOverlays()
var/msg = "Asteroid generation completed in [(world.time - time) / 10] seconds."
admin_notice(span("danger", msg))
game_log("ASGEN", msg)
admin_notice(span("danger", "Setting up lighting."))
initialize_lighting()