mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-30 12:03:11 +00:00
Reworks on-mob overlay icon generation. (#8920)
* Porting species equip_adjust from Neb. * get_species() => get_species_name(), adds correct get_species() impl * sprite_sheets is now crudely lazylisted. * Adds returns to add_blood and add_accessories. * apply_addblends now uses an overlay. * Renames the various worn overlay procs to be more informative. * Debugging/refining overlay gen. * Adding handling for string icon paths. * Refining/debugging offset overlay gen. * Getting the offset system working. * Commenting out Teshari offsets for the time being.
This commit is contained in:
@@ -1033,3 +1033,21 @@ GLOBAL_LIST_EMPTY(cached_examine_icons)
|
||||
|
||||
//Animate it growing
|
||||
animate(img, alpha = 0, transform = matrix()*grow_to, time = anim_duration, loop = loops)
|
||||
|
||||
// For checking if we have a specific state, for inventory icons and nonhumanoid species.
|
||||
// Cached cause asking icons is expensive. This is still expensive, so avoid using it if
|
||||
// you can reasonably expect the icon_state to exist beforehand, or if you can cache the
|
||||
// value somewhere.
|
||||
var/global/list/_icon_state_cache = list()
|
||||
/proc/check_state_in_icon(var/checkstate, var/checkicon, var/high_accuracy = FALSE)
|
||||
// isicon() is apparently quite expensive so short-circuit out early if we can.
|
||||
if(!istext(checkstate) || isnull(checkicon) || !(isfile(checkicon) || isicon(checkicon)))
|
||||
return FALSE
|
||||
var/checkkey = "\ref[checkicon]"
|
||||
var/list/check = global._icon_state_cache[checkkey]
|
||||
if(!check)
|
||||
check = list()
|
||||
for(var/istate in icon_states(checkicon))
|
||||
check[istate] = TRUE
|
||||
global._icon_state_cache[checkkey] = check
|
||||
. = check[checkstate]
|
||||
|
||||
Reference in New Issue
Block a user