feat(play): hide NPC tokens from the player screen

A token can be hidden per session from the control menu. The GM still sees it, and its path keeps moving. Scene editor grid labels no longer call a removed helper.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-10-02 10:15:32 +08:00
parent 060bbd471a
commit f6c301a12b
10 changed files with 165 additions and 23 deletions
+37 -15
View File
@@ -3499,6 +3499,24 @@ export function ControlApp() {
override?.disposition,
);
const inactive = Boolean(override?.inactive);
const hiddenFromPlayers = Boolean(override?.hiddenFromPlayers);
const hideFromPlayersItem = (
<button
type="button"
className={styles.ctxItem}
role="menuitem"
onClick={() => {
sceneNpcTokensApi.dispatch({
kind: 'setHiddenFromPlayers',
placementId: npcSessionCtxMenu.placementId,
hidden: !hiddenFromPlayers,
});
setNpcSessionCtxMenu(null);
}}
>
{hiddenFromPlayers ? t('npcs.showToPlayers') : t('npcs.hideFromPlayers')}
</button>
);
const path = placement.path;
const pathTarget = {
kind: 'npcToken' as const,
@@ -3509,21 +3527,24 @@ export function ControlApp() {
const pathVisible = Boolean(tokenPathSession?.presentationVisible[pathKey]);
if (inactive) {
return (
<button
type="button"
className={styles.ctxItem}
role="menuitem"
onClick={() => {
sceneNpcTokensApi.dispatch({
kind: 'setInactive',
placementId: npcSessionCtxMenu.placementId,
inactive: false,
});
setNpcSessionCtxMenu(null);
}}
>
{t('npcs.makeActive')}
</button>
<>
{hideFromPlayersItem}
<button
type="button"
className={styles.ctxItem}
role="menuitem"
onClick={() => {
sceneNpcTokensApi.dispatch({
kind: 'setInactive',
placementId: npcSessionCtxMenu.placementId,
inactive: false,
});
setNpcSessionCtxMenu(null);
}}
>
{t('npcs.makeActive')}
</button>
</>
);
}
const isSessionSpawn = Boolean(
@@ -3531,6 +3552,7 @@ export function ControlApp() {
);
return (
<>
{hideFromPlayersItem}
{isSessionSpawn ? (
<button
type="button"