Bernie Common
Based on game build 714014 | Last updated: 2026-03-20
Overview
bernie_common is a utility module that encapsulates shared logic for Bernie-related entities. It primarily provides helper functions to determine if a leader entity (typically Willow) meets specific sanity thresholds or skill tree conditions, and to detect nearby hostile entities based on alignment tags. This module is typically required by Bernie prefab scripts or stategraphs to influence AI decision-making.
Usage example
local bernie_common = require("prefabs/bernie_common")
-- Check if the leader meets sanity conditions for Bernie activation
local is_crazy = bernie_common.isleadercrazy(inst, leader)
-- Check if there are hostile entities nearby based on Willow's skills
local is_hotheaded = bernie_common.hotheaded(inst, player)
Dependencies & tags
Components used: sanity, skilltreeupdater, transform
Tags: Filters entities using _combat, hostile, INLIMBO, player, companion, brightmare, lunar_aligned, shadow_aligned, shadow.
Properties
No public properties
Main functions
isleadercrazy(inst, leader)
- Description: Evaluates whether the specified
leaderentity is considered "crazy" based on sanity percentage or unlocked Willow skill tree nodes. This determines if Bernie should enter an aggro state. - Parameters:
inst(Entity) - The entity instance calling the function (unused in logic).leader(Entity) - The leader entity (typically Willow) to check sanity skills against.
- Returns:
trueif sanity conditions are met, otherwisenil. - Error states: Returns
nilifleaderdoes not have thesanityorskilltreeupdatercomponents.
hotheaded(inst, player)
- Description: Scans the environment around
instfor hostile entities that match specific alignment tags. This is used to determine if Bernie should engage combat based on Willow's "Hotheaded" skill. - Parameters:
inst(Entity) - The entity instance used to get the world position for the search.player(Entity) - The player entity checked for thewillow_bernieaiskill activation.
- Returns:
trueif valid targets are found within range, otherwisenil. - Error states: Returns
nilif the player has not activated the required skill or no entities match the tag filters.
Events & listeners
None identified.