feat: add versioned simulation state records
This commit is contained in:
@@ -75,6 +75,20 @@ func extract(requested_amount: float = yield_per_action) -> float:
|
||||
$Visual.visible = false
|
||||
return extracted
|
||||
|
||||
func restore_persistent_state(
|
||||
saved_amount: float,
|
||||
saved_reserved_by: int,
|
||||
saved_enabled: bool
|
||||
) -> void:
|
||||
amount_remaining = maxf(saved_amount, 0.0)
|
||||
reserved_by = saved_reserved_by if amount_remaining > 0.0 else -1
|
||||
enabled = saved_enabled
|
||||
amount_changed.emit(node_id, amount_remaining)
|
||||
reservation_changed.emit(node_id, reserved_by)
|
||||
if has_node("Visual"):
|
||||
$Visual.visible = not (hide_visual_when_depleted and is_depleted())
|
||||
_update_debug_label()
|
||||
|
||||
func _update_debug_label(_a = null, _b = null) -> void:
|
||||
if not has_node("DebugLabel"):
|
||||
return
|
||||
@@ -92,6 +106,9 @@ static func get_by_id(node_id: StringName) -> ResourceNode:
|
||||
return node
|
||||
return null
|
||||
|
||||
static func get_all() -> Array[ResourceNode]:
|
||||
return _all.duplicate()
|
||||
|
||||
static func find_available(action: StringName, agent_id: int, from_position: Vector3) -> ResourceNode:
|
||||
var best: ResourceNode
|
||||
var best_dist := INF
|
||||
|
||||
Reference in New Issue
Block a user