Comparing version 0.0.1-e610b5ce to 0.0.1-e80ccd96
@@ -98,3 +98,3 @@ "use strict"; | ||
checkActionAllowed(state, action); | ||
if (actionMap[action.type] && action._fromQueue) { | ||
if (!state.client.loadingState && actionMap[action.type] && action._fromQueue) { | ||
action = actionMap[action.type](action); | ||
@@ -101,0 +101,0 @@ } |
@@ -190,3 +190,3 @@ "use strict"; | ||
if (!(nextActions && nextActions.length > 0 && (gameActions[action.type] || action.type === _client.CLIENT_LOAD_STATE))) { | ||
if (!(nextActions && nextActions.length > 0 && (gameActions[action.type] || action.type === _client.CLIENT_LOAD_STATE_DONE) && !state.client.loadingState)) { | ||
_context.next = 49; | ||
@@ -193,0 +193,0 @@ break; |
@@ -19,4 +19,10 @@ "use strict"; | ||
var _queueReducer = require("./queue-reducer"); | ||
var _queueReducer2 = _interopRequireDefault(_queueReducer); | ||
var _util = require("@cardcore/util"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -50,4 +56,6 @@ | ||
var DEFAULT_STATE = { game: {} }; | ||
function rootReducer() { | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STATE; | ||
var action = arguments[1]; | ||
@@ -61,4 +69,4 @@ | ||
// temporary hacky game init logic | ||
if (action.type === clientActions.CLIENT_LOAD_STATE) { | ||
return Object.assign({}, state, { | ||
if (action.type === clientActions.CLIENT_LOAD_STATE_START) { | ||
state = Object.assign({}, state, { | ||
game: action.gameState | ||
@@ -145,2 +153,5 @@ }); | ||
} | ||
if (gameActions[action.type]) { | ||
state = (0, _queueReducer2.default)(state, action); | ||
} | ||
_util.rando.clearSeed(); | ||
@@ -147,0 +158,0 @@ return state; |
{ | ||
"name": "cardcore", | ||
"version": "0.0.1-e610b5ce", | ||
"version": "0.0.1-e80ccd96", | ||
"description": "Core functions for cards", | ||
@@ -14,5 +14,9 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@streamplace/ssb-keys": "^7.0.16" | ||
"@streamplace/ssb-keys": "^7.0.16", | ||
"ajv": "^6.5.2" | ||
}, | ||
"gitHead": "e610b5ce494b91bf26736417e3c8ba011f27ae84" | ||
"scripts": { | ||
"test": "jest src" | ||
}, | ||
"gitHead": "e80ccd9627337c33e9f62eed0f17f765917c1713" | ||
} |
@@ -63,3 +63,7 @@ /** | ||
checkActionAllowed(state, action); | ||
if (actionMap[action.type] && action._fromQueue) { | ||
if ( | ||
!state.client.loadingState && | ||
actionMap[action.type] && | ||
action._fromQueue | ||
) { | ||
action = actionMap[action.type](action); | ||
@@ -66,0 +70,0 @@ } |
// import signalhub from "signalhub"; | ||
import * as gameActions from "@cardcore/game"; | ||
import { CLIENT_LOAD_STATE, clientPoll } from "@cardcore/client"; | ||
import { CLIENT_LOAD_STATE_DONE, clientPoll } from "@cardcore/client"; | ||
import { hashState } from "@cardcore/util"; | ||
@@ -101,3 +101,4 @@ import ssbKeys from "@streamplace/ssb-keys"; | ||
nextActions.length > 0 && | ||
(gameActions[action.type] || action.type === CLIENT_LOAD_STATE) | ||
(gameActions[action.type] || action.type === CLIENT_LOAD_STATE_DONE) && | ||
!state.client.loadingState | ||
) { | ||
@@ -104,0 +105,0 @@ const { playerId, notPlayerId, action } = nextActions[0]; |
import * as gameActions from "@cardcore/game"; | ||
import * as clientActions from "@cardcore/client"; | ||
import queueReducer from "./queue-reducer"; | ||
import { rando } from "@cardcore/util"; | ||
@@ -31,3 +32,5 @@ | ||
export default function rootReducer(state = {}, action) { | ||
const DEFAULT_STATE = { game: {} }; | ||
export default function rootReducer(state = DEFAULT_STATE, action) { | ||
let startRandoSeed = state.game && state.game.randoSeed; | ||
@@ -39,4 +42,4 @@ if (state.game && state.game.randoSeed) { | ||
// temporary hacky game init logic | ||
if (action.type === clientActions.CLIENT_LOAD_STATE) { | ||
return { | ||
if (action.type === clientActions.CLIENT_LOAD_STATE_START) { | ||
state = { | ||
...state, | ||
@@ -90,4 +93,7 @@ game: action.gameState | ||
} | ||
if (gameActions[action.type]) { | ||
state = queueReducer(state, action); | ||
} | ||
rando.clearSeed(); | ||
return state; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65954
24
927
2
+ Addedajv@^6.5.2
+ Addedajv@6.12.6(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addeduri-js@4.4.1(transitive)