From 6c977f347d634034d29ffcb45098d8ded0a6b635 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Tue, 14 Apr 2020 20:40:59 +0200 Subject: [PATCH 1/3] Update game_options.dm --- code/controllers/configuration/entries/game_options.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/controllers/configuration/entries/game_options.dm b/code/controllers/configuration/entries/game_options.dm index f11093cba7..85aec2e67b 100644 --- a/code/controllers/configuration/entries/game_options.dm +++ b/code/controllers/configuration/entries/game_options.dm @@ -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,9 +469,11 @@ 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 From e0248d6b9751311710fd5838e93bd5dba615b600 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Thu, 16 Apr 2020 15:53:15 +0200 Subject: [PATCH 2/3] Update sanitize_values.dm --- code/__HELPERS/sanitize_values.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/__HELPERS/sanitize_values.dm b/code/__HELPERS/sanitize_values.dm index faa8c22f38..e494468fe7 100644 --- a/code/__HELPERS/sanitize_values.dm +++ b/code/__HELPERS/sanitize_values.dm @@ -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 From b7b9fc55f5ed75533901c9c8a247bb5a8868c438 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Thu, 16 Apr 2020 15:54:59 +0200 Subject: [PATCH 3/3] Update preferences_savefile.dm --- code/modules/client/preferences_savefile.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 7da9d5a1dc..10e351cba5 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -575,7 +575,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)