Pillow Common
Based on game build 714014 | Last updated: 2026-03-06
Overview
pillow_common is a utility module that exports a DoKnockback function for applying knockback to entities. It checks for tags that prevent knockback (epic, nopush), reads optional defense values from equipped body armor, and computes the final knockback strength and radius. It then fires a knockback event on the target entity with computed parameters. This module is intended for reuse across prefabs that need consistent knockback behavior, especially those involving pillow-related mechanics.
Usage example
local pillow_common = require("prefabs/pillow_common")
local function OnHitTarget(target, source)
if pillow_common.DoKnockback(target, source, { amount = 0.75, strengthmult = 1.2 }) then
-- knockback was applied successfully
else
-- knockback was blocked by tag
end
end
Dependencies & tags
Components used: inventory (to retrieve BODY slot item and its _defense_amount)
Tags: Reads epic, nopush (prevents knockback); checks bodypillow on equipped body item.
Properties
No public properties
Main functions
DoKnockback(target, source, knockback_data)
- Description: Applies knockback to
target, accounting for tags that block knockback and defense from equipped items. Fires aknockbackevent on the target with the computed knockback parameters. - Parameters:
target(entity) — the entity to be knocked back.source(entity) — the entity applying the knockback.knockback_data(table, optional) — contains optional fields:amount(number, default0.5),strengthmult(number, default1).
- Returns:
trueif knockback was applied,falseif blocked by anepicornopushtag. - Error states: Returns
falseand does nothing iftargethas either theepicornopushtag. Iftargetlacks an inventory component or no body item is equipped, defense is treated as0.
Events & listeners
- Pushes:
knockback— fired on the target entity with payload:{ knocker = source, radius = number, strengthmult = number, forcelanded = boolean }. - Listens to: None.