Class RefundService
- Namespace
- GridPlacement.GDScript
- Assembly
- MoonBark.GridPlacement.GDScript.dll
Scene-free refund service for the 5.1 refund contract (6.0.0-S).\n\nExtracted from [RefundSystem] (now deprecated). Owns the pure refund logic — resolve a container, compute refund amounts via [RefundCalculator], and apply them through the canonical id interface. No tree dependency.\n\nEmbed in a [Refunder], wrap in a host service, or use standalone. The inner [code]_CalculatorRefunder[/code] adapter bridges this service into the [ManipulationState.refunders] array so the manipulation pipeline calls [method on_pre_demolish] during demolish.
class RefundService extends Refunder
Properties
refund_ratio
Fraction of the original cost returned on demolish (demo default: half).
var refund_ratio: float = 0.5
rounding
Rounding policy for fractional refund amounts.
var rounding: RefundCalculator.Rounding = RefundCalculator.Rounding.ROUND
locator
Locates the materials container under the placement owner root (the same locator pattern the spend rules use). Bootstrap code can set [member container_override] directly instead.
var locator: NodeLocator
container_override
Code-settable container override. When set, wins over [member locator].
var container_override: Node
service
Adapter bridging the RefCounted service into the Node-based refunders array.
var service: RefundService
container
var container = _resolve_container()
calculator
var calculator = RefundCalculator.new(refund_ratio, rounding)
issues
var issues: Array[String] = []
owner_root
var owner_root: Node = _targeting_state.get_owner_root() if _targeting_state != null else null
Methods
on_pre_demolish
func on_pre_demolish(_p_target: Manipulatable, p_cost: BuildCost) -> bool:
Parameters
_p_targetp_cost
Returns
configure
func configure( p_manipulation_state: ManipulationState,
register
func register() -> void:
Returns
unregister
func unregister() -> void:
Returns
refund
func refund(p_cost: BuildCost) -> Dictionary[StringName, int]:
Parameters
p_cost
Returns
get_runtime_issues
func get_runtime_issues() -> Array[String]: