mirror of
https://github.com/Yawn-Wider/YWPolarisVore.git
synced 2026-08-28 15:40:25 +01:00
Merge branch 'release' of https://github.com/VOREStation/VOREStation into voreupdate
This commit is contained in:
@@ -1,3 +1,44 @@
|
||||
/// Assets generated from `/datum/preference` icons
|
||||
/datum/asset/spritesheet/preferences
|
||||
name = "preferences"
|
||||
early = TRUE
|
||||
|
||||
/datum/asset/spritesheet/preferences/create_spritesheets()
|
||||
var/list/to_insert = list()
|
||||
|
||||
for(var/preference_key in GLOB.preference_entries_by_key)
|
||||
var/datum/preference/choiced/preference = GLOB.preference_entries_by_key[preference_key]
|
||||
if(!istype(preference))
|
||||
continue
|
||||
|
||||
if(!preference.should_generate_icons)
|
||||
continue
|
||||
|
||||
for(var/preference_value in preference.get_choices())
|
||||
var/create_icon_of = preference.icon_for(preference_value)
|
||||
|
||||
var/icon/icon
|
||||
var/icon_state
|
||||
|
||||
if(ispath(create_icon_of, /atom))
|
||||
var/atom/atom_icon_source = create_icon_of
|
||||
icon = initial(atom_icon_source.icon)
|
||||
icon_state = initial(atom_icon_source.icon_state)
|
||||
else if(isicon(create_icon_of))
|
||||
icon = create_icon_of
|
||||
else
|
||||
CRASH("[create_icon_of] is an invalid preference value (from [preference_key]:[preference_value]).")
|
||||
|
||||
to_insert[preference.get_spritesheet_key(preference.pref_serialize(preference_value))] = list(icon, icon_state)
|
||||
|
||||
for(var/spritesheet_key in to_insert)
|
||||
var/list/inserting = to_insert[spritesheet_key]
|
||||
Insert(spritesheet_key, inserting[1], inserting[2])
|
||||
|
||||
/// Returns the key that will be used in the spritesheet for a given value.
|
||||
/datum/preference/proc/get_spritesheet_key(value)
|
||||
return "[savefile_key]___[sanitize_css_class_name(value)]"
|
||||
|
||||
/// Sends information needed for shared details on individual preferences
|
||||
/datum/asset/json/preferences
|
||||
name = "preferences"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/datum/asset/spritesheet/chat
|
||||
/datum/asset/spritesheet_batched/chat
|
||||
name = "chat"
|
||||
|
||||
/datum/asset/spritesheet/chat/create_spritesheets()
|
||||
InsertAll("", text_tag_icons) // OOC, LOOC ect icons
|
||||
/datum/asset/spritesheet_batched/chat/create_spritesheets()
|
||||
insert_all_icons("", text_tag_icons, prefix_with_dirs = FALSE) // OOC, LOOC ect icons
|
||||
|
||||
@@ -1,36 +1,52 @@
|
||||
/datum/asset/spritesheet/robot_icons
|
||||
/datum/asset/spritesheet_batched/robot_icons
|
||||
name = "robot_icons"
|
||||
|
||||
/datum/asset/spritesheet/robot_icons/create_spritesheets()
|
||||
/datum/asset/spritesheet_batched/robot_icons/create_spritesheets()
|
||||
for(var/datum/robot_sprite/S as anything in typesof(/datum/robot_sprite))
|
||||
if(!S.name || !S.sprite_icon_state) // snowflake out those customs... they suck
|
||||
continue
|
||||
var/icon/I_N = icon(S.sprite_icon, S.sprite_icon_state, NORTH)
|
||||
var/icon/I_S = icon(S.sprite_icon, S.sprite_icon_state, SOUTH)
|
||||
var/icon/I_W = icon(S.sprite_icon, S.sprite_icon_state, WEST)
|
||||
var/icon/I_E = icon(S.sprite_icon, S.sprite_icon_state, EAST)
|
||||
|
||||
var/datum/universal_icon/I_N = uni_icon(S.sprite_icon, S.sprite_icon_state, NORTH)
|
||||
var/datum/universal_icon/I_S = uni_icon(S.sprite_icon, S.sprite_icon_state, SOUTH)
|
||||
var/datum/universal_icon/I_W = uni_icon(S.sprite_icon, S.sprite_icon_state, WEST)
|
||||
var/datum/universal_icon/I_E = uni_icon(S.sprite_icon, S.sprite_icon_state, EAST)
|
||||
|
||||
if(S.has_eye_sprites)
|
||||
var/icon/I_NE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", NORTH)
|
||||
var/datum/universal_icon/I_NE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", NORTH)
|
||||
if(I_NE)
|
||||
I_N.Blend(I_NE, ICON_OVERLAY)
|
||||
I_N.blend_icon(I_NE, ICON_OVERLAY)
|
||||
if(S.has_eye_sprites)
|
||||
var/icon/I_SE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", SOUTH)
|
||||
var/datum/universal_icon/I_SE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", SOUTH)
|
||||
if(I_SE)
|
||||
I_S.Blend(I_SE, ICON_OVERLAY)
|
||||
I_S.blend_icon(I_SE, ICON_OVERLAY)
|
||||
if(S.has_eye_sprites)
|
||||
var/icon/I_WE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", WEST)
|
||||
var/datum/universal_icon/I_WE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", WEST)
|
||||
if(I_WE)
|
||||
I_W.Blend(I_WE, ICON_OVERLAY)
|
||||
I_W.blend_icon(I_WE, ICON_OVERLAY)
|
||||
if(S.has_eye_sprites)
|
||||
var/icon/I_EE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", EAST)
|
||||
var/datum/universal_icon/I_EE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", EAST)
|
||||
if(I_EE)
|
||||
I_E.Blend(I_EE, ICON_OVERLAY)
|
||||
I_E.blend_icon(I_EE, ICON_OVERLAY)
|
||||
|
||||
var/imgid = sanitize_css_class_name("[S.type]")
|
||||
I_N.Scale(120, 120)
|
||||
I_S.Scale(120, 120)
|
||||
I_W.Scale(120, 120)
|
||||
I_E.Scale(120, 120)
|
||||
Insert(imgid + "N", I_N)
|
||||
Insert(imgid + "S", I_S)
|
||||
Insert(imgid + "W", I_W)
|
||||
Insert(imgid + "E", I_E)
|
||||
if(S.icon_x > S.icon_y)
|
||||
var/buffer = (S.icon_x - S.icon_y) / 2
|
||||
I_N.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||
I_S.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||
I_W.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||
I_E.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||
else if (S.icon_x < S.icon_y)
|
||||
var/buffer = (S.icon_y - S.icon_x) / 2
|
||||
I_N.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||
I_S.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||
I_W.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||
I_E.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||
I_N.scale(120, 120)
|
||||
I_S.scale(120, 120)
|
||||
I_W.scale(120, 120)
|
||||
I_E.scale(120, 120)
|
||||
|
||||
insert_icon(imgid + "N", I_N)
|
||||
insert_icon(imgid + "S", I_S)
|
||||
insert_icon(imgid + "W", I_W)
|
||||
insert_icon(imgid + "E", I_E)
|
||||
|
||||
@@ -180,6 +180,10 @@
|
||||
// Remove the cache, since it's invalid if we get to this point.
|
||||
fdel("[ASSET_CROSS_ROUND_SMART_CACHE_DIRECTORY]/spritesheet_cache.[name].json")
|
||||
|
||||
if(!fexists(ASSET_CROSS_ROUND_SMART_CACHE_DIRECTORY))
|
||||
rustg_file_write("stub", "[ASSET_CROSS_ROUND_SMART_CACHE_DIRECTORY]/stub.txt")
|
||||
fdel("[ASSET_CROSS_ROUND_SMART_CACHE_DIRECTORY]/stub.txt")
|
||||
|
||||
var/do_cache = CONFIG_GET(flag/smart_cache_assets) || force_cache
|
||||
var/data_out
|
||||
if(yield || !isnull(job_id))
|
||||
|
||||
Reference in New Issue
Block a user