mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 13:05:36 +01:00
[MIRROR] Make spritesheets cacheable by default, killing a lot of overtime in the round start spike [MDB IGNORE] (#25820)
* Make spritesheets cacheable by default, killing a lot of overtime in the round start spike (#80522) ## About The Pull Request Makes all spritesheets cache by default. This wasn't the case originally because some spritesheets like vending machines relied on in world state, but none of them do anymore because that's whack. Also fixes a bug that would cause half completed caches to break other stuff. This didn't happen in real gameplay, but would've happened if you tried to change cachable on anything while you already had a tmp folder. ## Changelog 🆑 fix: Cut down a significant amount of time that caused the start of rounds to lag. /🆑 * Make spritesheets cacheable by default, killing a lot of overtime in the round start spike --------- Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
@@ -26,6 +26,7 @@ GLOBAL_LIST_EMPTY(asset_datums)
|
||||
/// Whether or not this asset can be cached across rounds of the same commit under the `CACHE_ASSETS` config.
|
||||
/// This is not a *guarantee* the asset will be cached. Not all asset subtypes respect this field, and the
|
||||
/// config can, of course, be disabled.
|
||||
/// Disable this if your asset can change between rounds on the same exact version of the code.
|
||||
var/cross_round_cachable = FALSE
|
||||
|
||||
/datum/asset/New()
|
||||
@@ -133,6 +134,7 @@ GLOBAL_LIST_EMPTY(asset_datums)
|
||||
|
||||
/datum/asset/spritesheet
|
||||
_abstract = /datum/asset/spritesheet
|
||||
cross_round_cachable = TRUE
|
||||
var/name
|
||||
/// List of arguments to pass into queuedInsert
|
||||
/// Exists so we can queue icon insertion, mostly for stuff like preferences
|
||||
@@ -145,6 +147,9 @@ GLOBAL_LIST_EMPTY(asset_datums)
|
||||
/// If this asset should be fully loaded on new
|
||||
/// Defaults to false so we can process this stuff nicely
|
||||
var/load_immediately = FALSE
|
||||
VAR_PRIVATE
|
||||
// Kept in state so that the result is the same, even when the files are created, for this run
|
||||
should_refresh = null
|
||||
|
||||
/datum/asset/spritesheet/proc/should_load_immediately()
|
||||
#ifdef DO_NOT_DEFER_ASSETS
|
||||
@@ -158,9 +163,6 @@ GLOBAL_LIST_EMPTY(asset_datums)
|
||||
if (..())
|
||||
return TRUE
|
||||
|
||||
// Static so that the result is the same, even when the files are created, for this run
|
||||
var/static/should_refresh = null
|
||||
|
||||
if (isnull(should_refresh))
|
||||
// `fexists` seems to always fail on static-time
|
||||
should_refresh = !fexists("[ASSET_CROSS_ROUND_CACHE_DIRECTORY]/spritesheet.[name].css")
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/datum/asset/spritesheet/emojipedia
|
||||
name = "emojipedia"
|
||||
cross_round_cachable = TRUE // The Emoji DMI is static and doesn't change without a commit mis-match.
|
||||
|
||||
/datum/asset/spritesheet/emojipedia/create_spritesheets()
|
||||
InsertAll("", EMOJI_SET)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user