Skip to main content

Oasis

Overview

The Oasis component is attached to an entity (typically a special marker or location in the world) to define a circular region representing an oasis. It enables proximity checks to determine whether another entity is within the oasis and calculates a normalized proximity level (0.0–1.0) based on distance from the boundary.

Dependencies & Tags

None identified.

Properties

PropertyTypeDefault ValueDescription
instEntity(none)Reference to the entity the component is attached to (the oasis center). Set in constructor.
radiusnumber1Radius of the oasis region (in units), used for proximity calculations.

Main Functions

IsEntityInOasis(ent)

  • Description: Checks whether the given entity ent is inside the oasis region (i.e., within or at the defined radius from the center entity).
  • Parameters:
    ent (Entity) — The entity to test.

GetProximityLevel(ent, range)

  • Description: Returns a normalized proximity level (a float in [0, 1]) indicating how close ent is to being fully inside the oasis.
    • Returns 1 if the entity is fully within the oasis boundary (distance ≤ radius).
    • Returns 0 if the entity is at or beyond radius + range from the center.
    • Returns an interpolated value in between based on distance.
      The "range" parameter defines the transition zone width beyond the oasis radius.
  • Parameters:
    ent (Entity) — The entity to evaluate.
    range (number) — The distance outside the oasis radius over which proximity transitions smoothly from 1 to 0.

Events & Listeners

None.