Merge pull request #11854 from Citadel-Station-13/Ghommie-patch-1

Something about configs and integers.
This commit is contained in:
Putnam3145
2020-04-21 13:04:31 -07:00
committed by GitHub
3 changed files with 12 additions and 1 deletions

View File

@@ -6,6 +6,13 @@
return number
return default
/proc/sanitize_num_clamp(number, min=0, max=1, default=0, quantize=0)
if(!isnum(number))
return default
. = CLAMP(number, min, max)
if(quantize)
. = round(number, quantize)
/proc/sanitize_text(text, default="")
if(istext(text))
return text

View File

@@ -455,10 +455,12 @@
config_entry_value = RESIZE_DEFAULT_SIZE
min_val = 0.1 //to avoid issues with zeros and negative values.
max_val = RESIZE_DEFAULT_SIZE
integer = FALSE
/datum/config_entry/number/body_size_max
config_entry_value = RESIZE_DEFAULT_SIZE
min_val = RESIZE_DEFAULT_SIZE
integer = FALSE
//Pun-Pun movement slowdown given to characters with a body size smaller than this value,
//to compensate for their smaller hitbox.
@@ -467,12 +469,14 @@
config_entry_value = RESIZE_DEFAULT_SIZE * 0.85
min_val = 0
max_val = RESIZE_DEFAULT_SIZE
integer = FALSE
//multiplicative slowdown multiplier. See 'dna.update_body_size' for the operation.
//doesn't apply to floating or crawling mobs
/datum/config_entry/number/body_size_slowdown_multiplier
config_entry_value = 0.25
min_val = 0.1 //To encourage folks to disable the slowdown through the above config instead.
integer = FALSE
//Allows players to set a hexadecimal color of their choice as skin tone, on top of the standard ones.
/datum/config_entry/number/allow_custom_skintones

View File

@@ -599,7 +599,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
var/static/size_max
if(!size_max)
size_max = CONFIG_GET(number/body_size_max)
features["body_size"] = sanitize_integer(features["body_size"], size_min, size_max, RESIZE_DEFAULT_SIZE)
features["body_size"] = sanitize_num_clamp(features["body_size"], size_min, size_max, RESIZE_DEFAULT_SIZE, 0.01)
var/static/list/B_sizes
if(!B_sizes)