add readme and change some scripts
This commit is contained in:
parent
239c879649
commit
6474c2fd8c
15 changed files with 265 additions and 231 deletions
|
|
@ -1,34 +0,0 @@
|
|||
import GameCommon from '../common/GameCommon.js'
|
||||
import { logger } from '../common/Util.js'
|
||||
import GameStorage from '../server/GameStorage.js'
|
||||
|
||||
const log = logger('fix_tiles.js')
|
||||
|
||||
function fix_tiles(gameId) {
|
||||
GameStorage.loadGame(gameId)
|
||||
let changed = false
|
||||
const tiles = GameCommon.getTilesSortedByZIndex(gameId)
|
||||
for (let tile of tiles) {
|
||||
if (tile.owner === -1) {
|
||||
const p = GameCommon.getFinalTilePos(gameId, tile.idx)
|
||||
if (p.x === tile.pos.x && p.y === tile.pos.y) {
|
||||
// log.log('all good', tile.pos)
|
||||
} else {
|
||||
log.log('bad tile pos', tile.pos, 'should be: ', p)
|
||||
tile.pos = p
|
||||
GameCommon.setTile(gameId, tile.idx, tile)
|
||||
changed = true
|
||||
}
|
||||
} else if (tile.owner !== 0) {
|
||||
tile.owner = 0
|
||||
log.log('unowning tile', tile.idx)
|
||||
GameCommon.setTile(gameId, tile.idx, tile)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
GameStorage.persistGame(gameId)
|
||||
}
|
||||
}
|
||||
|
||||
fix_tiles(process.argv[2])
|
||||
Loading…
Add table
Add a link
Reference in a new issue