mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Reworks the minimap cache system
If minimap generation is disabled, the system will now first try to load the map from its cache, and failing that, try to load it from backup minimap files Also adds a config for space ruin budgets
This commit is contained in:
@@ -184,6 +184,7 @@
|
|||||||
var/grey_assistants = 0
|
var/grey_assistants = 0
|
||||||
|
|
||||||
var/lavaland_budget = 60
|
var/lavaland_budget = 60
|
||||||
|
var/space_budget = 16
|
||||||
|
|
||||||
var/aggressive_changelog = 0
|
var/aggressive_changelog = 0
|
||||||
|
|
||||||
@@ -620,6 +621,8 @@
|
|||||||
config.grey_assistants = 1
|
config.grey_assistants = 1
|
||||||
if("lavaland_budget")
|
if("lavaland_budget")
|
||||||
config.lavaland_budget = text2num(value)
|
config.lavaland_budget = text2num(value)
|
||||||
|
if("space_budget")
|
||||||
|
config.space_budget = text2num(value)
|
||||||
if("no_summon_guns")
|
if("no_summon_guns")
|
||||||
config.no_summon_guns = 1
|
config.no_summon_guns = 1
|
||||||
if("no_summon_magic")
|
if("no_summon_magic")
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ var/datum/subsystem/mapping/SSmapping
|
|||||||
else
|
else
|
||||||
space_zlevels += i
|
space_zlevels += i
|
||||||
|
|
||||||
seedRuins(space_zlevels, rand(8,16), /area/space, space_ruins_templates)
|
seedRuins(space_zlevels, config.space_budget, /area/space, space_ruins_templates)
|
||||||
|
|
||||||
// Set up Z-level transistions.
|
// Set up Z-level transistions.
|
||||||
setup_map_transitions()
|
setup_map_transitions()
|
||||||
|
|||||||
@@ -13,25 +13,44 @@ var/datum/subsystem/minimap/SSminimap
|
|||||||
NEW_SS_GLOBAL(SSminimap)
|
NEW_SS_GLOBAL(SSminimap)
|
||||||
|
|
||||||
/datum/subsystem/minimap/Initialize(timeofday)
|
/datum/subsystem/minimap/Initialize(timeofday)
|
||||||
if(!config.generate_minimaps)
|
|
||||||
world << "Minimap generation disabled... Skipping"
|
|
||||||
return
|
|
||||||
var/hash = md5(file2text("_maps/[MAP_PATH]/[MAP_FILE]"))
|
var/hash = md5(file2text("_maps/[MAP_PATH]/[MAP_FILE]"))
|
||||||
if(hash == trim(file2text(hash_path())))
|
if(config.generate_minimaps)
|
||||||
return ..()
|
if(hash == trim(file2text(hash_path())))
|
||||||
|
world.log << "Hash check [hash]"
|
||||||
for(var/z in z_levels)
|
for(var/z in z_levels) //We have these files cached, let's register them
|
||||||
generate(z)
|
register_asset("minimap_[z].png", fcopy_rsc(map_path(z)))
|
||||||
register_asset("minimap_[z].png", fcopy_rsc(map_path(z)))
|
return ..()
|
||||||
fdel(hash_path())
|
for(var/z in z_levels)
|
||||||
text2file(hash, hash_path())
|
generate(z)
|
||||||
|
register_asset("minimap_[z].png", fcopy_rsc(map_path(z)))
|
||||||
|
fdel(hash_path())
|
||||||
|
text2file(hash, hash_path())
|
||||||
|
else
|
||||||
|
world << "Minimap generation disabled. Loading from cache..."
|
||||||
|
var/fileloc = 0
|
||||||
|
if(hash == trim(file2text(hash_path())))//Let's see if we have a map cached that we can use
|
||||||
|
fileloc = 0
|
||||||
|
else
|
||||||
|
for(var/z in z_levels)
|
||||||
|
if(!isfile(file(map_path(z,1)))) //Let's make sure we have a backup file for this map.
|
||||||
|
world << "Failed to load backup minimap file on zlevel [z]. Aborting" //We couldn't find something. Bail to prevent issues with null files
|
||||||
|
return
|
||||||
|
fileloc = 1 //No map image cached with the current map, and we have a backup. Let's fall back to it.
|
||||||
|
for(var/z in z_levels)
|
||||||
|
register_asset("minimap_[z].png", fcopy_rsc(map_path(z,fileloc)))
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/datum/subsystem/minimap/proc/hash_path()
|
/datum/subsystem/minimap/proc/hash_path(backup)
|
||||||
return "data/minimaps/[MAP_NAME].md5"
|
if(backup)
|
||||||
|
return "icons/minimaps/[MAP_NAME].md5"
|
||||||
|
else
|
||||||
|
return "data/minimaps/[MAP_NAME].md5"
|
||||||
|
|
||||||
/datum/subsystem/minimap/proc/map_path(z)
|
/datum/subsystem/minimap/proc/map_path(z,backup)
|
||||||
return "data/minimaps/[MAP_NAME]_[z].png"
|
if(backup)
|
||||||
|
return "icons/minimaps/[MAP_NAME]_[z].png"
|
||||||
|
else
|
||||||
|
return "data/minimaps/[MAP_NAME]_[z].png"
|
||||||
|
|
||||||
/datum/subsystem/minimap/proc/send(client/client)
|
/datum/subsystem/minimap/proc/send(client/client)
|
||||||
for(var/z in z_levels)
|
for(var/z in z_levels)
|
||||||
|
|||||||
@@ -355,3 +355,6 @@ BOMBCAP 20
|
|||||||
# spawn, while the converse is true. Alter this number to affect the amount
|
# spawn, while the converse is true. Alter this number to affect the amount
|
||||||
# of ruins.
|
# of ruins.
|
||||||
LAVALAND_BUDGET 60
|
LAVALAND_BUDGET 60
|
||||||
|
|
||||||
|
## Space Ruin Budged
|
||||||
|
Space_Budget 16
|
||||||
|
|||||||
BIN
icons/minimaps/BirdboatStation_1.png
Normal file
BIN
icons/minimaps/BirdboatStation_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 479 KiB |
BIN
icons/minimaps/Box Station_1.png
Normal file
BIN
icons/minimaps/Box Station_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 917 KiB |
BIN
icons/minimaps/DreamStation_1.png
Normal file
BIN
icons/minimaps/DreamStation_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 994 KiB |
BIN
icons/minimaps/Efficiency Station_1.png
Normal file
BIN
icons/minimaps/Efficiency Station_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 774 KiB |
BIN
icons/minimaps/MetaStation_1.png
Normal file
BIN
icons/minimaps/MetaStation_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
BIN
icons/minimaps/MiniStation_1.png
Normal file
BIN
icons/minimaps/MiniStation_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 294 KiB |
Reference in New Issue
Block a user