Planarentity
Overview
This component grants planar defense capabilities to an entity by reducing incoming non-planar damage through a custom formula and spawning visual feedback effects. It does not actively manage planar damage (e.g., handling planar-specific attacks) but focuses on resisting non-planar damage sources.
Dependencies & Tags
Dependencies:
- No explicit component additions (e.g.,
AddComponent) are visible in the source. - Relies on external prefabs:
"planar_resist_fx"and"planar_hit_fx". - Requires the entity to have a
Transformcomponent (for position access) andGetPhysicsRadius()support (fromPhysicsor similar component). - May optionally depend on a
spawn_effect_oncallback property (commented out in source), suggesting integration with entities likecentipedefor targeted effect placement.
Tags: None identified.
Properties
No public properties are initialized in the constructor (_ctor is not present, and the class function only stores inst). The commented line --self.spawn_effect_on = nil indicates an optional callback that may be set externally but is not part of the core component initialization.
| Property | Type | Default Value | Description |
|---|---|---|---|
inst | Entity | (passed) | Reference to the associated game entity. |
Note: No public properties beyond inst were clearly identified.
Main Functions
AbsorbDamage(damage, attacker, weapon, spdmg)
- Description: Calculates reduced damage using a scaling formula, and triggers resistance effects if the attack is non-planar (i.e.,
spdmgisnilor lacks aplanarfield). Returns the modified damage value andspdmg. - Parameters:
damage(number): Raw incoming damage value.attacker(Entity?): The source entity of the attack (may benil).weapon(any): Weapon item involved (unused in current logic).spdmg(table?): Damage table; ifnilorspdmg.planaris falsy, resistance effects are applied.
OnResistNonPlanarAttack(attacker)
- Description: Spawns a
planar_resist_fxparticle effect around the entity to visually represent damage absorption. The effect position is randomized in a ring around the entity and adjusted based on the attacker’s position if available. - Parameters:
attacker(Entity?): The attacking entity (used to orient the effect direction).
OnPlanarAttackUndefended(target)
- Description: Spawns a
planar_hit_fxparticle effect attached to the target entity, likely used to indicate planar damage was applied without resistance (e.g., planar weapons hitting non-planar targets). Note: Despite the name, the function itself does not imply resistance failure—it simply visualizes the hit.
Events & Listeners
None identified.