Files
windroost/p2_godot_sample/scripts/side_systems_parity.gd
T
wushenghua f1f2c31a94 feat: side systems runtime — partners/records/black market (L5 runtime)
Continued FULL_GAME_GOAL. The three side systems had authored content but no
runtime, so none of their numbers were actually used. Added a Python-authoritative
engine and a GDScript mirror (parity gate over 3 profile tiers) plus a real UI.

- 5 partners: tiered low-pressure tasks derived from play counters (distance,
  relics, records, wins, new skies), no combat and no failure penalty, claim
  once per tier for gold/crystal.
- 167 records: progress from play counters, stage rewards every third record,
  one-time claims, no miss penalty or daily streak; list shows claimable
  milestones and X/167 progress.
- 6 black-market offers: crystal-only purchases (relic/emblem/material/cosmetic/
  time/recovery), no pay-to-win; insufficient balance is a clean rejection.
- Skyport 旅团事务 page with three tabs; claims/purchases route through the
  real engines and persist. Added battle_wins/total_gold_earned/partner_claims/
  revive_charges/cosmetics profile fields with normalization, and victory now
  increments the win/earned counters in both slice and world flows.
- side_systems_ui_test drives tabs/claims/purchases/locale through real hooks;
  registered alongside parity in the full gate. Added p3a_side capture and
  ignored regenerated artifact files.

All gates pass incl. 25 UI captures; P2_CHECKS_PASS. prototype/ untracked.
2026-11-18 16:36:17 +08:00

58 lines
2.0 KiB
GDScript

extends SceneTree
## GDScript half of the side-systems parity gate. Reads fixtures produced by
## tools/fullgame/check_side_systems_parity.py and emits comparable JSON.
const SideSystems = preload("res://scripts/side_systems.gd")
const WorldContent = preload("res://scripts/world_content.gd")
func _init() -> void:
_run.call_deferred()
func _read_json(path: String) -> Variant:
var file := FileAccess.open(path, FileAccess.READ)
if file == null:
return null
var parsed = JSON.parse_string(file.get_as_text())
file.close()
return parsed
func _write_json(path: String, data: Variant) -> void:
var file := FileAccess.open(path, FileAccess.WRITE)
if file != null:
file.store_string(JSON.stringify(data, "\t", true))
file.close()
func _run() -> void:
var fixture = _read_json(ProjectSettings.globalize_path("res://artifacts/side_systems_fixtures.json"))
if fixture == null:
print("SIDE_PARITY_GD_FAIL missing fixtures")
quit(1)
return
var pack := WorldContent.content()
var out: Array = []
for entry in fixture:
var profile: Dictionary = (entry as Dictionary).duplicate(true)
var record_id := str(profile.get("_claim_record_id", ""))
profile.erase("_claim_record_id")
var res := {
"metrics": SideSystems.metrics(profile),
"partners": SideSystems.partner_status(profile, pack.get("partners", [])),
"records": SideSystems.record_status(profile, pack.get("records", [])),
"market": SideSystems.market_status(profile, pack.get("market", [])),
}
var claim_p := SideSystems.claim_partner(profile, "P01")
var claim_r := SideSystems.claim_record(profile, record_id, pack.get("records", []))
var buy1 := SideSystems.purchase(profile, "M01", pack)
var buy2 := SideSystems.purchase(profile, "M05", pack)
res["claims"] = {"partner": claim_p, "record": claim_r, "market1": buy1, "market2": buy2}
res["profile_after"] = profile
out.append(res)
_write_json(ProjectSettings.globalize_path("res://artifacts/side_systems_gd.json"), out)
print("SIDE_PARITY_GD_PASS %d profiles" % out.size())
quit(0)