Skip to content

Commit

Permalink
Merge pull request #73591 from GuardianDll/clamp_metabolism
Browse files Browse the repository at this point in the history
Clamp metabolism enchantment to prevent lag
  • Loading branch information
Maleclypse authored May 9, 2024
2 parents a161974 + efdb35c commit 581c99b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,9 @@ float Character::metabolic_rate_base() const
{
static const std::string hunger_rate_string( "PLAYER_HUNGER_RATE" );
float hunger_rate = get_option< float >( hunger_rate_string );
return enchantment_cache->modify_value( enchant_vals::mod::METABOLISM, hunger_rate );
const float final_hunger_rate = enchantment_cache->modify_value( enchant_vals::mod::METABOLISM,
hunger_rate );
return std::clamp( final_hunger_rate, 0.0f, float_max );
}

// TODO: Make this less chaotic to let NPC retroactive catch up work here
Expand Down

0 comments on commit 581c99b

Please sign in to comment.