Base class for rules that spend a cost when something is placed. Use SpendByIdRule or SpendMaterialsRuleById instead of this class. Costs are keyed by id, such as &"gold" or &"wood". What the ids mean is up to your game: it supplies a provider (see PlacementCostProvider) that checks and removes amounts. If any cost cannot be paid in full, everything already taken is given back and placement fails.
Source: addons/grid_placement/placement/placement_rules/template_rules/spend_cost_rule_base.gd
Syntax
class SpendCostRuleBase extends PlacementRuleMembers
| Name | Kind | Summary |
|---|---|---|
costs | Property | What placing costs: each id mapped to an amount. |
validate_placement | Method | |
apply | Method | |
tear_down | Method | |
get_setup_issues | Method | |
get_missing_costs | Method |
Guides that use this class
Tutorials built on Grid Placement
- Godot multiplayer grid placement: one host, four sessions
- Godot 2D grid building system: paint, place, save
- Godot 3D grid building system: the runtime loop
- Godot 4 grid-building plugins: build mode vs editor tools
- 3D room placement in Godot: build rooms and stack storeys
- 3D grid placement in Godot 4: full setup tutorial
- Snap to a TileMap in Godot: 2D grid placement
- How to make a farming system in Godot
- How to snap objects to a 3D grid in Godot