feat: derive capable opportunity helpers
This commit is contained in:
@@ -66,7 +66,21 @@ static func from_dictionary(record_data: Dictionary) -> ResourceStateRecord:
|
||||
var action_id := StringName(record_data["action_id"])
|
||||
if not action_id.is_empty() and SimulationDefinitions.get_action(action_id) == null:
|
||||
return null
|
||||
return ResourceStateRecord.new(record_data)
|
||||
var normalized := record_data.duplicate(true)
|
||||
normalized["schema_version"] = SCHEMA_VERSION
|
||||
normalized["node_id"] = String(record_data["node_id"])
|
||||
normalized["action_id"] = String(record_data["action_id"])
|
||||
normalized["resource_id"] = String(record_data["resource_id"])
|
||||
normalized["amount_remaining"] = float(record_data["amount_remaining"])
|
||||
normalized["yield_per_action"] = float(record_data["yield_per_action"])
|
||||
normalized["reserved_by"] = int(record_data["reserved_by"])
|
||||
normalized["enabled"] = bool(record_data["enabled"])
|
||||
normalized["can_npcs_use"] = bool(record_data["can_npcs_use"])
|
||||
normalized["can_player_use"] = bool(record_data["can_player_use"])
|
||||
normalized["safety_risk"] = float(record_data["safety_risk"])
|
||||
normalized["comfort_distance"] = float(record_data["comfort_distance"])
|
||||
normalized["discovery_priority"] = float(record_data["discovery_priority"])
|
||||
return ResourceStateRecord.new(normalized)
|
||||
|
||||
|
||||
static func _migrate_v1(legacy_data: Dictionary) -> Dictionary:
|
||||
|
||||
Reference in New Issue
Block a user