feat: unify authored activity commands

This commit is contained in:
Rijad Zuzo
2026-08-13 00:08:30 +02:00
parent e5aecee0de
commit b3b98c6456
36 changed files with 3013 additions and 96 deletions
+24 -1
View File
@@ -4,6 +4,8 @@ extends RefCounted
const SCHEMA_VERSION := 3
const POSITION_LEGACY_SCHEMA_VERSION := 2
const LEGACY_SCHEMA_VERSION := 1
const LEGACY_BLOCKED_WORLD_SCHEMA_MIN := 3
const LEGACY_BLOCKED_WORLD_SCHEMA_MAX := 15
var data: Dictionary
@@ -117,7 +119,17 @@ static func from_dictionary(record_data: Dictionary) -> EconomicEventRecord:
and not normalized["item_id"].is_empty()
and normalized["required_amount"] > 0.0
)
if version == SCHEMA_VERSION and not has_stable_contract:
var has_legacy_marker := (
(
StringName(normalized.get("blocked_contract_kind", &""))
== SimulationIds.BLOCKED_CONTRACT_LEGACY_UNSTRUCTURED
)
and (
int(normalized.get("legacy_world_schema_version", -1))
in range(LEGACY_BLOCKED_WORLD_SCHEMA_MIN, LEGACY_BLOCKED_WORLD_SCHEMA_MAX + 1)
)
)
if version == SCHEMA_VERSION and not has_stable_contract and not has_legacy_marker:
return null
return EconomicEventRecord.new(normalized)
@@ -160,5 +172,16 @@ func description(npc_names: Dictionary = {}) -> String:
return "%s was depleted" % source
"animal_fed":
return "%s fed %s %.0f %s" % [actor_name, destination, amount, item]
"activity_completed":
return (
"%s completed %s at %s (+%.1f %s)"
% [
actor_name,
String(data.get("action_id", "activity")).capitalize(),
source,
float(data.get("metric_delta", 0.0)),
String(data.get("metric_id", "benefit")),
]
)
_:
return "tick %d: %s" % [int(data["tick"]), event_type]