chore(warnings): silence the four pre-existing script warnings the creation screen surfaced

Not errors and not regressions — Godot printed them on every script reload
and they predate M4-b. Cleared so a real warning is not lost in the noise:

- Redundant `const ContentDB`/`const NewGame` preloads that shadowed their
  own `class_name` globals (character_creation.gd, creation_draft.gd) — the
  class is already global, so the const bought nothing.
- Two `log` locals shadowing the built-in `log()` — renamed to `out`
  (canon_log.from_dict) and `canon` (NewGame.construct); the "log" dict KEY
  is the public contract and is unchanged.
- currency.format's copper->denomination division is integer BY DESIGN (the
  remainder is carried, not lost) — annotated `@warning_ignore` to say so.

319 client tests green; headless parse reports none of the four sites.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-14 20:09:29 -05:00
parent 63cbc8c16e
commit 8f3aa75fa9
5 changed files with 20 additions and 22 deletions

View File

@@ -99,17 +99,17 @@ static func from_dict(d: Dictionary) -> CanonLog:
if v != SCHEMA_VERSION:
push_error("unsupported canon_log schema_version: %s" % v)
return null
var log := CanonLog.new()
log.player = LogPlayer.from_dict(d.get("player", {}))
log.location = LogLocation.from_dict(d.get("location", {}))
var out := CanonLog.new()
out.player = LogPlayer.from_dict(d.get("player", {}))
out.location = LogLocation.from_dict(d.get("location", {}))
for m in d.get("party", []):
log.party.append(PartyMember.from_dict(m))
out.party.append(PartyMember.from_dict(m))
for e in d.get("recent_events", []):
log.push_event(e)
out.push_event(e)
for f in d.get("established_facts", []):
log.add_fact(f)
out.add_fact(f)
for q in d.get("active_quests", []):
log.active_quests.append(Quest.from_dict(q))
out.active_quests.append(Quest.from_dict(q))
for h in d.get("humiliations", []):
log.humiliations.append(Humiliation.from_dict(h))
return log
out.humiliations.append(Humiliation.from_dict(h))
return out

View File

@@ -58,31 +58,31 @@ static func construct(origin: Dictionary, world: ContentDB, creation: Dictionary
sheet.mp = sheet.max_mp()
state.sheet = sheet
var log := CanonLog.new()
log.player = LogPlayer.new(str(creation.get("name", "")), sheet.race_id,
var canon := CanonLog.new()
canon.player = LogPlayer.new(str(creation.get("name", "")), sheet.race_id,
sheet.calling_id, state.luck_descriptor())
var loc: Dictionary = world.location(origin["start_location_id"])
log.set_location(loc.get("id", ""), loc.get("name", ""))
canon.set_location(loc.get("id", ""), loc.get("name", ""))
var overrides: Dictionary = origin.get("disposition_overrides", {})
var companion_ids := {}
for c in world.companions():
companion_ids[c["id"]] = true
log.party.append(PartyMember.new(c["id"], c.get("name", ""), int(overrides.get(c["id"], 0))))
canon.party.append(PartyMember.new(c["id"], c.get("name", ""), int(overrides.get(c["id"], 0))))
for npc_id in overrides:
if not companion_ids.has(npc_id):
state.set_npc_disposition(npc_id, int(overrides[npc_id]))
for line in origin.get("situation", []):
log.push_event(line)
canon.push_event(line)
for fact in origin.get("opening_facts", []):
log.add_fact(fact)
canon.add_fact(fact)
var quest_id: Variant = origin.get("start_quest_id", null)
if quest_id != null:
var qd: Dictionary = world.quest(quest_id)
log.active_quests.append(Quest.new(qd.get("id", ""), qd.get("name", ""), "active",
canon.active_quests.append(Quest.new(qd.get("id", ""), qd.get("name", ""), "active",
qd.get("objective", "")))
# inventory grants -> game state (NOT the log). §2. grant() routes currency to the
@@ -90,7 +90,7 @@ static func construct(origin: Dictionary, world: ContentDB, creation: Dictionary
for g in origin.get("inventory_grants", []):
state.grant(g.get("item_id", ""), int(g.get("qty", 0)))
return {"ok": true, "errors": [], "log": log, "state": state}
return {"ok": true, "errors": [], "log": canon, "state": state}
static func roll_attributes(character_seed: int) -> Dictionary:

View File

@@ -31,10 +31,12 @@ static func format(copper: int) -> String:
return "0c"
var parts: Array[String] = []
var left := copper
var gold := left / GOLD # int division
@warning_ignore("integer_division") # denomination math — the remainder is carried, not lost
var gold := left / GOLD
if gold > 0:
parts.append("%dg" % gold)
left -= gold * GOLD
@warning_ignore("integer_division")
var silver := left / SILVER
if silver > 0:
parts.append("%ds" % silver)

View File

@@ -14,8 +14,6 @@ extends Control
signal creation_confirmed(creation: Dictionary)
const ContentDB = preload("res://scripts/content/content_db.gd")
## Shown under the CTA when the draft is legal. When it is NOT legal, the first
## validation error takes this slot instead — the player is told what is wrong, in
## the same place, in the same dry voice. §13: even the nag is content.

View File

@@ -14,8 +14,6 @@ extends RefCounted
## §7: LCK is not here. Not a field, not an accessor, not a key. It is rolled
## inside construct off the same seed, immediately after MAG, and never surfaces.
const NewGame = preload("res://scripts/newgame/new_game.gd")
var name: String = ""
var race_id: String = ""
var calling_id: String = ""