Willow Ember Common
Based on game build 722832 | Last updated: 2026-04-18
Overview
willow_ember_common is a utility module that provides helper functions for managing Willow's ember mechanics. It handles ember spawning, distribution, inventory granting, and target selection for fire burst abilities. The module is designed to be required by other prefabs and components that need to interact with ember-related functionality.
Usage example
local fns = require("prefabs/willow_ember_common")
-- Check if a victim entity has embers
if fns.HasEmbers(victim) then
local num = fns.GetNumEmbers(victim)
fns.SpawnEmbersAt(victim, num)
end
-- Give embers directly to a player's inventory
fns.GiveEmbers(player, 3, player.Transform:GetWorldPosition())
-- Get valid targets for fire burst ability
local targets = fns.GetBurstTargets(player)
Dependencies & tags
External dependencies:
TUNING-- accessesFIRE_BURST_RANGEconstant for target findingTheSim-- usesFindEntitiesfor entity queriesSpawnPrefab-- spawnswillow_emberprefab instances
Components used:
burnable-- checksIsBurning()on victim entitiesinventory-- callsGiveItem()to add embers to entity inventorystackable-- callsSetStackSize()to set ember stack countcombat-- accessed viaplayer.replica.combatfor ally checks
Tags:
animal,character,largecreature,monster,smallcreature-- checked byHasEmbers()viaHasOneOfTags()noember-- excluded from ember effectsepic-- increases ember count to 7-8largecreature-- increases ember count to 3canlight,nolight,fire-- used in burst target filteringbigbernie-- special case for burnable Bernieplayer,ghost,invisible,noattack,notarget,companion,flight,INLIMBO-- excluded from burst targets_combat-- required tag for burst targets viaCREATURES_MUST
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
| None | No properties are defined. This is a utility module returning a function table. |
Main functions
HasEmbers(victim)
- Description: Checks if a victim entity is valid for ember effects by verifying it has a burnable component that is currently burning, lacks the
noembertag, and has at least one creature-type tag. - Parameters:
victim-- entity instance to check - Returns:
trueif entity qualifies for embers,falseotherwise - Error states: Errors if
victimis nil or lackscomponentstable (nil dereference onvictim.components.burnable— no guard present)
GetNumEmbers(victim)
- Description: Determines the number of embers to spawn based on victim's tags. Returns 7-8 for
epictag, 3 forlargecreaturetag, or 1 for all other valid creatures. - Parameters:
victim-- entity instance to evaluate - Returns: Number (1, 3, or random 7-8)
- Error states: Errors if
victimis nil or lacksHasTag()method — assumesHasEmbers()was checked separately per source comment
SpawnEmberAt(x, y, z, victim, marksource)
- Description: Spawns a single
willow_emberprefab at the specified world position. Optionally marks the ember with the victim's ember source reference. - Parameters:
x-- world X coordinatey-- world Y coordinatez-- world Z coordinatevictim-- source entity (can be nil)marksource-- boolean to mark ember with source reference
- Returns: None
- Error states: Errors if
SpawnPrefab("willow_ember")returns nil and subsequent methods are called on it
SpawnEmbersAt(victim, numembers)
- Description: Spawns multiple embers around a victim entity. Spawns one at the victim's position (marked as source) and distributes remaining embers in a circular pattern with randomized variance. Special handling for
numembers == 2spawns two embers at offset positions. - Parameters:
victim-- entity to spawn embers aroundnumembers-- total number of embers to spawn
- Returns: None
- Error states: Errors if
victimis nil or lacksTransformcomponent (nil dereference onvictim.Transform:GetWorldPosition())
GiveEmbers(inst, num, pos)
- Description: Spawns an ember prefab, sets its stack size, and gives it to the target entity's inventory at the specified position.
- Parameters:
inst-- entity to receive embers (must have inventory component)num-- number of embers to stackpos-- world position vector for spawn location
- Returns: None
- Error states: Errors if
instlacksinventorycomponent (nil dereference oninst.components.inventory:GiveItem()— no guard present)
GetBurstTargets(player)
- Description: Finds all valid creature entities within
TUNING.FIRE_BURST_RANGEof the player that can be targeted by fire burst. Filters out allies, companions, non-burnables, already burning entities, and entities with exclusion tags. Is also called from the client-side. - Parameters:
player-- player entity to search around - Returns: Array of valid target entity instances (may be empty)
- Error states: Errors if
playeris nil or lacksTransformcomponent (nil dereference onplayer.Transform:GetWorldPosition())
Events & listeners
None. This is a utility module with pure functions — no event registration or emission.