Appraisable
Based on game build 714014 | Last updated: 2026-03-20
Overview
Appraisable is a lightweight component that defines custom logic for appraisal interactions. It does not implement appraisal behavior itself but instead exposes two callback fields (canappraisefn and appraisefn) that prefab scripts must populate. This allows different entities to define unique conditions for when they can appraise a target and what occurs when the appraisal succeeds.
Usage example
local inst = CreateEntity()
inst:AddComponent("appraisable")
-- Define validation logic
inst.components.appraisable.canappraisefn = function(inst, target)
return target:IsValid() and not target:IsInLimbo()
end
-- Define action logic
inst.components.appraisable.appraisefn = function(inst, target)
inst.components.inspectable:ShowInspectionText(target)
end
-- Check and execute
if inst.components.appraisable:CanAppraise(target) then
inst.components.appraisable:Appraise(target)
end
Dependencies & tags
Components used: None identified. Tags: None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
canappraisefn | function | nil | Custom function to validate if a target can be appraised. |
appraisefn | function | nil | Custom function executed when an appraisal occurs. |
inst | entity | nil | The entity instance that owns this component. |
Main functions
CanAppraise(target)
- Description: Checks if the entity is allowed to appraise the specified target. If
canappraisefnis set, it calls that function; otherwise, it returnstrueby default. - Parameters:
target(entity) - The entity instance to evaluate for appraisal. - Returns:
boolean-trueif appraisal is allowed,falseotherwise. - Error states: Returns
trueifcanappraisefnis not defined.
Appraise(target)
- Description: Executes the appraisal action on the specified target. If
appraisefnis set, it calls that function; otherwise, nothing happens. - Parameters:
target(entity) - The entity instance to appraise. - Returns: Nothing.
- Error states: Silently exits if
appraisefnis not defined.
Events & listeners
None identified.