@@ -19,7 +19,7 @@ define([ | |||||
if (root) | if (root) | ||||
this.root = root + '/'; | this.root = root + '/'; | ||||
events.on('onBuildIngameUis', this.onEnterGame.bind(this)); | |||||
events.on('onBuildIngameUis', this.onBuildIngameUis.bind(this)); | |||||
events.on('onUiKeyDown', this.onUiKeyDown.bind(this)); | events.on('onUiKeyDown', this.onUiKeyDown.bind(this)); | ||||
events.on('onResize', this.onResize.bind(this)); | events.on('onResize', this.onResize.bind(this)); | ||||
@@ -31,7 +31,7 @@ define([ | |||||
}); | }); | ||||
}, | }, | ||||
onEnterGame: async function () { | |||||
onBuildIngameUis: async function () { | |||||
events.clearQueue(); | events.clearQueue(); | ||||
await Promise.all( | await Promise.all( | ||||
@@ -97,7 +97,6 @@ define([ | |||||
onPlay: function () { | onPlay: function () { | ||||
this.el.removeClass('disabled'); | this.el.removeClass('disabled'); | ||||
this.destroy(); | this.destroy(); | ||||
events.emit('onEnterGame'); | |||||
}, | }, | ||||
onNewClick: function () { | onNewClick: function () { | ||||
@@ -151,7 +151,6 @@ define([ | |||||
if (!result) { | if (!result) { | ||||
this.clear(); | this.clear(); | ||||
this.destroy(); | this.destroy(); | ||||
events.emit('onEnterGame'); | |||||
} else | } else | ||||
this.el.find('.message').html(result); | this.el.find('.message').html(result); | ||||
}, | }, | ||||
@@ -272,19 +272,16 @@ module.exports = { | |||||
this.obj.syncer.setArray(true, 'inventory', 'getItems', item); | this.obj.syncer.setArray(true, 'inventory', 'getItems', item); | ||||
}, | }, | ||||
stashItem: function (id) { | |||||
let item = this.findItem(id); | |||||
stashItem: async function (id) { | |||||
const item = this.findItem(id); | |||||
if (!item || item.quest || item.noStash) | if (!item || item.quest || item.noStash) | ||||
return; | return; | ||||
delete item.pos; | delete item.pos; | ||||
let stash = this.obj.stash; | |||||
if (!stash.active) | |||||
return; | |||||
let clonedItem = extend({}, item); | |||||
const success = stash.deposit(clonedItem); | |||||
const stash = this.obj.stash; | |||||
const clonedItem = extend({}, item); | |||||
const success = await stash.deposit(clonedItem); | |||||
if (!success) | if (!success) | ||||
return; | return; | ||||
@@ -312,7 +312,7 @@ module.exports = { | |||||
this.x = xNew; | this.x = xNew; | ||||
this.y = yNew; | this.y = yNew; | ||||
if (physics.addObject(this, xNew, yNew)) | |||||
if (physics.addObject(this, xNew, yNew, xOld, yOld)) | |||||
physics.removeObject(this, xOld, yOld, xNew, yNew); | physics.removeObject(this, xOld, yOld, xNew, yNew); | ||||
else { | else { | ||||
this.x = xOld; | this.x = xOld; | ||||