remove __createGameObject
This commit is contained in:
parent
cc6eb8ebbc
commit
382853c097
2 changed files with 17 additions and 28 deletions
|
|
@ -13,17 +13,6 @@ function exists(gameId) {
|
||||||
return (!!GAMES[gameId]) || false
|
return (!!GAMES[gameId]) || false
|
||||||
}
|
}
|
||||||
|
|
||||||
function __createGameObject(id, rng, puzzle, players, evtInfos, scoreMode) {
|
|
||||||
return {
|
|
||||||
id: id,
|
|
||||||
rng: rng,
|
|
||||||
puzzle: puzzle,
|
|
||||||
players: players,
|
|
||||||
evtInfos: evtInfos,
|
|
||||||
scoreMode: scoreMode,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function __createPlayerObject(id, ts) {
|
function __createPlayerObject(id, ts) {
|
||||||
return {
|
return {
|
||||||
id: id,
|
id: id,
|
||||||
|
|
@ -39,7 +28,14 @@ function __createPlayerObject(id, ts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function newGame({id, rng, puzzle, players, evtInfos, scoreMode}) {
|
function newGame({id, rng, puzzle, players, evtInfos, scoreMode}) {
|
||||||
const game = __createGameObject(id, rng, puzzle, players, evtInfos, scoreMode)
|
const game = {
|
||||||
|
id: id,
|
||||||
|
rng: rng,
|
||||||
|
puzzle: puzzle,
|
||||||
|
players: players,
|
||||||
|
evtInfos: evtInfos,
|
||||||
|
scoreMode: scoreMode,
|
||||||
|
}
|
||||||
setGame(id, game)
|
setGame(id, game)
|
||||||
return game
|
return game
|
||||||
}
|
}
|
||||||
|
|
@ -743,7 +739,6 @@ function handleInput(gameId, playerId, input, ts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
__createGameObject,
|
|
||||||
__createPlayerObject,
|
__createPlayerObject,
|
||||||
newGame,
|
newGame,
|
||||||
exists,
|
exists,
|
||||||
|
|
|
||||||
|
|
@ -57,17 +57,14 @@ const changedGames = {}
|
||||||
async function createGameObject(gameId, targetTiles, image, ts, scoreMode) {
|
async function createGameObject(gameId, targetTiles, image, ts, scoreMode) {
|
||||||
const seed = Util.hash(gameId + ' ' + ts)
|
const seed = Util.hash(gameId + ' ' + ts)
|
||||||
const rng = new Rng(seed)
|
const rng = new Rng(seed)
|
||||||
return GameCommon.__createGameObject(
|
return {
|
||||||
gameId,
|
id: gameId,
|
||||||
{
|
rng: { type: 'Rng', obj: rng },
|
||||||
type: 'Rng',
|
puzzle: await createPuzzle(rng, targetTiles, image, ts),
|
||||||
obj: rng,
|
players: [],
|
||||||
},
|
evtInfos: {},
|
||||||
await createPuzzle(rng, targetTiles, image, ts),
|
scoreMode,
|
||||||
[],
|
}
|
||||||
{},
|
|
||||||
scoreMode
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
async function createGame(gameId, targetTiles, image, ts, scoreMode) {
|
async function createGame(gameId, targetTiles, image, ts, scoreMode) {
|
||||||
GameLog.create(gameId)
|
GameLog.create(gameId)
|
||||||
|
|
@ -77,10 +74,7 @@ async function createGame(gameId, targetTiles, image, ts, scoreMode) {
|
||||||
const rng = new Rng(seed)
|
const rng = new Rng(seed)
|
||||||
GameCommon.newGame({
|
GameCommon.newGame({
|
||||||
id: gameId,
|
id: gameId,
|
||||||
rng: {
|
rng: { type: 'Rng', obj: rng },
|
||||||
type: 'Rng',
|
|
||||||
obj: rng,
|
|
||||||
},
|
|
||||||
puzzle: await createPuzzle(rng, targetTiles, image, ts),
|
puzzle: await createPuzzle(rng, targetTiles, image, ts),
|
||||||
players: [],
|
players: [],
|
||||||
evtInfos: {},
|
evtInfos: {},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue