Skip to main content

Simplemagicgrower

Overview

This component implements a recursive growth mechanism that accelerates the natural growth process of an entity by repeatedly applying growth steps until a target growth stage (last_stage) is reached. It is designed to work alongside a growable component and temporarily tags the entity with "magicgrowth" during active growth.

Dependencies & Tags

  • Component dependency: Requires the growable component to be present on the same entity.
  • Tags added: "magicgrowth" (added when StartGrowing is called).
  • Tags removed: "magicgrowth" (removed after reaching last_stage).

Properties

PropertyTypeDefault ValueDescription
instEntitynil (set in _ctor)Reference to the owning entity.
last_stagenumbernilThe target growth stage at which to stop magical growth. Set via SetLastStage.

Main Functions

SetLastStage(last_stage)

  • Description: Sets the target growth stage (last_stage) that defines when growth should cease.
  • Parameters:
    • last_stage (number): The desired final growth stage value.

Grow()

  • Description: Performs a single growth step via growable:DoGrowth() if growth is possible, then schedules another growth step after a short random delay using a one-time task. If the current stage meets or exceeds last_stage, growth stops and the "magicgrowth" tag is removed.
  • Parameters: None.

StartGrowing()

  • Description: Begins the magical growth process by adding the "magicgrowth" tag and invoking Grow() for the first time.
  • Parameters: None.

Events & Listeners

None.