feat: GM characters, reveals, who-sees-it and seen_by (#75)
Server: GM token frames gain the additive, GM-only seen_by:[player ids], computed from each player's existing sight (PlayerVision.visibleTo) with no extra polygon pass. Leakcheck BannedAlways bans seen_by; a seenBy fault build is caught as exactly WALLDATA. proto stays 2 (6.2 additive). Client: new cast slice parses character/character_gone/encountered frames and seen_by; gmcast panel adds character create/rename/assign/remove, reveal to one/all, encountered forget (grey entries only) and the who-sees-it list (0/100 in M4). Mounted beside the #74 admin panel. Docs: DESIGN 5.9/6.1/6.2/7.4 record the round-1 shape and the no-bump call. Gates: devbox run test, client-test, e2e green; bench recorded.
This commit is contained in:
+18
-1
@@ -59,7 +59,7 @@ proc keysDeep(node: JsonNode): HashSet[string] =
|
||||
|
||||
const ForbiddenToPlayers = ["walls", "wall", "wall_gone", "a", "b", "open", "kind", "controller",
|
||||
"gm_only", "flags", "descriptive_name", "actual_name", "reveal_all",
|
||||
"revealed", "source", "radius_own", "extra"]
|
||||
"revealed", "source", "radius_own", "extra", "seen_by"]
|
||||
|
||||
suite "GM view (3.1: everything, with the GM-only extras)":
|
||||
test "every token, in token order, with controller and both names":
|
||||
@@ -83,6 +83,23 @@ suite "GM view (3.1: everything, with the GM-only extras)":
|
||||
let view = gmView(ctxOf(sc, @[tok("a", 100, 100, 0)], @[Pid]))
|
||||
check gmTokenFrame(view.tokens[0])["controller"].kind == JNull
|
||||
|
||||
test "seen_by lists the players whose existing sight sees each token, ascending":
|
||||
let sc = sceneWith(@[])
|
||||
let tokens = @[tok("mine", 400, 400, Pid),
|
||||
tok("near", 600, 400, Other),
|
||||
tok("secret", 500, 500, 0, gmOnly = true),
|
||||
tok("secret-mine", 500, 600, Pid, gmOnly = true),
|
||||
tok("far", 3000, 3000, Other)]
|
||||
let view = gmView(ctxOf(sc, tokens, @[Pid, Other]))
|
||||
let seen = view.tokens.mapIt(it.seenBy)
|
||||
check seen == @[@[Pid, Other], # Pid controls it; Other's sight reaches it
|
||||
@[Pid, Other], # Other controls it; Pid's sight reaches it
|
||||
newSeq[int](), # gm_only and GM-controlled: nobody sees it
|
||||
@[Pid], # gm_only, but its controller always sees it
|
||||
@[Other]] # out of Pid's sight; its controller sees it
|
||||
let frame = gmTokenFrame(view.tokens[0])
|
||||
check frame["seen_by"] == %*[Pid, Other]
|
||||
|
||||
test "the GM never gets vision polygons or explored cells":
|
||||
let sc = sceneWith(@[])
|
||||
var known: Known
|
||||
|
||||
Reference in New Issue
Block a user