Pure refund math for the 5.1 refund contract. No node, no scene dependencies — embed it in a RefundService, a custom Refunder, or any consumer script. Given a resolved BuildCost, computes id -> refund amount at refund_ratio and optionally applies it to a container through the canonical id interface (try_add_by_id).
Source: addons/grid_placement/systems/manipulation/refund_calculator.gd
Syntax
class RefundCalculator extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
refund_ratio | Property | How fractional refund amounts are converted to whole items. Fraction of the original cost returned on demolish (1.0 = full refund). Values above 1.0 would pay more than the build cost, so construction clamps them to 1.0 with an error; negatives produce no refund. |
rounding | Property | Rounding policy applied per entry after the ratio multiply. |
calculate | Method | |
apply_to | 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