Abstract base class for placement rules that spend id-keyed costs. Subclasses supply a provider (game-owned Object, see PlacementCostProvider) 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. Required provider contract: the PlacementCostProvider protocol, reported by get_setup_issues(). try_add_by_id is the rollback path.
Atomicity: if any id cannot be spent in full, every amount already removed is refunded via try_add_by_id before the failure is reported. Subclasses should not override apply() without preserving this contract.
This class is @abstract — instantiate SpendByIdRule or SpendMaterialsRuleById instead.
Source: addons/grid_placement/placement/placement_rules/template_rules/spend_cost_rule_base.gd
Syntax
class SpendCostRuleBase extends PlacementRuleMembers
| Name | Kind | Summary |
|---|---|---|
costs | Property | Item id -> amount that must be spent for placement to succeed. |
validate_placement | Method | |
apply | Method | |
tear_down | Method | |
get_setup_issues | Method | |
get_missing_costs | Method |