IconForge: rust-g Spritesheet Generation (#89478)

Replaces the asset subsystem's spritesheet generator with a rust-based
implementation (https://github.com/tgstation/rust-g/pull/160).

This is a rough port of
https://github.com/BeeStation/BeeStation-Hornet/pull/10404, but it
includes fixes for some cases I didn't catch that apply on TG.

(FWIW we've been using this system on prod for over a year and
encountered no major issues.)

![image](https://github.com/user-attachments/assets/53bd2b44-9bb5-42d2-b33f-093651edebc0)

`/datum/asset/spritesheet_batched`: A version of the spritesheet system
that collects a list of `/datum/universal_icon`s and sends them off to
rustg asynchronously, and the generation also runs on another thread, so
the game doesn't block during realize_spritesheet. The rust generation
is about 10x faster when it comes to actual icon generation, but the
biggest perk of the batched spritesheets is the caching system.

This PR notably does not convert a few things to the new spritesheet
generator.

- Species and antagonist icons in the preferences view because they use
getFlatIcon ~~which can't be converted to universal icons~~.
- Yes, this is still a *massive* cost to init, unfortunately. On Bee, I
actually enabled the 'legacy' cache on prod and development, which you
can see in my PR. That's why I added the 'clear cache' verb and the
`unregister()` procs, because it can force a regeneration at runtime. I
decided not to port this, since I think it would be detrimental to the
large amount of contributors here.
- It is *technically* possible to port parts of this to the uni_icon
system by making a uni_icon version of getFlatIcon. However, some
overlays use runtime-generated icons which are ~~completely unparseable
to IconForge, since they're stored in the RSC and don't exist as files
anywhere~~. This is most noticeable with things like hair (which blend
additively with the hair mask on the server, thus making them invisible
to `get_flat_uni_icon`). It also doesn't help that species and antag
icons will still need to generate a bunch of dummies and delete them to
even verify cache validity.
- It is actually possible to write the RSC icons to the filesystem
(using fcopy) and reference them in IconForge. However, I'm going to
wait on doing this until I port my GAGS implementation because it
requires GAGS to exist on the filesystem as well.

IconForge generates a cache based on the set of icons used, all
transform operations applied, and the source DMIs of each icon used
within the spritesheet. It can compare the hashes and invalidate the
cache automatically if any of these change. This means we can enable
caching on development, and have absolutely no downsides, because if
anything changes, the cache invalidates itself.

The caching has a mean cost of ~5ms and saves a lot of time compared to
generating the spritesheet, even with rust's faster generation. The main
downside is that the cache still requires building the list of icons and
their transforms, then json encoding it to send to rustg.

Here's an abbreviated example of a cache JSON. All of these need to
match for the cache to be valid. `input_hash` contains the transform
definitions for all the sprites in the spritesheet, so if the input to
iconforge changes, that hash catches it. The `sizes` and `sprites` are
loaded into DM.

```json
{
	"input_hash": "99f1bc67d590e000",
	"dmi_hashes": {
		"icons/ui/achievements/achievements.dmi": "771200c75da11c62"
	},
	"sizes": [
		"76x76"
	],
	"sprites": {
		"achievement-rustascend": {
			"size_id": "76x76",
			"position": 1
		}
	},
	"rustg_version": "3.6.0",
	"dm_version": 1
}
```

Universal icons are just a collection of DMI, Icon State, and any icon
transformation procs you apply (blends, crops, scales). They can be
convered to DM icons via `to_icon()`. I've included an implementation of
GAGS that produces universal icons, allowing GAGS items to be converted
into them. IconForge can read universal icons and add them to
spritesheets. It's basically just a wrapper that reimplements BYOND icon
procs.

Converts some uses of md5asfile within legacy spritesheets to use
rustg_hash_file instead, improving the performance of their generation.

Fixes lizard body markings not showing in previews, and re-adds eyes to
the ethereal color preview. This is a side effect of IconForge having
*much* better error handling than DM icon procs. Invalid stuff that gets
passed around will error instead of silently doing nothing.

Changes the CSS used in legacy spritesheet generation to split
`background: url(...) no-repeat` into separate props. This is necessary
for WebView2, as IE treats these properties differently - adding
`background-color` to an icon object (as seen in the R&D console) won't
work if you don't split these out.

Deletes unused spritesheets and their associated icons (condiments
spritesheet, old PDA spritesheet)

If you press "Character Setup", the 10-13sec of lag is now approximately
0.5-2 seconds.

Tracy profile showing the time spent on get_asset_datum. I pressed the
preferences button during init on both branches. Do note that this was
ran with a smart cache HIT, so no generation occurred.

![image](https://github.com/user-attachments/assets/3efa71ab-972b-4f5a-acab-0892496ef999)

Much lower worst-case for /datum/asset/New (which includes
`create_spritesheets()` and `register()`)

![image](https://github.com/user-attachments/assets/9ad8ceee-7bd6-4c48-b5f3-006520f527ef)

Here's a look at the internal costs from rustg - as you can see
`generate_spritesheet()` is very fast:

![image](https://github.com/user-attachments/assets/e6892c28-8c31-4af5-96d4-501e966d0ce9)

**Before**

![image](https://github.com/user-attachments/assets/cbd65787-42ba-4278-a45c-bd3d538da986)

**After**

![image](https://github.com/user-attachments/assets/d750899a-bd07-4b57-80fb-420fcc0ae416)

🆑
fix: Fixed lizard body markings and ethereal feature previews in the
preference menu missing some overlays.
refactor: Optimized spritesheet asset generation greatly using rustg
IconForge, greatly reducing post-initialization lag as well as reducing
init times and saving server computation.
config: Added 'smart' asset caching, for batched rustg IconForge
spritesheets. It is persistent and suitable for use on local, with
automatic invalidation.
add: Added admin verbs - Debug -> Clear Smart/Legacy Asset Cache for
spritesheets.
fix: Fixed R&D console icons breaking on WebView2/516
/🆑
This commit is contained in:
itsmeow
2025-03-12 17:10:20 -04:00
committed by Roxy
parent cb85d64c2f
commit 9ebcabb077
163 changed files with 1828 additions and 870 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
/datum/preferences/ui_assets(mob/user)
var/list/assets = list(
get_asset_datum(/datum/asset/spritesheet/preferences),
get_asset_datum(/datum/asset/spritesheet_batched/preferences),
get_asset_datum(/datum/asset/json/preferences),
)
+3 -3
View File
@@ -142,11 +142,11 @@ Choiced preferences can generate icons. This is how the clothing/species prefere
/datum/preference/choiced/favorite_drink/icon_for(value)
switch (value)
if ("Milk")
return icon('drinks.dmi', "milk")
return uni_icon('drinks.dmi', "milk")
if ("Cola")
return icon('drinks.dmi', "cola")
return uni_icon('drinks.dmi', "cola")
if ("Water")
return icon('drinks.dmi', "water")
return uni_icon('drinks.dmi', "water")
```
Then, change your `.tsx` file to look like:
@@ -406,7 +406,7 @@ GLOBAL_LIST_INIT(preference_entries_by_key, init_preference_entries_by_key())
CRASH("`init_possible_values()` was not implemented for [type]!")
/// When `should_generate_icons` is TRUE, this proc is called for every value.
/// It can return either an icon or a typepath to an atom to create.
/// It can return either an /datum/universal_icon (see uni_icon() DEFINE) or a typepath to an atom to create.
/datum/preference/choiced/proc/icon_for(value)
SHOULD_CALL_PARENT(FALSE)
SHOULD_NOT_SLEEP(TRUE)
@@ -10,9 +10,9 @@
/datum/preference/choiced/ai_core_display/icon_for(value)
if (value == "Random")
return icon('icons/mob/silicon/ai.dmi', "questionmark")
return uni_icon('icons/mob/silicon/ai.dmi', "questionmark")
else
return icon('icons/mob/silicon/ai.dmi', resolve_ai_icon_sync(value))
return uni_icon('icons/mob/silicon/ai.dmi', resolve_ai_icon_sync(value))
/datum/preference/choiced/ai_core_display/is_accessible(datum/preferences/preferences)
if (!..(preferences))
@@ -10,9 +10,9 @@
/datum/preference/choiced/ai_emote_display/icon_for(value)
if (value == "Random")
return icon('icons/mob/silicon/ai.dmi', "questionmark")
return uni_icon('icons/mob/silicon/ai.dmi', "questionmark")
else
return icon('icons/obj/machines/status_display.dmi', GLOB.ai_status_display_emotes[value])
return uni_icon('icons/obj/machines/status_display.dmi', GLOB.ai_status_display_emotes[value])
/datum/preference/choiced/ai_emote_display/is_accessible(datum/preferences/preferences)
if (!..(preferences))
@@ -10,9 +10,9 @@
/datum/preference/choiced/ai_hologram_display/icon_for(value)
if (value == "Random")
return icon('icons/mob/silicon/ai.dmi', "questionmark")
return uni_icon('icons/mob/silicon/ai.dmi', "questionmark")
else
return icon(GLOB.ai_hologram_icons[value], GLOB.ai_hologram_icon_state[value])
return uni_icon(GLOB.ai_hologram_icons[value], GLOB.ai_hologram_icon_state[value])
/datum/preference/choiced/ai_hologram_display/is_accessible(datum/preferences/preferences)
if (!..(preferences))
+10 -15
View File
@@ -1,11 +1,9 @@
/// Assets generated from `/datum/preference` icons
/datum/asset/spritesheet/preferences
/datum/asset/spritesheet_batched/preferences
name = "preferences"
early = TRUE
/datum/asset/spritesheet/preferences/create_spritesheets()
var/list/to_insert = list()
/datum/asset/spritesheet_batched/preferences/create_spritesheets()
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))
@@ -17,23 +15,20 @@
for (var/preference_value in preference.get_choices())
var/create_icon_of = preference.icon_for(preference_value)
var/icon/icon
var/icon_state
var/datum/universal_icon/icon
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 = get_display_icon_for(atom_icon_source)
else if (istype(create_icon_of, /datum/universal_icon))
icon = create_icon_of
else if (isicon(create_icon_of))
CRASH("Icon given for preference [preference_key]:[preference_value]. This is not supported anymore, provide a /datum/universal_icon instead.")
else
CRASH("[create_icon_of] is an invalid preference value (from [preference_key]:[preference_value]).")
to_insert[preference.get_spritesheet_key(preference.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])
// There's no cost associated with inserting uni_icons, so just insert them immediately.
var/spritesheet_key = preference.get_spritesheet_key(preference.serialize(preference_value))
insert_icon(spritesheet_key, icon)
/// Returns the key that will be used in the spritesheet for a given value.
/datum/preference/proc/get_spritesheet_key(value)
+28 -28
View File
@@ -1,14 +1,14 @@
/proc/generate_underwear_icon(datum/sprite_accessory/accessory, icon/base_icon, color, icon_offset = 0) //SKYRAT EDIT CHANGE : adds icon_offset - Colorable Undershirt/Socks
var/icon/final_icon = new(base_icon)
/proc/generate_underwear_icon(datum/sprite_accessory/accessory, datum/universal_icon/base_icon, color, icon_offset = 0) //SKYRAT EDIT CHANGE : adds icon_offset - Colorable Undershirt/Socks
var/datum/universal_icon/final_icon = base_icon.copy()
if (!isnull(accessory))
var/icon/accessory_icon = icon(accessory.icon, accessory.icon_state) // SKYRAT EDIT CHANGE: ORIGINAL - var/icon/accessory_icon = icon('icons/mob/clothing/underwear.dmi', accessory.icon_state)
var/datum/universal_icon/accessory_icon = uni_icon(accessory.icon, accessory.icon_state) // SKYRAT EDIT CHANGE: ORIGINAL - var/icon/accessory_icon = uni_icon('icons/mob/clothing/underwear.dmi', accessory.icon_state)
if (color && !accessory.use_static)
accessory_icon.Blend(color, ICON_MULTIPLY)
final_icon.Blend(accessory_icon, ICON_OVERLAY)
accessory_icon.blend_color(color, ICON_MULTIPLY)
final_icon.blend_icon(accessory_icon, ICON_OVERLAY)
final_icon.Crop(10, 1+icon_offset, 22, 13+icon_offset) //SKYRAT EDIT CHANGE : adds icon_offset - Colorable Undershirt/Socks
final_icon.Scale(32, 32)
final_icon.crop(10, 1+icon_offset, 22, 13+icon_offset) //SKYRAT EDIT CHANGE : adds icon_offset - Colorable Undershirt/Socks
final_icon.scale(32, 32)
return final_icon
@@ -109,12 +109,12 @@
return /datum/sprite_accessory/socks/nude::name
/datum/preference/choiced/socks/icon_for(value)
var/static/icon/lower_half
var/static/datum/universal_icon/lower_half
if (isnull(lower_half))
lower_half = icon('icons/blanks/32x32.dmi', "nothing")
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg"), ICON_OVERLAY)
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
lower_half = uni_icon('icons/blanks/32x32.dmi', "nothing")
lower_half.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg"), ICON_OVERLAY)
lower_half.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
return generate_underwear_icon(SSaccessories.socks_list[value], lower_half)
@@ -149,24 +149,24 @@
*/ // SKYRAT EDIT REMOVAL END
/datum/preference/choiced/undershirt/icon_for(value)
var/static/icon/body
var/static/datum/universal_icon/body
if (isnull(body))
body = icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg")
body.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
body.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_arm"), ICON_OVERLAY)
body.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_arm"), ICON_OVERLAY)
body.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_hand"), ICON_OVERLAY)
body.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_hand"), ICON_OVERLAY)
body.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_chest_m"), ICON_OVERLAY)
body = uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg")
body.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
body.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_arm"), ICON_OVERLAY)
body.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_arm"), ICON_OVERLAY)
body.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_hand"), ICON_OVERLAY)
body.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_hand"), ICON_OVERLAY)
body.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_chest_m"), ICON_OVERLAY)
var/icon/icon_with_undershirt = icon(body)
var/datum/universal_icon/icon_with_undershirt = body.copy()
if (value != "Nude")
var/datum/sprite_accessory/accessory = SSaccessories.undershirt_list[value]
icon_with_undershirt.Blend(icon(accessory.icon, accessory.icon_state), ICON_OVERLAY)// SKYRAT EDIT CHANGE: ORIGINAL - icon_with_undershirt.Blend(icon('icons/mob/clothing/underwear.dmi', accessory.icon_state), ICON_OVERLAY)
icon_with_undershirt.blend_icon(uni_icon(accessory.icon, accessory.icon_state), ICON_OVERLAY)// SKYRAT EDIT CHANGE: ORIGINAL - icon_with_undershirt.blend_icon(uni_icon('icons/mob/clothing/underwear.dmi', accessory.icon_state), ICON_OVERLAY)
icon_with_undershirt.Crop(10, 11, 22, 23) // SKYRAT EDIT CHANGE : ORIGINAL - icon_with_undershirt.Crop(9, 9, 23, 23)
icon_with_undershirt.Scale(32, 32)
icon_with_undershirt.crop(10, 11, 22, 23) // SKYRAT EDIT CHANGE : ORIGINAL - icon_with_undershirt.crop(9, 9, 23, 23)
icon_with_undershirt.scale(32, 32)
return icon_with_undershirt
/datum/preference/choiced/undershirt/apply_to_human(mob/living/carbon/human/target, value)
@@ -188,13 +188,13 @@
return /datum/sprite_accessory/underwear/male_hearts::name
/datum/preference/choiced/underwear/icon_for(value)
var/static/icon/lower_half
var/static/datum/universal_icon/lower_half
if (isnull(lower_half))
lower_half = icon('icons/blanks/32x32.dmi', "nothing")
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_chest_m"), ICON_OVERLAY)
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg"), ICON_OVERLAY)
lower_half.Blend(icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
lower_half = uni_icon('icons/blanks/32x32.dmi', "nothing")
lower_half.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_chest_m"), ICON_OVERLAY)
lower_half.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_r_leg"), ICON_OVERLAY)
lower_half.blend_icon(uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_l_leg"), ICON_OVERLAY)
return generate_underwear_icon(SSaccessories.underwear_list[value], lower_half, COLOR_ALMOST_BLACK, icon_offset = 5) // SKYRAT EDIT CHANGE : ICON_OFFSET // SKYRAT EDIT CHANGE - ORIGINAL: return generate_underwear_icon(SSaccessories.underwear_list[value], lower_half, COLOR_ALMOST_BLACK)
+1 -1
View File
@@ -74,7 +74,7 @@
return assoc_to_keys(ghost_forms)
/datum/preference/choiced/ghost_form/icon_for(value)
return icon('icons/mob/simple/mob.dmi', value)
return uni_icon('icons/mob/simple/mob.dmi', value)
/datum/preference/choiced/ghost_form/create_default_value()
return "ghost"
+2 -2
View File
@@ -12,9 +12,9 @@
/datum/preference/choiced/glasses/icon_for(value)
if (value == "Random")
return icon('icons/effects/random_spawners.dmi', "questionmark")
return uni_icon('icons/effects/random_spawners.dmi', "questionmark")
else
return icon('icons/obj/clothing/glasses.dmi', "glasses_[LOWER_TEXT(value)]")
return uni_icon('icons/obj/clothing/glasses.dmi', "glasses_[LOWER_TEXT(value)]")
/datum/preference/choiced/glasses/is_accessible(datum/preferences/preferences)
if (!..(preferences))
@@ -23,7 +23,7 @@
var/icon/dummy_icon = getFlatIcon(dummy)
dummy_icon.Scale(64, 64)
dummy_icon.Crop(15, 64, 15 + 31, 64 - 31)
dummy_icon.Crop(15, 64 - 31, 15 + 31, 64)
dummy_icon.Scale(64, 64)
to_insert[sanitize_css_class_name(initial(species_type.name))] = dummy_icon
@@ -1,21 +1,21 @@
/proc/generate_icon_with_head_accessory(datum/sprite_accessory/sprite_accessory, y_offset = 0)
var/static/icon/head_icon
var/static/datum/universal_icon/head_icon
if (isnull(head_icon))
head_icon = icon('icons/mob/human/bodyparts_greyscale.dmi', "human_head_m")
head_icon.Blend(skintone2hex("caucasian1"), ICON_MULTIPLY)
head_icon = uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "human_head_m")
head_icon.blend_color(skintone2hex("caucasian1"), ICON_MULTIPLY)
var/icon/final_icon = new(head_icon)
if (!isnull(sprite_accessory))
var/datum/universal_icon/final_icon = head_icon.copy()
if (!isnull(sprite_accessory) && sprite_accessory.icon_state != SPRITE_ACCESSORY_NONE)
ASSERT(istype(sprite_accessory))
var/icon/head_accessory_icon = icon(sprite_accessory.icon, sprite_accessory.icon_state)
var/datum/universal_icon/head_accessory_icon = uni_icon(sprite_accessory.icon, sprite_accessory.icon_state)
if(y_offset)
head_accessory_icon.Shift(NORTH, y_offset)
head_accessory_icon.Blend(COLOR_DARK_BROWN, ICON_MULTIPLY)
final_icon.Blend(head_accessory_icon, ICON_OVERLAY)
head_accessory_icon.shift(NORTH, y_offset, ICON_SIZE_X, ICON_SIZE_Y)
head_accessory_icon.blend_color(COLOR_DARK_BROWN, ICON_MULTIPLY)
final_icon.blend_icon(head_accessory_icon, ICON_OVERLAY)
final_icon.Crop(10, 19, 22, 31)
final_icon.Scale(32, 32)
final_icon.crop(10, 19, 22, 31)
final_icon.scale(32, 32)
return final_icon
@@ -9,22 +9,23 @@
return assoc_to_keys(GLOB.color_list_ethereal)
/datum/preference/choiced/ethereal_color/icon_for(value)
var/static/icon/ethereal_base
var/static/datum/universal_icon/ethereal_base
if (isnull(ethereal_base))
ethereal_base = icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_head")
ethereal_base.Blend(icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_chest"), ICON_OVERLAY)
ethereal_base.Blend(icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_l_arm"), ICON_OVERLAY)
ethereal_base.Blend(icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_r_arm"), ICON_OVERLAY)
ethereal_base = uni_icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_head")
ethereal_base.blend_icon(uni_icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_chest"), ICON_OVERLAY)
ethereal_base.blend_icon(uni_icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_l_arm"), ICON_OVERLAY)
ethereal_base.blend_icon(uni_icon('icons/mob/human/species/ethereal/bodyparts.dmi', "ethereal_r_arm"), ICON_OVERLAY)
var/icon/eyes = icon('icons/mob/human/human_face.dmi', "eyes")
eyes.Blend(COLOR_BLACK, ICON_MULTIPLY)
ethereal_base.Blend(eyes, ICON_OVERLAY)
var/datum/universal_icon/eyes = uni_icon('icons/mob/human/human_face.dmi', "eyes_l")
eyes.blend_icon(uni_icon('icons/mob/human/human_face.dmi', "eyes_r"), ICON_OVERLAY)
eyes.blend_color(COLOR_BLACK, ICON_MULTIPLY)
ethereal_base.blend_icon(eyes, ICON_OVERLAY)
ethereal_base.Scale(64, 64)
ethereal_base.Crop(15, 64, 15 + 31, 64 - 31)
ethereal_base.scale(64, 64)
ethereal_base.crop(15, 64 - 31, 15 + 31, 64)
var/icon/icon = new(ethereal_base)
icon.Blend(GLOB.color_list_ethereal[value], ICON_MULTIPLY)
var/datum/universal_icon/icon = ethereal_base.copy()
icon.blend_color(GLOB.color_list_ethereal[value], ICON_MULTIPLY)
return icon
/datum/preference/choiced/ethereal_color/apply_to_human(mob/living/carbon/human/target, value)
@@ -1,26 +1,26 @@
/* SKYRAT EDIT REMOVAL
/proc/generate_lizard_side_shot(datum/sprite_accessory/sprite_accessory, key, include_snout = TRUE)
var/static/icon/lizard
var/static/icon/lizard_with_snout
var/static/datum/universal_icon/lizard
var/static/datum/universal_icon/lizard_with_snout
if (isnull(lizard))
lizard = icon('icons/mob/human/species/lizard/bodyparts.dmi', "lizard_head", EAST)
var/icon/eyes = icon('icons/mob/human/human_face.dmi', "eyes", EAST)
eyes.Blend(COLOR_GRAY, ICON_MULTIPLY)
lizard.Blend(eyes, ICON_OVERLAY)
lizard = uni_icon('icons/mob/human/species/lizard/bodyparts.dmi', "lizard_head", EAST)
var/datum/universal_icon/eyes = uni_icon('icons/mob/human/human_face.dmi', "eyes_l", EAST)
eyes.blend_color(COLOR_GRAY, ICON_MULTIPLY)
lizard.blend_icon(eyes, ICON_OVERLAY)
lizard_with_snout = icon(lizard)
lizard_with_snout.Blend(icon('icons/mob/human/species/lizard/lizard_misc.dmi', "m_snout_round_ADJ", EAST), ICON_OVERLAY)
lizard_with_snout = lizard.copy()
lizard_with_snout.blend_icon(uni_icon('icons/mob/human/species/lizard/lizard_misc.dmi', "m_snout_round_ADJ", EAST), ICON_OVERLAY)
var/icon/final_icon = include_snout ? icon(lizard_with_snout) : icon(lizard)
var/datum/universal_icon/final_icon = include_snout ? lizard_with_snout.copy() : lizard.copy()
if (!isnull(sprite_accessory))
var/icon/accessory_icon = icon(sprite_accessory.icon, "m_[key]_[sprite_accessory.icon_state]_ADJ", EAST)
final_icon.Blend(accessory_icon, ICON_OVERLAY)
if (!isnull(sprite_accessory) && sprite_accessory.icon_state != SPRITE_ACCESSORY_NONE)
var/datum/universal_icon/accessory_icon = uni_icon(sprite_accessory.icon, "m_[key]_[sprite_accessory.icon_state]_ADJ", EAST)
final_icon.blend_icon(accessory_icon, ICON_OVERLAY)
final_icon.Crop(11, 20, 23, 32)
final_icon.Scale(32, 32)
final_icon.Blend(COLOR_VIBRANT_LIME, ICON_MULTIPLY)
final_icon.crop(11, 20, 23, 32)
final_icon.scale(32, 32)
final_icon.blend_color(COLOR_VIBRANT_LIME, ICON_MULTIPLY)
return final_icon
@@ -38,20 +38,20 @@
/datum/preference/choiced/lizard_body_markings/icon_for(value)
var/datum/sprite_accessory/sprite_accessory = SSaccessories.lizard_markings_list[value]
var/icon/final_icon = icon('icons/mob/human/species/lizard/bodyparts.dmi', "lizard_chest_m")
var/datum/universal_icon/final_icon = uni_icon('icons/mob/human/species/lizard/bodyparts.dmi', "lizard_chest_m")
if (sprite_accessory.icon_state != "none")
var/icon/body_markings_icon = icon(
'icons/mob/human/species/lizard/lizard_misc.dmi',
if (sprite_accessory.icon_state != SPRITE_ACCESSORY_NONE)
var/datum/universal_icon/body_markings_icon = uni_icon(
sprite_accessory.icon,
"male_[sprite_accessory.icon_state]_chest",
)
final_icon.Blend(body_markings_icon, ICON_OVERLAY)
final_icon.blend_icon(body_markings_icon, ICON_OVERLAY)
final_icon.Blend(COLOR_VIBRANT_LIME, ICON_MULTIPLY)
final_icon.Crop(10, 8, 22, 23)
final_icon.Scale(26, 32)
final_icon.Crop(-2, 1, 29, 32)
final_icon.blend_color(COLOR_VIBRANT_LIME, ICON_MULTIPLY)
final_icon.crop(10, 8, 22, 23)
final_icon.scale(26, 32)
final_icon.crop(-2, 1, 29, 32)
return final_icon
@@ -10,19 +10,19 @@
return assoc_to_keys_features(SSaccessories.moth_antennae_list)
/datum/preference/choiced/moth_antennae/icon_for(value)
var/static/icon/moth_head
var/static/datum/universal_icon/moth_head
if (isnull(moth_head))
moth_head = icon('icons/mob/human/species/moth/bodyparts.dmi', "moth_head")
moth_head.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_l"), ICON_OVERLAY)
moth_head.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_r"), ICON_OVERLAY)
moth_head = uni_icon('icons/mob/human/species/moth/bodyparts.dmi', "moth_head")
moth_head.blend_icon(uni_icon('icons/mob/human/human_face.dmi', "motheyes_l"), ICON_OVERLAY)
moth_head.blend_icon(uni_icon('icons/mob/human/human_face.dmi', "motheyes_r"), ICON_OVERLAY)
var/datum/sprite_accessory/antennae = SSaccessories.moth_antennae_list[value]
var/icon/icon_with_antennae = new(moth_head)
icon_with_antennae.Blend(icon(antennae.icon, "m_moth_antennae_[antennae.icon_state]_FRONT"), ICON_OVERLAY)
icon_with_antennae.Scale(64, 64)
icon_with_antennae.Crop(15, 64, 15 + 31, 64 - 31)
var/datum/universal_icon/icon_with_antennae = moth_head.copy()
icon_with_antennae.blend_icon(uni_icon(antennae.icon, "m_moth_antennae_[antennae.icon_state]_FRONT"), ICON_OVERLAY)
icon_with_antennae.scale(64, 64)
icon_with_antennae.crop(15, 64 - 31, 15 + 31, 64)
return icon_with_antennae
@@ -48,33 +48,31 @@
/obj/item/bodypart/arm/right/moth,
)
var/static/icon/moth_body
var/static/datum/universal_icon/moth_body
if (isnull(moth_body))
moth_body = icon('icons/blanks/32x32.dmi', "nothing")
moth_body.Blend(icon('icons/mob/human/species/moth/moth_wings.dmi', "m_moth_wings_plain_BEHIND"), ICON_OVERLAY)
moth_body = uni_icon('icons/blanks/32x32.dmi', "nothing")
for (var/obj/item/bodypart/body_part as anything in body_parts)
moth_body.Blend(icon('icons/mob/human/species/moth/bodyparts.dmi', initial(body_part.icon_state)), ICON_OVERLAY)
moth_body.blend_icon(uni_icon('icons/mob/human/species/moth/bodyparts.dmi', initial(body_part.icon_state)), ICON_OVERLAY)
moth_body.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_l"), ICON_OVERLAY)
moth_body.Blend(icon('icons/mob/human/human_face.dmi', "motheyes_r"), ICON_OVERLAY)
moth_body.blend_icon(uni_icon('icons/mob/human/human_face.dmi', "motheyes_l"), ICON_OVERLAY)
moth_body.blend_icon(uni_icon('icons/mob/human/human_face.dmi', "motheyes_r"), ICON_OVERLAY)
var/datum/sprite_accessory/markings = SSaccessories.moth_markings_list[value]
var/icon/icon_with_markings = new(moth_body)
var/datum/universal_icon/icon_with_markings = moth_body.copy()
if (value != "None")
if (value != SPRITE_ACCESSORY_NONE)
for (var/obj/item/bodypart/body_part as anything in body_parts)
var/icon/body_part_icon = icon(markings.icon, "[markings.icon_state]_[initial(body_part.body_zone)]")
body_part_icon.Crop(1, 1, 32, 32)
icon_with_markings.Blend(body_part_icon, ICON_OVERLAY)
var/datum/universal_icon/body_part_icon = uni_icon(markings.icon, "[markings.icon_state]_[initial(body_part.body_zone)]")
body_part_icon.crop(1, 1, 32, 32)
icon_with_markings.blend_icon(body_part_icon, ICON_OVERLAY)
icon_with_markings.Blend(icon('icons/mob/human/species/moth/moth_wings.dmi', "m_moth_wings_plain_FRONT"), ICON_OVERLAY)
icon_with_markings.Blend(icon('icons/mob/human/species/moth/moth_antennae.dmi', "m_moth_antennae_plain_FRONT"), ICON_OVERLAY)
icon_with_markings.blend_icon(uni_icon('icons/mob/human/species/moth/moth_wings.dmi', "m_moth_wings_plain_FRONT"), ICON_OVERLAY)
icon_with_markings.blend_icon(uni_icon('icons/mob/human/species/moth/moth_antennae.dmi', "m_moth_antennae_plain_FRONT"), ICON_OVERLAY)
// Zoom in on the top of the head and the chest
icon_with_markings.Scale(64, 64)
icon_with_markings.Crop(15, 64, 15 + 31, 64 - 31)
icon_with_markings.scale(64, 64)
icon_with_markings.crop(15, 64 - 31, 15 + 31, 64)
return icon_with_markings
@@ -93,9 +91,7 @@
/datum/preference/choiced/moth_wings/icon_for(value)
var/datum/sprite_accessory/moth_wings = SSaccessories.moth_wings_list[value]
var/icon/final_icon = icon(moth_wings.icon, "m_moth_wings_[moth_wings.icon_state]_BEHIND")
final_icon.Blend(icon(moth_wings.icon, "m_moth_wings_[moth_wings.icon_state]_FRONT"), ICON_OVERLAY)
return final_icon
return uni_icon(moth_wings.icon, "m_moth_wings_[moth_wings.icon_state]_BEHIND")
/datum/preference/choiced/moth_wings/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["moth_wings"] = value
@@ -13,15 +13,15 @@
/datum/preference/choiced/pod_hair/icon_for(value)
var/datum/sprite_accessory/pod_hair = SSaccessories.pod_hair_list[value]
var/icon/icon_with_hair = icon('icons/mob/human/bodyparts_greyscale.dmi', "pod_head_m")
var/datum/universal_icon/icon_with_hair = uni_icon('icons/mob/human/bodyparts_greyscale.dmi', "pod_head_m")
var/icon/icon_adj = icon(pod_hair.icon, "m_pod_hair_[pod_hair.icon_state]_ADJ")
var/icon/icon_front = icon(pod_hair.icon, "m_pod_hair_[pod_hair.icon_state]_FRONT")
icon_adj.Blend(icon_front, ICON_OVERLAY)
icon_with_hair.Blend(icon_adj, ICON_OVERLAY)
icon_with_hair.Scale(64, 64)
icon_with_hair.Crop(15, 64, 15 + 31, 64 - 31)
icon_with_hair.Blend(COLOR_GREEN, ICON_MULTIPLY)
var/datum/universal_icon/icon_adj = uni_icon(pod_hair.icon, "m_pod_hair_[pod_hair.icon_state]_ADJ")
var/datum/universal_icon/icon_front = uni_icon(pod_hair.icon, "m_pod_hair_[pod_hair.icon_state]_FRONT")
icon_adj.blend_icon(icon_front, ICON_OVERLAY)
icon_with_hair.blend_icon(icon_adj, ICON_OVERLAY)
icon_with_hair.scale(64, 64)
icon_with_hair.crop(15, 64 - 31, 15 + 31, 64)
icon_with_hair.blend_color(COLOR_GREEN, ICON_MULTIPLY)
return icon_with_hair
@@ -16,9 +16,9 @@
/datum/preference/choiced/vampire_status/icon_for(value)
switch (value)
if ("Inoculated")
return icon('icons/obj/drinks/drinks.dmi', "bloodglass")
return uni_icon('icons/obj/drinks/drinks.dmi', "bloodglass")
if ("Outcast")
return icon('icons/obj/medical/bloodpack.dmi', "generic_bloodpack")
return uni_icon('icons/obj/medical/bloodpack.dmi', "generic_bloodpack")
///list that stores a vampire house name for each department
GLOBAL_LIST_EMPTY(vampire_houses)
+4 -4
View File
@@ -9,11 +9,11 @@
return assoc_to_keys(GLOB.available_ui_styles)
/datum/preference/choiced/ui_style/icon_for(value)
var/icon/icons = GLOB.available_ui_styles[value]
var/ui_icons = GLOB.available_ui_styles[value]
var/icon/icon = icon(icons, "hand_r")
icon.Crop(1, 1, ICON_SIZE_X * 2, ICON_SIZE_Y)
icon.Blend(icon(icons, "hand_l"), ICON_OVERLAY, ICON_SIZE_X)
var/datum/universal_icon/icon = uni_icon(ui_icons, "hand_l")
icon.crop(1 - ICON_SIZE_X, 1, ICON_SIZE_Y, ICON_SIZE_X)
icon.blend_icon(uni_icon(ui_icons, "hand_r"), ICON_OVERLAY)
return icon
+1 -1
View File
@@ -86,7 +86,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
if(prefs.toggles & MEMBER_PUBLIC)
keyname = "<font color='[prefs.read_preference(/datum/preference/color/ooc_color) || GLOB.normal_ooc_colour]'>[icon2html('icons/ui/chat/member_content.dmi', world, "blag")][keyname]</font>"
if(prefs.hearted)
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/chat)
var/datum/asset/spritesheet_batched/sheet = get_asset_datum(/datum/asset/spritesheet_batched/chat)
keyname = "[sheet.icon_tag("emoji-heart")][keyname]"
//The linkify span classes and linkify=TRUE below make ooc text get clickable chat href links if you pass in something resembling a url
for(var/client/receiver as anything in GLOB.clients)