Skip to main content

Deciduous Root

Based on game build 714014 | Last updated: 2026-03-05

Overview

deciduous_root is a temporary entity prefabricated for use as an AoE weapon deployed by the deciduous monster boss. It is instantiated with physics, anim state, sound, and combat components, and moves linearly toward a designated position using an inQuad easing function. Once in position, it triggers an area attack and self-destructs. It has no persistent state and exists only for a short gameplay window.

Usage example

This entity is not typically instantiated manually by modders — it is spawned internally by the deciduous monster during boss combat. However, a minimal instantiation example for testing is:

local root = Prefab("deciduous_root", fn)
local inst = SpawnPrefab("deciduous_root")
if inst and inst.components.combat then
-- Set target before attack phase
inst:PushEvent("givetarget", {
owner = some_entity,
target = some_target,
targetangle = 0,
targetpos = Vector3(10, 0, 10),
})
end

Dependencies & tags

Components used: combat, transform, animstate, soundemitter, physics, network
Tags added: birchnutroot, notarget

Properties

PropertyTypeDefault ValueDescription
ownerEntity or nilnilThe entity that spawned the root (set via givetarget event).
targetEntity or nilnilThe targeted entity (set via givetarget event).
targetanglenumber or nilnilDirection angle (radians) toward which the root moves.
targetposVector3 or nilnilDestination position (set via givetarget event).
originVector3 or nilnilStarting position (computed during movement setup).
vectorVector3 or nilnilDisplacement vector (computed during movement setup).
dist_to_covernumber or nilnilEuclidean distance between start and target position.
stepnumber0Internal counter tracking animation progress (0–29).
movetaskTask or nilnilPeriodic task responsible for motion interpolation.

Main functions

GiveTarget(inst, data)

  • Description: Initializes directional movement and sets up the root’s targeting data. Must be called via the "givetarget" event. Triggers a linear interpolation movement over 29 frames toward the target position.
  • Parameters: data (table) - an object containing optional keys: owner, target, targetangle, targetpos.
  • Returns: Nothing.
  • Error states: Does nothing if data is nil or if targetpos is missing while targetangle is present (prevents incomplete setup). Movement task cancels automatically after 29 frames.

IsValidAOETarget(guy, inst)

  • Description: Predicate used by the combat component to filter valid area-of-effect targets. Excludes birchnut-related prefabs to prevent friendly fire.
  • Parameters: guy (Entity), inst (Entity) — unused in logic but passed as context.
  • Returns: true if guy lacks birchnutroot, birchnut, and birchnutdrake tags; otherwise false.

Events & listeners

  • Listens to: givetarget — triggers GiveTarget(inst, data).
  • Listens to: animqueueover — calls inst.Remove() to destroy the entity after animation completes.
  • Pushes: None (does not fire custom events).
note

All combat logic (damage and area-of-effect processing) is handled through the combat component API (SetAreaDamage, SetDefaultDamage, DoAttack). This entity does not override combat behavior directly — it simply triggers attacks via scheduled tasks aligned with animation timing.