From a90138e0f416eca1aa94d5be9cd37b7aea71d007 Mon Sep 17 00:00:00 2001 From: BurgerLUA Date: Sat, 20 Oct 2018 14:20:22 -0700 Subject: [PATCH] Fixed Starting Nutrition/Hydration (#5438) Byond doesn't know how to handle decimal based probabilities and just rounds up. Example, rand(0.5,75) will return 1, which caused everyone to spawn with max nutrition/hydration. --- code/__defines/mobs.dm | 8 ++--- code/controllers/subsystems/job.dm | 4 +-- html/changelogs/burgerbb - fuck randy.yml | 37 +++++++++++++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 html/changelogs/burgerbb - fuck randy.yml diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index 95423996e98..fabc35c01a0 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -128,11 +128,11 @@ #define BASE_MAX_HYDRATION 600 #define THIRST_FACTOR 0.02 // Factor of how fast mob hydration decreases over time. -#define CREW_MINIMUM_HYDRATION BASE_MAX_HYDRATION * CREW_HYDRATION_SLIGHTLYTHIRSTY // The minimum amount of nutrition a crewmember will spawn with. -#define CREW_MAXIMUM_HYDRATION BASE_MAX_HYDRATION * CREW_HYDRATION_HYDRATED // Same as above, but maximum. +#define CREW_MINIMUM_HYDRATION CREW_HYDRATION_SLIGHTLYTHIRSTY // The minimum amount of nutrition a crewmember will spawn with, represented as a percentage +#define CREW_MAXIMUM_HYDRATION CREW_HYDRATION_HYDRATED // Same as above, but maximum. -#define CREW_MINIMUM_NUTRITION BASE_MAX_NUTRITION * CREW_NUTRITION_SLIGHTLYHUNGRY // The minimum amount of nutrition a crewmember will spawn with. -#define CREW_MAXIMUM_NUTRITION BASE_MAX_NUTRITION * CREW_NUTRITION_FULL // Same as above, but maximum. +#define CREW_MINIMUM_NUTRITION CREW_NUTRITION_FULL // The minimum amount of nutrition a crewmember will spawn with, represented as a percentage. +#define CREW_MAXIMUM_NUTRITION CREW_NUTRITION_OVEREATEN // Same as above, but maximum. //Note that all of this is relative to nutrition/max nutrition #define CREW_NUTRITION_OVEREATEN 0.95 diff --git a/code/controllers/subsystems/job.dm b/code/controllers/subsystems/job.dm index 2ca5519167a..ceb4a48270a 100644 --- a/code/controllers/subsystems/job.dm +++ b/code/controllers/subsystems/job.dm @@ -335,10 +335,10 @@ // Randomize nutrition and hydration. Defines are in __defines/mobs.dm if(H.max_nutrition > 0) - H.nutrition = (rand(CREW_MINIMUM_NUTRITION, CREW_MAXIMUM_NUTRITION) * 0.01) * H.max_nutrition + H.nutrition = rand(CREW_MINIMUM_NUTRITION*100, CREW_MAXIMUM_NUTRITION*100) * H.max_nutrition * 0.01 if(H.max_hydration > 0) - H.hydration = (rand(CREW_MINIMUM_HYDRATION, CREW_MAXIMUM_HYDRATION) * 0.01) * H.max_hydration + H.hydration = rand(CREW_MINIMUM_HYDRATION*100, CREW_MAXIMUM_HYDRATION*100) * H.max_hydration * 0.01 if (!megavend) spawn_in_storage += EquipCustomDeferred(H, H.client.prefs, custom_equip_leftovers, custom_equip_slots) diff --git a/html/changelogs/burgerbb - fuck randy.yml b/html/changelogs/burgerbb - fuck randy.yml new file mode 100644 index 00000000000..23600a38517 --- /dev/null +++ b/html/changelogs/burgerbb - fuck randy.yml @@ -0,0 +1,37 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +################################# + +# Your name. +author: BurgerBB + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed a bug that made everyone spawn chubby and with full nutrition. Thanks BYOND."