Papereraser
Based on game build 714014 | Last updated: 2026-03-03
Overview
PaperEraser is a utility component that allows an entity (typically a tool or character) to transform erasable paper items into their erased variants. It is designed to be attached to items (e.g., erasers) and works in conjunction with the ErasablePaper component on the paper entity. The component primarily provides a DoErase method that delegates to the target paper’s DoErase function and reports success via a boolean return.
Usage example
local eraser = SpawnPrefab("eraser")
eraser:AddComponent("papereraser")
-- Later, to erase a paper item:
local paper = SpawnPrefab("papyrus")
local success = eraser.components.papereraser:DoErase(paper, player)
if success then
print("Paper was successfully erased!")
end
Dependencies & tags
Components used: None directly — relies on the target paper having the erasablepaper component.
Tags: Adds papereraser on instantiation; removes it when the component is removed from the entity.
Properties
No public properties. Instance variables stacksize and erased_prefab are commented out in the constructor and not used.
Main functions
DoErase(paper, doer)
- Description: Attempts to erase the given
paperentity using this eraser entity. Calls theDoErasemethod on the paper’serasablepapercomponent and returns whether the operation succeeded (i.e., produced a valid result). - Parameters:
paper(Entity) — The entity representing the erasable paper to be erased. Must have theerasablepapercomponent.doer(Entity) — The entity performing the erasure (e.g., the player).
- Returns:
trueiferasablepaper:DoErase(...)returns a non-nilvalue (i.e., the erase succeeded and returned a new item).falseotherwise (e.g., iferasablepaperis missing or the spawn failed).
- Error states: No explicit error handling — the call silently fails if the
erasablepapercomponent is missing orDoErasereturnsnil.
Events & listeners
None identified.