mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
## About The Pull Request Completely refactored how client colors are handled. Now they're similar to traits, having a source associated with them. Instead of adding and removing by strict type (which makes client colors prone to getting duplicated and not cleaned up) you remove a filter associated with a specific source. Adding another client color with the same source as an already existing one will replace the existing one if its of a different type, or do nothing if they're the same (unless force is set to TRUE). Client colors can also force filter splitting, putting all colors that come before them, themselves, and all colors after them into separate filters - this is useful to prevent mixing in filters which are supposed to remove a certain color. <details> <summary>Example of how Perceptomatrix and nightmare vision goggles combined before this PR:</summary>  And this is after, as you can see nightmare vision effect's red is only slightly tinted by perceptomatix instead of being literally halved.  </details> Additionally, added support for custom filters (and not just colors) to client color code to allow us to work with more colorspaces. Also fixed weird blindness behavior, so this also Closes #89787 ## Why It's Good For The Game Makes code less ass to work with, fixes weird color mixing, etc. ## Changelog 🆑 fix: Fixed perceptomatix helmet allowing you to see even when unconscious refactor: Refactored how client colors are handled, ensuring that certain effects like nightmare goggles don't disappear when another vision-affecting piece of clothing is worn. /🆑
16 lines
659 B
Plaintext
16 lines
659 B
Plaintext
///Checks that client colours have valid colour variables values at least when inited.
|
|
/datum/unit_test/client_colours
|
|
|
|
/datum/unit_test/client_colours/Run()
|
|
for(var/datum/client_colour/colour as anything in subtypesof(/datum/client_colour))
|
|
// colours can be color matrices (lists), which initial() cannot read.
|
|
colour = new colour
|
|
if (islist(colour.color))
|
|
var/list/potential_filter = colour.color
|
|
// If our list has "type" in it then its a filter, ignore that
|
|
if (potential_filter["type"])
|
|
continue
|
|
|
|
if(!color_to_full_rgba_matrix(colour.color, FALSE))
|
|
TEST_FAIL("[colour.type] has an invalid default colour value: [colour.color]")
|