tools: name players through player.setname, and the character groups and four fault classes (#23)
This commit is contained in:
@@ -26,9 +26,9 @@ async function mutate(client, payload) {
|
||||
client.waitFor((m, i) => i >= from && pred(m), ms) }
|
||||
}
|
||||
|
||||
async function namedPlayer(stateDir, gm, name) {
|
||||
async function namedPlayer(origin, gm, name) {
|
||||
const player = await createPlayer(gm.ws)
|
||||
await namePlayer(stateDir, player.id, name)
|
||||
await namePlayer(origin, player.key, name)
|
||||
return player
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ const frameOf = (ws, id) => [...ws.messages].reverse().find(m => m.t === 'token'
|
||||
test('token.resize: a per-token size, null back to the scene default, and the codes of 6.1', async () => {
|
||||
await withGmServer(async (s, gmKey) => {
|
||||
const gm = await gmConnect(s.origin, gmKey)
|
||||
const alice = await namedPlayer(s.stateDir, gm, 'Alice')
|
||||
const alice = await namedPlayer(s.origin, gm, 'Alice')
|
||||
const tok = await gm.ws.request({ t: 'token.create', scene: gm.sceneId, kind: 'pc',
|
||||
pos: [400, 400], descriptive_name: 'Alice',
|
||||
actual_name: 'Alice', controller: alice.id,
|
||||
@@ -82,7 +82,7 @@ test('grow push and squeeze (5.6): pushed clear of a wall, or flagged squeezed w
|
||||
async () => {
|
||||
await withGmServer(async (s, gmKey) => {
|
||||
const gm = await gmConnect(s.origin, gmKey)
|
||||
const alice = await namedPlayer(s.stateDir, gm, 'Alice')
|
||||
const alice = await namedPlayer(s.origin, gm, 'Alice')
|
||||
// a 40 px corridor at x in [500, 540]: a token of r=15 fits, r=25 does not
|
||||
const left = await gm.ws.request({ t: 'wall.add', scene: gm.sceneId, a: [500, 0], b: [500, 900],
|
||||
kind: 'wall' })
|
||||
@@ -140,7 +140,7 @@ test('stuck from a wall and from a GM placement, cleared by the removal and by a
|
||||
async () => {
|
||||
await withGmServer(async (s, gmKey) => {
|
||||
const gm = await gmConnect(s.origin, gmKey)
|
||||
const alice = await namedPlayer(s.stateDir, gm, 'Alice')
|
||||
const alice = await namedPlayer(s.origin, gm, 'Alice')
|
||||
const tok = await gm.ws.request({ t: 'token.create', scene: gm.sceneId, kind: 'pc',
|
||||
pos: [1000, 1000], descriptive_name: 'Alice',
|
||||
actual_name: 'Alice', controller: alice.id,
|
||||
@@ -190,7 +190,7 @@ test('stuck from a wall and from a GM placement, cleared by the removal and by a
|
||||
test('status.set and status.clear: the GM source, single entries, and the codes of 6.1', async () => {
|
||||
await withGmServer(async (s, gmKey) => {
|
||||
const gm = await gmConnect(s.origin, gmKey)
|
||||
const alice = await namedPlayer(s.stateDir, gm, 'Alice')
|
||||
const alice = await namedPlayer(s.origin, gm, 'Alice')
|
||||
const tok = await gm.ws.request({ t: 'token.create', scene: gm.sceneId, kind: 'pc', pos: [400, 400],
|
||||
descriptive_name: 'Alice', actual_name: 'Alice',
|
||||
controller: alice.id, flags: { vision: true } })
|
||||
@@ -252,7 +252,7 @@ test('status.set and status.clear: the GM source, single entries, and the codes
|
||||
test('prop.set / prop.unset: three buckets, the caps, and who may read which bucket', async () => {
|
||||
await withGmServer(async (s, gmKey) => {
|
||||
const gm = await gmConnect(s.origin, gmKey)
|
||||
const alice = await namedPlayer(s.stateDir, gm, 'Alice')
|
||||
const alice = await namedPlayer(s.origin, gm, 'Alice')
|
||||
const tok = await gm.ws.request({ t: 'token.create', scene: gm.sceneId, kind: 'pc', pos: [400, 400],
|
||||
descriptive_name: 'Alice', actual_name: 'Alice',
|
||||
controller: alice.id, flags: { vision: true } })
|
||||
@@ -278,7 +278,7 @@ test('prop.set / prop.unset: three buckets, the caps, and who may read which buc
|
||||
assert.equal(playerFrame.props.gm, undefined)
|
||||
|
||||
// a bystander sees the public bucket only
|
||||
const bob = await namedPlayer(s.stateDir, gm, 'Bob')
|
||||
const bob = await namedPlayer(s.origin, gm, 'Bob')
|
||||
await gm.ws.request({ t: 'token.create', scene: gm.sceneId, kind: 'pc', pos: [420, 400],
|
||||
descriptive_name: 'Bob', actual_name: 'Bob', controller: bob.id,
|
||||
flags: { vision: true } })
|
||||
@@ -363,7 +363,7 @@ test('restart: sizes, props and statuses come back with the same view', async ()
|
||||
let saved
|
||||
try {
|
||||
const gm = await gmConnect(s.origin, gmKey)
|
||||
const alice = await namedPlayer(stateDir, gm, 'Alice')
|
||||
const alice = await namedPlayer(s.origin, gm, 'Alice')
|
||||
const tok = await gm.ws.request({ t: 'token.create', scene: gm.sceneId, kind: 'pc',
|
||||
pos: [400, 400], descriptive_name: 'Alice',
|
||||
actual_name: 'Alice', controller: alice.id,
|
||||
|
||||
Reference in New Issue
Block a user