class_name LogPlayer extends RefCounted ## A canon-log player row. Carries ONLY name, race_id, calling_id, luck_descriptor ## (§7): no numeric Luck, no attributes — those live in GameState and never reach the ## AI. race_id is here because the Narrator and NPCs must be able to describe the ## player ("a beastfolk cutpurse"); the mechanical sheet must not. var name: String var race_id: String var calling_id: String var luck_descriptor: String func _init(p_name := "", p_race_id := "", p_calling_id := "", p_luck_descriptor := "") -> void: name = p_name luck_descriptor = p_luck_descriptor if p_race_id != "": set_race_id(p_race_id) if p_calling_id != "": set_calling_id(p_calling_id) func set_race_id(v: String) -> bool: if not Races.exists(v): push_error("invalid race_id: %s" % v) return false race_id = v return true func set_calling_id(v: String) -> bool: if not Callings.exists(v): push_error("invalid calling_id: %s" % v) return false calling_id = v return true func to_dict() -> Dictionary: return {"name": name, "race_id": race_id, "calling_id": calling_id, "luck_descriptor": luck_descriptor} static func from_dict(d: Dictionary) -> LogPlayer: return LogPlayer.new(d.get("name", ""), d.get("race_id", ""), d.get("calling_id", ""), d.get("luck_descriptor", ""))