ソースを参照

fixed an issue introduced in the 'interior teleporter' feature that casued mobs to not be placed in physics cells when in combat

tags/v0.9.0^2
Shaun 3年前
コミット
0cc5821e1b
2個のファイルの変更23行の追加22行の削除
  1. +22
    -19
      src/server/objects/objBase.js
  2. +1
    -3
      src/server/world/physics.js

+ 22
- 19
src/server/objects/objBase.js ファイルの表示

@@ -275,10 +275,12 @@ module.exports = {
},

performMove: function (action) {
let data = action.data;
let physics = this.instance.physics;
const { x: xOld, y: yOld, syncer, aggro, mob, instance: { physics } } = this;

if (!action.force) {
const { maxDistance = 1, force, data } = action;
const { x: xNew, y: yNew } = data;

if (!force) {
if (physics.isTileBlocking(data.x, data.y))
return true;

@@ -290,10 +292,8 @@ module.exports = {
return true;
}

let maxDistance = action.maxDistance || 1;

let deltaX = Math.abs(this.x - data.x);
let deltaY = Math.abs(this.y - data.y);
let deltaX = Math.abs(xOld - xNew);
let deltaY = Math.abs(yOld - yNew);
if (
(
(deltaX > maxDistance) ||
@@ -308,30 +308,33 @@ module.exports = {
}

//Don't allow mob overlap during combat
if ((this.mob) && (this.mob.target)) {
if (physics.addObject(this, data.x, data.y)) {
physics.removeObject(this, this.x, this.y);
if (mob && mob.target) {
this.x = xNew;
this.y = yNew;

if (physics.addObject(this, xNew, yNew))
physics.removeObject(this, xOld, yOld);
else {
this.x = xOld;
this.y = yOld;

this.x = data.x;
this.y = data.y;
} else
return false;
}
} else {
const { x: xOld, y: yOld } = this;
const { x: xNew, y: yNew } = data;

physics.removeObject(this, xOld, yOld, xNew, yNew);

this.x = xNew;
this.y = yNew;

physics.addObject(this, xNew, yNew, xOld, yOld);
}

let syncer = this.syncer;
//We can't use xNew and yNew because addObject could have changed the position (like entering a building interior with stairs)
syncer.o.x = this.x;
syncer.o.y = this.y;

if (this.aggro)
this.aggro.move();
if (aggro)
aggro.move();

this.fireEvent('afterMove');



+ 1
- 3
src/server/world/physics.js ファイルの表示

@@ -123,10 +123,8 @@ module.exports = {

//Perhaps a collisionEvent caused us to move somewhere else, in which case, we don't push to the cell
// as we assume that the collisionEvent handled it for us
if (x === obj.x && y === obj.y)
if (obj.x === x && obj.y === y)
cell.push(obj);
else
console.log('nopers');
return true;
},


読み込み中…
キャンセル
保存