feat(client): id helper + leaf canon-log entities with owned invariants
Also configure GUT to not treat push_error() as a test failure (client/.gutconfig.json: failure_error_types = [engine, gut]). The brief's LogPlayer/Quest setters intentionally push_error() on rejected input; GUT's default failure_error_types includes push_error, which would fail test_player_rejects_unknown_class and test_quest_status_enum despite their assertions passing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
24
client/scripts/canon_log/humiliation.gd
Normal file
24
client/scripts/canon_log/humiliation.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
class_name Humiliation
|
||||
extends RefCounted
|
||||
## A Banter-memory row (charter §9). weight 1..10 drives reference frequency;
|
||||
## turn drives decay. Append-only at the container level — these stack.
|
||||
|
||||
var id: String
|
||||
var text: String
|
||||
var weight: int
|
||||
var turn: int
|
||||
|
||||
|
||||
func _init(p_id := "", p_text := "", p_weight := 1, p_turn := 0) -> void:
|
||||
id = p_id
|
||||
text = p_text
|
||||
weight = clampi(p_weight, 1, 10)
|
||||
turn = maxi(p_turn, 0)
|
||||
|
||||
|
||||
func to_dict() -> Dictionary:
|
||||
return {"id": id, "text": text, "weight": weight, "turn": turn}
|
||||
|
||||
|
||||
static func from_dict(d: Dictionary) -> Humiliation:
|
||||
return Humiliation.new(d.get("id", ""), d.get("text", ""), int(d.get("weight", 1)), int(d.get("turn", 0)))
|
||||
Reference in New Issue
Block a user