mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 19:50:40 +00:00
fix /setblock test, fix #344
This commit is contained in:
parent
60318c74e1
commit
3e172af693
1 changed files with 15 additions and 15 deletions
|
|
@ -112,22 +112,22 @@ squid.supportedVersions.forEach((supportedVersion, i) => {
|
||||||
await serv.quit()
|
await serv.quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('actions', () => {
|
function waitSpawnZone (bot, view) {
|
||||||
function waitSpawnZone (bot, view) {
|
const nbChunksExpected = (view * 2) * (view * 2)
|
||||||
const nbChunksExpected = (view * 2) * (view * 2)
|
let c = 0
|
||||||
let c = 0
|
return new Promise(resolve => {
|
||||||
return new Promise(resolve => {
|
const listener = () => {
|
||||||
const listener = () => {
|
c++
|
||||||
c++
|
if (c === nbChunksExpected) {
|
||||||
if (c === nbChunksExpected) {
|
bot.removeListener('chunkColumnLoad', listener)
|
||||||
bot.removeListener('chunkColumnLoad', listener)
|
resolve()
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bot.on('chunkColumnLoad', listener)
|
}
|
||||||
})
|
bot.on('chunkColumnLoad', listener)
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('actions', () => {
|
||||||
test('can dig', async () => {
|
test('can dig', async () => {
|
||||||
await Promise.all([waitSpawnZone(bot, 2), waitSpawnZone(bot2, 2), onGround(bot), onGround(bot2)])
|
await Promise.all([waitSpawnZone(bot, 2), waitSpawnZone(bot2, 2), onGround(bot), onGround(bot2)])
|
||||||
|
|
||||||
|
|
@ -244,7 +244,7 @@ squid.supportedVersions.forEach((supportedVersion, i) => {
|
||||||
serv.getPlayer('bot').op = true
|
serv.getPlayer('bot').op = true
|
||||||
})
|
})
|
||||||
test('can use /setblock', async () => {
|
test('can use /setblock', async () => {
|
||||||
await once(bot, 'chunkColumnLoad')
|
await Promise.all([waitSpawnZone(bot, 2), onGround(bot)])
|
||||||
bot.chat('/setblock 1 2 3 95 0')
|
bot.chat('/setblock 1 2 3 95 0')
|
||||||
let [, newBlock] = await once(bot, 'blockUpdate:' + new Vec3(1, 2, 3), {array: true})
|
let [, newBlock] = await once(bot, 'blockUpdate:' + new Vec3(1, 2, 3), {array: true})
|
||||||
expect(newBlock.type).toEqual(95)
|
expect(newBlock.type).toEqual(95)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue