Skip to content

Commit

Permalink
Adds sanitization redundancy for 3-hex colours (#2131)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Hopefully makes it so that players with three-hex-code colour values
automatically convert to six-hex-code colours.

## Why It's Good For The Game
you don't lose your colours

## Changelog

:cl:
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
MarkSuckerberg authored Jul 9, 2023
1 parent 737068c commit 03a161e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/__HELPERS/sanitize_values.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
i += length(color[i])

if(length_char(.) != desired_format)
if(desired_format == 6 && length_char(.) == 3) //doing this quickly rather than elegantly
var/red = .[1]
var/green = .[2]
var/blue = .[3]
return crunch + "[red][red][green][green][blue][blue]"
if(default)
return default
return crunch + repeat_string(desired_format, "0")
Expand Down

0 comments on commit 03a161e

Please sign in to comment.