@@ -101,8 +101,10 @@ define([ | |||
if (l == 'tileSprites') { | |||
layers[l] = new pixi.Container(); | |||
layers[l].layer = 'tiles'; | |||
} else | |||
} else { | |||
layers[l] = new pixi.Container(); | |||
layers[l].layer = l; | |||
} | |||
this.stage.addChild(layers[l]) | |||
}, this); | |||
@@ -289,6 +291,11 @@ define([ | |||
}, | |||
clean: function () { | |||
this.stage.removeChild(this.layers.hiders); | |||
this.layers.hiders = new pixi.Container(); | |||
this.layers.hiders.layer = 'hiders'; | |||
this.stage.addChild(this.layers.hiders); | |||
var container = this.layers.tileSprites; | |||
this.stage.removeChild(container); | |||
@@ -297,7 +304,11 @@ define([ | |||
this.stage.addChild(container); | |||
this.stage.children.sort(function (a, b) { | |||
if (a.layer == 'tiles') | |||
if (a.layer == 'hiders') | |||
return 1; | |||
else if (b.layer == 'hiders') | |||
return -1; | |||
else if (a.layer == 'tiles') | |||
return -1; | |||
else if (b.layer == 'tiles') | |||
return 1; | |||
@@ -10,6 +10,8 @@ define([ | |||
closed: true, | |||
key: null, | |||
autoCloseCd: 0, | |||
autoClose: null, | |||
destroyKey: false, | |||
openSprite: 157, | |||
@@ -19,6 +21,7 @@ define([ | |||
this.locked = blueprint.locked; | |||
this.key = blueprint.key; | |||
this.destroyKey = blueprint.destroyKey; | |||
this.autoClose = blueprint.autoClose; | |||
if (this.closed) | |||
this.obj.instance.physics.setCollision(this.obj.x, this.obj.y, true); | |||
@@ -114,7 +117,10 @@ define([ | |||
var syncO = thisObj.syncer.o; | |||
if (this.locked) { | |||
if ((this.locked) && (this.closed)) { | |||
if (this.autoClose) | |||
this.autoCloseCd = this.autoClose; | |||
var key = obj.inventory.items.find(i => ((i.keyId == this.key) || (i.keyId == 'world'))); | |||
if (!key) | |||
return; | |||
@@ -148,6 +154,21 @@ define([ | |||
this.closed = true; | |||
this.enterArea(obj); | |||
} | |||
}, | |||
update: function () { | |||
if (!this.autoCloseCd) | |||
return; | |||
this.autoCloseCd--; | |||
if (this.autoCloseCd == 0) { | |||
this.obj.cell = this.closedSprite; | |||
this.obj.syncer.o.cell = this.closedSprite; | |||
this.obj.instance.physics.setCollision(this.obj.x, this.obj.y, true); | |||
this.closed = true; | |||
} | |||
} | |||
}; | |||
}); |
@@ -21,7 +21,7 @@ module.exports = { | |||
noRandom: true, | |||
alsoRandom: true, | |||
blueprints: [{ | |||
chance: 5, | |||
chance: 2, | |||
type: 'key', | |||
name: 'Rusted Key', | |||
keyId: 'rustedSewer', | |||
@@ -49,7 +49,7 @@ module.exports = { | |||
noRandom: true, | |||
alsoRandom: true, | |||
blueprints: [{ | |||
chance: 1.5, | |||
chance: 0.5, | |||
type: 'key', | |||
name: 'Rusted Key', | |||
keyId: 'rustedSewer', | |||
@@ -67,7 +67,7 @@ module.exports = { | |||
}, | |||
bandit: { | |||
faction: 'flolgard', | |||
faction: 'hostile', | |||
grantRep: { | |||
fjolgard: 18 | |||
}, | |||
@@ -80,6 +80,10 @@ module.exports = { | |||
whiskers: { | |||
level: 13, | |||
faction: 'hostile', | |||
grantRep: { | |||
fjolgard: 22 | |||
}, | |||
rare: { | |||
count: 0 | |||
@@ -87,7 +91,7 @@ module.exports = { | |||
}, | |||
'bera the blade': { | |||
faction: 'flolgard', | |||
faction: 'hostile', | |||
grantRep: { | |||
fjolgard: 25 | |||
}, | |||
@@ -118,15 +122,7 @@ module.exports = { | |||
sewerdoor: { | |||
properties: { | |||
cpnDoor: { | |||
locked: true, | |||
key: 'rustedSewer', | |||
destroyKey: true | |||
} | |||
} | |||
}, | |||
sewerdoor: { | |||
properties: { | |||
cpnDoor: { | |||
autoClose: 15, | |||
locked: true, | |||
key: 'rustedSewer', | |||
destroyKey: true | |||