From 1f4f45c8b4a15d2e98cbd734aa2e96dc39bf9f95 Mon Sep 17 00:00:00 2001 From: wwkk222208 <92137695+wwkk222208@users.noreply.github.com> Date: Mon, 11 Mar 2024 06:50:02 +0800 Subject: [PATCH] Non-player faction NPCs need no food. (#72296) * Non-player faction NPCs need no food. * clang-tidy --- src/character.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/character.cpp b/src/character.cpp index c000715f6505b..d14b08a101b70 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -4970,7 +4970,9 @@ float Character::activity_level() const bool Character::needs_food() const { - return !( is_npc() && get_option( "NO_NPC_FOOD" ) ); + // Before the mechanism for non-player faction NPCs to obtain food is set up, it is unreasonable to require them to consume food. + return ( !get_option( "NO_NPC_FOOD" ) && get_faction() == get_avatar().get_faction() ) || + !is_npc(); } void Character::update_needs( int rate_multiplier )