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.
This commit is contained in:
BurgerLUA
2018-10-21 00:20:22 +03:00
committed by Erki
parent a8ed4dad29
commit a90138e0f4
3 changed files with 43 additions and 6 deletions
+4 -4
View File
@@ -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
+2 -2
View File
@@ -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)
+37
View File
@@ -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."