mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-20 06:51:42 +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()
|
||||
})
|
||||
|
||||
describe('actions', () => {
|
||||
function waitSpawnZone (bot, view) {
|
||||
const nbChunksExpected = (view * 2) * (view * 2)
|
||||
let c = 0
|
||||
return new Promise(resolve => {
|
||||
const listener = () => {
|
||||
c++
|
||||
if (c === nbChunksExpected) {
|
||||
bot.removeListener('chunkColumnLoad', listener)
|
||||
resolve()
|
||||
}
|
||||
function waitSpawnZone (bot, view) {
|
||||
const nbChunksExpected = (view * 2) * (view * 2)
|
||||
let c = 0
|
||||
return new Promise(resolve => {
|
||||
const listener = () => {
|
||||
c++
|
||||
if (c === nbChunksExpected) {
|
||||
bot.removeListener('chunkColumnLoad', listener)
|
||||
resolve()
|
||||
}
|
||||
bot.on('chunkColumnLoad', listener)
|
||||
})
|
||||
}
|
||||
}
|
||||
bot.on('chunkColumnLoad', listener)
|
||||
})
|
||||
}
|
||||
|
||||
describe('actions', () => {
|
||||
test('can dig', async () => {
|
||||
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
|
||||
})
|
||||
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')
|
||||
let [, newBlock] = await once(bot, 'blockUpdate:' + new Vec3(1, 2, 3), {array: true})
|
||||
expect(newBlock.type).toEqual(95)
|
||||
|
|
|
|||
Loading…
Reference in a new issue