Beardbunnymanbrain
Based on game build 714014 | Last updated: 2026-02-27
This file is marked as unused and unmaintained in the official codebase. It exists only as a legacy reference, and should not be used as a reference for new development.
Overview
This component defines the AI brain for Werepig entities (WerePigBrain). It inherits from Brain and implements behavior logic using a behavior tree (BT) composed of common behavior nodes. The brain handles priority-based decision making: panic responses take precedence, followed by opportunistic eating, combat, and then wandering near a remembered home location. It interacts with combat, eater, follower, homeseeker, and knownlocations components to coordinate actions.
Note: The file name (beardbunnymanbrain.lua) does not match the actual class name (WerePigBrain). This mismatch suggests the file was likely misnamed or repurposed during development and is no longer actively used.
Dependencies & Tags
- Components used:
combat: accessed viainst.components.combat.target,inst.components.combat.defaultdamageeater: accessed viainst.components.eater:CanEat(...)follower: accessed viainst.components.follower:GetLeader()homeseeker: accessed viainst.components.homeseeker.homeandIsValid()knownlocations: accessed viainst.components.knownlocations:GetLocation("home")andinst.components.knownlocations:RememberLocation(...)
- Tags: None identified.
Properties
The class does not declare any public properties in the constructor. All state is managed internally by behavior nodes and component interactions.
Main Functions
FindFoodAction(inst)
- Description: Locates an edible entity within
SEE_FOOD_DIST(10units) that satisfiesCanEat()and is on a passable point. Returns a bufferedEATaction targeting that entity, ornil. - Parameters:
inst(Entity): The entity instance whose brain is making the decision.
- Returns:
BufferedActionornil.
GoHomeAction(inst)
- Description: Constructs a buffered
GOHOMEaction if the entity has no active leader, has a validhomeseekercomponent, and a valid home location stored inhomeseeker.home. - Parameters:
inst(Entity): The entity instance.
- Returns:
BufferedActionornil.
TargetIsAggressive(inst)
- Description: Checks whether the current combat target is currently aggressive — that is, has positive
defaultdamage, hascombatcomponent, and is targeting the entity (target.components.combat.target == inst). - Parameters:
inst(Entity): The entity instance.
- Returns:
boolean—trueif the target is aggressive and valid.
WerePigBrain:OnStart()
- Description: Initializes the behavior tree root node. Establishes priority order: panic conditions > safe eating > combat (chase and attack) > wandering near home. Uses
WhileNodeto enable opportunistic eating only when the target is not aggressive. - Parameters: None.
- Returns: None. Sets
self.btto the constructedBTinstance.
WerePigBrain:OnInitializationComplete()
- Description: Records the entity’s current position as the
"home"location usingKnownLocations:RememberLocation(...). - Parameters: None.
- Returns: None.
Events & Listeners
None. This component does not register or dispatch any events directly. Behavioral responses (e.g., panic) are driven by BrainCommon helper nodes.