Armor Lunarplant
Based on game build 714014 | Last updated: 2026-03-04
Overview
armor_lunarplant is a prefab generator function producing equippable armor with defensive properties: base armor, planar defense, and resistance to lunar_aligned damage types. When equipped, it applies visual effects, light overrides, and handles set-bonus activation. Two variants are supported — standard and husk — the latter restricts use to plantkin characters and enables additional thorn-based reflect behaviors when equipped by Wormwood or Wortox. It integrates with components including armor, planardefense, damagereflect, damagetyperesist, equippable, floater, inspectable, and colouraddersync.
Usage example
local inst = CreateEntity()
inst.entity:AddTransform()
inst.entity:AddAnimState()
inst.entity:AddNetwork()
MakeInventoryPhysics(inst)
inst:AddTag("lunarplant")
inst:AddComponent("armor")
inst.components.armor:InitCondition(TUNING.ARMOR_LUNARPLANT, TUNING.ARMOR_LUNARPLANT_ABSORPTION)
inst:AddComponent("planardefense")
inst.components.planardefense:SetBaseDefense(TUNING.ARMOR_LUNARPLANT_PLANAR_DEF)
inst:AddComponent("damagereflect")
inst.components.damagereflect:SetReflectDamageFn(ReflectDamageFn)
inst:AddComponent("equippable")
inst.components.equippable.equipslot = EQUIPSLOTS.BODY
inst.components.equippable:SetOnEquip(onequip)
inst.components.equippable:SetOnUnequip(onunequip)
Dependencies & tags
Components used: armor, planardefense, damagereflect, damagetyperesist, equippable, floater, inspectable, inventoryitem, colouraddersync, highlightchild, follower, setbonus
Tags added: lunarplant, gestaltprotection, show_broken_ui, plantkin (conditional), bramble_resistant (husk only)
Tags checked: shadow_aligned, plantkin, broken, debuffed, debuffable
Properties
No public properties are exposed directly by this prefab. Internal state is managed via components and local closure variables.
Main functions
ReflectDamageFn(inst, attacker, damage, weapon, stimuli, spdamage)
- Description: Calculates damage reflection values for the lunar plant armor, providing planar damage against shadow-aligned and general attackers.
- Parameters:
inst(Entity) — the armor entity.
attacker(Entity or nil) — the entity causing damage.
damage(number) — the incoming damage amount.
weapon,stimuli,spdamage— unused parameters for signature compatibility. - Returns: Two values:
0— no normal damage is reflected (planar only).- Table containing key
planarwith value determined byattacker’sshadow_alignedtag andTUNING.ARMOR_LUNARPLANT_REFLECT_PLANAR_DMGconstants.
OnBlocked(inst, owner)
- Description: Plays a sound effect when the wearer blocks an attack.
- Parameters:
inst(Entity) — the armor entity.
owner(Entity) — the wearer. - Returns: Nothing.
OnHit_Vines(owner, data)
- Description: Applies a debuff (
wormwood_vined_debuff) to attackers if thewormwood_allegiance_lunar_plant_gear_1skill is activated. - Parameters:
owner(Entity) — the armor wearer.
data(table or nil) — event data containingattacker. - Returns: Nothing.
OnEnabledSetBonus(inst)
- Description: Adds
lunar_aligneddamage resistance when the lunar plant set bonus is active. - Parameters:
inst(Entity) — the armor entity. - Returns: Nothing.
OnDisabledSetBonus(inst)
- Description: Removes
lunar_aligneddamage resistance when the set bonus is deactivated. - Parameters:
inst(Entity) — the armor entity. - Returns: Nothing.
onequip(inst, owner)
- Description: Executed when the armor is equipped. Applies visual overrides, attaches glow FX, enables blocking events, and sets light override on the wearer.
- Parameters:
inst(Entity) — the armor entity.
owner(Entity) — the new wearer. - Returns: Nothing.
onunequip(inst, owner)
- Description: Executed when the armor is unequipped. Clears overrides, removes events and FX, and resets light override.
- Parameters:
inst(Entity) — the armor entity.
owner(Entity) — the previous wearer. - Returns: Nothing.
OnBroken(inst)
- Description: Disables equippability, changes animation to "broken", updates UI string, and adds
brokentag. - Parameters:
inst(Entity) — the armor entity. - Returns: Nothing.
OnRepaired(inst)
- Description: Restores equippability, resets animation, and removes
brokentag and UI override. - Parameters:
inst(Entity) — the armor entity. - Returns: Nothing.
OnAttackOther(owner, data, inst)
- Description (husk variant): Counts hits; if threshold is met and skill is active, triggers thorn effect.
- Parameters:
owner(Entity) — armor wearer.
data(table) — attack event data.
inst(Entity) — the armor entity. - Returns: Nothing.
OnHuskBlocked(owner, data, inst)
- Description (husk variant): Triggers thorn effect on block if cooldown is free and not redirected.
- Parameters: Same as above.
- Returns: Nothing.
DoThorns(inst, owner)
- Description (husk variant): Spawns thorn FX, plays sound, and starts cooldown.
- Parameters: Same as above.
- Returns: Nothing.
Events & listeners
-
Listens to:
blocked(onowner) — triggersOnBlockedandOnHuskBlocked.
attacked(onowner, husk variant only) — triggersOnHuskBlocked.
onattackother(onowner, husk variant only) — triggersOnAttackOther.
onreflectdamage(oninst) — triggersOnReflectDamage.
skinhashdirty(on glow FX, non-dedicated) — triggersglow_skinhashdirty.
onremove(oninstfor glow FX children viacolouradder:AttachChild) — cleanup listener. -
Pushes:
equipskinneditem,unequipskinneditem— fired during equip/unequip when using skins.
Events from child FX (onreflectdamage) — internally re-fires viaOnReflectDamage.