Skip to content

Commit

Permalink
Clamp metabolism enchantment to prevent lag
Browse files Browse the repository at this point in the history
Co-authored-by: RenechCDDA <[email protected]>
  • Loading branch information
GuardianDll and RenechCDDA committed May 8, 2024
1 parent 386a00c commit efdb35c
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 efdb35c

Please sign in to comment.