Sewing
Based on game build 714014 | Last updated: 2026-03-03
Overview
The sewing component provides a standardized method for repairing entities that require sewing (e.g., clothing or gear with the needssewing tag). It is typically attached to items like Sewing Kits. When DoSewing is called, it consumes the tool (either decrementing finite uses or removing a stack item) and restores fuel to the target via the fueled component. It also triggers achievement progression and custom post-sewing logic if defined.
Usage example
local inst = CreateEntity()
inst:AddComponent("sewing")
inst.components.sewing.repair_value = 25
-- Later, when the item repairs a target:
local success = inst.components.sewing:DoSewing(target_entity, player_entity)
Dependencies & tags
Components used: fueled, finiteuses, stackable
Tags: Checks needssewing on target; awards achievement sewing_kit via AwardPlayerAchievement.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
repair_value | number | 1 | The amount of fuel to add to the target entity. |
Main functions
DoSewing(target, doer)
- Description: Attempts to repair the given target entity by restoring fuel and consuming this sewing tool. Only succeeds if the target has the
needssewingtag. - Parameters:
target(Entity) — The entity to repair; must have afueledcomponent and theneedssewingtag.
doer(Entity) — The entity performing the repair; used for achievement attribution and event context. - Returns:
trueif repair was successful,nilotherwise. - Error states: Returns
nilsilently if the target lacks theneedssewingtag. If this component is attached to a tool with nofiniteusesorstackablecomponent, the tool is not consumed (though repair still succeeds, which may indicate a logic bug).
Events & listeners
- Listens to: None directly. Custom callback can be attached via
self.onsewn. - Pushes:
AwardPlayerAchievement("sewing_kit", doer)— triggers in-game achievement.