Chris' Tutorials
Docs/Grid Placement

Class

SpendCostRuleBase

Generated GDScript class reference for GridPlacement.SpendCostRuleBase.

StatusDraft
Versionv6.0
UpdatedDevelopment docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

Draft — Unreleased:This page is in active development. APIs, class names, and behavior may change before the release is finalized. Use it as a preview of what's coming — not as a stable integration target.

Abstract base class for placement rules that spend id-keyed costs. Subclasses supply a provider (duck-typed [Object]) and a [Dictionary] of [StringName] id -> [int] cost. The rule is agnostic about what the ids represent (currency, items, magic dust) — the game expresses its vocabulary by injecting the appropriate provider. [b]Required provider contract[/b] (enforced at runtime via [method get_setup_issues]):[br] [code]get_count_by_id(id: StringName) -> int[/code][br] [code]try_remove_by_id(id: StringName, amount: int) -> int[/code][br] [code]try_add_by_id(id: StringName, amount: int) -> int[/code] (rollback path)[br][br] [b]Atomicity[/b]: if any id cannot be spent in full, every amount already removed is refunded via [code]try_add_by_id[/code] before the failure is reported. Subclasses should not override [method apply] without preserving this contract.[br][br] This class is [code]@abstract[/code] — instantiate [SpendByIdRule] or [SpendMaterialsRuleById] instead.

Source: addons/grid_placement/placement/placement_rules/template_rules/spend_cost_rule_base.gd

Syntax

class SpendCostRuleBase extends PlacementRule

Members

NameKindSummary
costsPropertyItem id -> amount that must be spent for placement to succeed.
validate_placementMethod
missingProperty
failed_messageProperty
applyMethod
issuesProperty
spentProperty
removedProperty
tear_downMethod
get_setup_issuesMethod
issuesProperty
get_missing_costsMethod
missingProperty
haveProperty

Source

addons/grid_placement/placement/placement_rules/template_rules/spend_cost_rule_base.gd

Plugin docs root:gdscript/plugins/grid_placement_dev/docs