Skip to main content

Armor Grass

Based on game build 7140014 | Last updated: 2026-03-04

Overview

The armor_grass prefab represents the Grass Armor item, a light protective gear item crafted by players. It is implemented as a Prefab with core components attached in its constructor (fn): inventoryitem, fuel, armor, and equippable. It supports skin-swapping via GetSkinBuild() logic and integrates with the game’s sound and animation systems when equipped or unequipped. When equipped, it applies a body symbol override to the wearer and registers a listener for the blocked event to play armor impact sounds.

Usage example

local inst = Prefab("armorgrass", fn, assets)
-- This prefab is used internally by the game to spawn Grass Armor; modders typically reference it via prefabs.armorgrass

Dependencies & tags

Components used: inspectable, inventoryitem, fuel, armor, equippable, transform, animstate, network
Tags: Adds grass tag to the entity instance.

Properties

PropertyTypeDefault ValueDescription
foleysoundstring"dontstarve/movement/foley/grassarmour"Sound played during movement while wearing this armor.
components.fuel.fuelvaluenumberTUNING.LARGE_FUELFuel value used by the fuel component.
components.armor.conditionnumberTUNING.ARMORGRASSInitial durability of the armor.
components.armor.absorb_percentnumberTUNING.ARMORGRASS_ABSORPTIONPercentage of damage absorbed when blocked.
components.equippable.equipslotEQUIPSLOTS enumEQUIPSLOTS.BODYThe equipment slot this item occupies.

Main functions

onequip(inst, owner)

  • Description: Executed when the armor is equipped by an entity. Sets up animation symbol override for the body part, registers the blocked event listener, and handles skin-swapping events.
  • Parameters:
    inst (Entity) — the armor prefab instance being equipped.
    owner (Entity) — the entity equipping the armor.
  • Returns: Nothing.
  • Error states: If GetSkinBuild() returns nil, only the base animation override is applied; otherwise a skin-specific override and equipskinneditem event are used.

onunequip(inst, owner)

  • Description: Executed when the armor is unequipped. Clears animation overrides, removes the blocked event listener, and fires unequip skin events if applicable.
  • Parameters:
    inst (Entity) — the armor prefab instance being unequipped.
    owner (Entity) — the entity unequipping the armor.
  • Returns: Nothing.

OnBlocked(owner)

  • Description: Callback fired when the armor blocks damage. Plays a standard armor impact sound via the owner’s SoundEmitter.
  • Parameters:
    owner (Entity) — the entity wearing the armor that was struck.
  • Returns: Nothing.

Events & listeners

  • Listens to: blocked — fires OnBlocked(owner) when the armor blocks an attack.
  • Pushes (via owner): equipskinneditem, unequipskinneditem — only triggered if a skin build is present (GetSkinBuild() ~= nil).