Skip to content

Class

BuildCost

Generated GDScript class reference for GridPlacement.BuildCost.

Status
Current
Version
v6.0
Source updated
Active v6.0 guide line from Grid Placement repo
Generated on
2026-09-01

Records what was spent to build a placed instance (5.1.0-D refund contract). Stamped onto the placed [Manipulatable]'s metadata under [constant META_KEY] at placement time (stamping is consumer-owned — see the integration guide), then read back by [Refunder] consumers at [signal ManipulationState.pre_demolish] time so refund logic has a canonical "what was paid" record. The canonical cost shape is keyed by [StringName] IDs, not [Resource] references: the consumer's inventory system owns the id -> Resource mapping.

Source: addons/grid_placement/resources/build_cost.gd

Syntax

class BuildCost extends Resource

Members

NameKindSummary
META_KEYFieldNamespaced meta-key for stamping onto a Manipulatable. Reference this constant rather than hardcoding the string to avoid collisions with consumer metadata. Underscore-namespaced because Object.set_meta only accepts valid ASCII identifiers (a ':' separator is rejected). Uses the "placement" prefix per the plugin's public naming convention.
entriesPropertyItem entries: Array[Dictionary] of {id: StringName, quantity: int}. Generic — the consumer maps each id to whatever their inventory system uses (Resource, item database, runtime registry, etc).
currencyPropertyNon-item currency: Dictionary keyed by StringName currency id with numeric amounts.
source_resourcePropertyReference back to the resource that produced this cost (e.g. the ScenePlacementEntry that defined it). Optional; informational only — refunders do not branch on this.
resolve_forMethod
from_costsMethod
from_pairsMethod
from_resource_stacksMethod
multipliedMethod