Ver código fonte

wall puzzle

tags/v0.1.4^2
Big Bad Waffle 7 anos atrás
pai
commit
4b6c96fcb5
6 arquivos alterados com 448 adições e 82 exclusões
  1. +4
    -4
      src/client/js/rendering/renderer.js
  2. +300
    -76
      src/server/config/maps/cave/map.json
  3. +138
    -0
      src/server/config/maps/cave/zone.js
  4. +2
    -1
      src/server/misc/pathfinder.js
  5. +3
    -0
      src/server/world/map.js
  6. +1
    -1
      src/server/world/physics.js

+ 4
- 4
src/client/js/rendering/renderer.js Ver arquivo

@@ -494,10 +494,10 @@ define([
var sw = this.showTilesW;
var sh = this.showTilesH;

var lowX = Math.max(0, x - sw) + 2;
var lowY = Math.max(0, y - sh) + 2;
var highX = Math.min(w - 1, x + sw) - 2;
var highY = Math.min(h - 1, y + sh) - 2;
var lowX = Math.max(0, x - sw + 1);
var lowY = Math.max(0, y - sh + 2);
var highX = Math.min(w, x + sw - 2);
var highY = Math.min(h, y + sh - 2);

var addedSprite = false;



+ 300
- 76
src/server/config/maps/cave/map.json
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 138
- 0
src/server/config/maps/cave/zone.js Ver arquivo

@@ -189,6 +189,15 @@ module.exports = {
}
},
objects: {
redwall: {
components: {
cpnBlocker: {
init: function() {
this.obj.instance.physics.setCollision(this.obj.x, this.obj.y, true);
}
}
}
},
bigportal: {
components: {
cpnAttackAnimation: {
@@ -259,6 +268,135 @@ module.exports = {
}
}
},
walltrigger: {
components: {
cpnParticles: {
simplify: function() {
return {
type: 'particles',
blueprint: {
color: {
start: ['fff4252', 'ff6942'],
end: ['802343', 'f953f36']
},
scale: {
start: {
min: 2,
max: 6
},
end: {
min: 0,
max: 2
}
},
speed: {
start: {
min: 0,
max: 4
},
end: {
min: 0,
max: 0
}
},
lifetime: {
min: 1,
max: 2
},
randomScale: true,
randomSpeed: true,
chance: 0.2,
randomColor: true,
spawnType: 'rect',
spawnRect: {
x: -20,
y: -20,
w: 40,
h: 40
}
}
}
}
},
cpnTrigger: {
init: function() {
this.obj.instance.triggerPuzzle = {
activated: []
};
},
collisionEnter: function(o) {
if (!o.player)
return;

var order = this.obj.order;
var triggerPuzzle = this.obj.instance.triggerPuzzle;
var activated = triggerPuzzle.activated;

activated.push(order);
var valid = true;
for (var i = 0; i < activated.length; i++) {
if (activated[i] != i) {
valid = false;
break;
}
}

if (!valid) {
triggerPuzzle.activated = [];

process.send({
method: 'events',
data: {
'onGetAnnouncement': [{
obj: {
msg: 'nothing happens'
},
to: [o.serverId]
}]
}
});

return;
}
else if (activated.length == 4) {
triggerPuzzle.activated = [];
this.activate();
}

process.send({
method: 'events',
data: {
'onGetAnnouncement': [{
obj: {
msg: this.obj.message
},
to: [o.serverId]
}]
}
});
},
activate: function() {
var syncer = this.obj.instance.syncer;
var physics = this.obj.instance.physics;
var walls = this.obj.instance.objects.objects.filter(o => (o.name == 'redwall'));
walls.forEach(function(w) {
w.destroyed = true;
physics.setCollision(w.x, w.y, false);

syncer.queue('onGetObject', {
x: w.x,
y: w.y,
components: [{
type: 'attackAnimation',
row: 0,
col: 4
}]
});
});
}
}
}
},
gas: {
components: {
cpnParticles: {


+ 2
- 1
src/server/misc/pathfinder.js Ver arquivo

@@ -425,7 +425,8 @@

return {
astar: astar,
Graph: Graph
Graph: Graph,
gridNode: GridNode
};

});

+ 3
- 0
src/server/world/map.js Ver arquivo

@@ -319,6 +319,9 @@ define([
if ((this.zone) && (this.zone.objects) && (this.zone.objects[objZoneName.toLowerCase()]))
extend(true, blueprint, this.zone.objects[objZoneName.toLowerCase()]);

if (blueprint.blocking)
this.collisionMap[blueprint.x][blueprint.y] = 1;

if ((blueprint.properties.cpnNotice) || (blueprint.properties.cpnLightPatch) || (layerName == 'rooms') || (layerName == 'hiddenRooms')) {
blueprint.y++;
blueprint.width = cell.width / mapScale;


+ 1
- 1
src/server/world/physics.js Ver arquivo

@@ -456,7 +456,7 @@ define([
setCollision: function(x, y, collides) {
var grid = this.graph.grid;
if (!grid[x][y]) {
grid[x][y] = new pathfinder.astar.GridNode(x, y, collides ? 0 : 1);
grid[x][y] = new pathfinder.gridNode(x, y, collides ? 0 : 1);
}
else {
grid[x][y].weight = collides ? 0 : 1;


Carregando…
Cancelar
Salvar