Browse Source

Merge remote-tracking branch 'origin/master' into release

tags/v0.10.6.8
Shaun 2 years ago
parent
commit
810270fb1a
3 changed files with 33 additions and 19 deletions
  1. +0
    -10
      src/server/components/portal/sendObjToZone.js
  2. +26
    -9
      src/server/config/spells/spellFireblast.js
  3. +7
    -0
      src/server/objects/objects.js

+ 0
- 10
src/server/components/portal/sendObjToZone.js View File

@@ -50,16 +50,6 @@ const sendObjToZone = async ({ obj, invokingObj, zoneName, toPos, toRelativePos
// So physics will carry on and allow the obj to move onto the next tile (changing the position while we save above)
fixPosition(obj, toPos, toRelativePos, invokingObj);

//Test code, remove later
Object.entries(globalSyncer.buffer).forEach(([k, v]) => {
v.forEach(e => {
if (e.to.includes(serverId)) {
/* eslint-disable-next-line */
console.log('Found event', k, 'for rezoning object');
}
});
});

const simpleObj = obj.getSimple(true, false, true);
simpleObj.destroyed = false;
simpleObj.forceDestroy = false;


+ 26
- 9
src/server/config/spells/spellFireblast.js View File

@@ -148,20 +148,37 @@ module.exports = {
},

endEffect: function (target, targetPos, targetEffect) {
target.effects.removeEffect(targetEffect.id);
const { instance: { physics }, syncer, effects } = target;
const { x: xNew, y: yNew } = targetPos;

target.instance.physics.removeObject(target, target.x, target.y);
const xOld = target.x;
const yOld = target.y;

target.x = targetPos.x;
target.y = targetPos.y;
effects.removeEffect(targetEffect.id);

let syncer = target.syncer;
syncer.o.x = targetPos.x;
syncer.o.y = targetPos.y;
target.x = xNew;
target.y = yNew;

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

return false;
}

//We can't use xNew and yNew because addObject could have changed the position (like entering a building interior with stairs)
const { x: xFinal, y: yFinal } = target;

syncer.o.x = xFinal;
syncer.o.y = yFinal;

target.instance.physics.addObject(target, target.x, target.y);
const moveEvent = {
newPos: targetPos,
newPos: {
x: xFinal,
y: yFinal
},
source: this
};
target.fireEvent('afterPositionChange', moveEvent);


+ 7
- 0
src/server/objects/objects.js View File

@@ -342,6 +342,13 @@ module.exports = {
for (let i = 0; i < len; i++) {
let o = objects[i];

//If object A causes object B (layer in the list) to rezone, we won't find it here
if (!o) {
len--;

continue;
}

//Don't remove it from the list if it's destroyed, but don't update it either
//That's syncer's job
if ((o.update) && (!o.destroyed))


Loading…
Cancel
Save