From e75c1486c16fde148e5a5da711334a5216154450 Mon Sep 17 00:00:00 2001 From: Shaun Date: Sun, 12 Mar 2023 08:00:03 +0200 Subject: [PATCH] modding #1985: Added oldPos to the afterPositionChange event --- src/server/config/spells/spellCharge.js | 19 ++++++++++++------- src/server/config/spells/spellFireblast.js | 4 ++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/server/config/spells/spellCharge.js b/src/server/config/spells/spellCharge.js index 6ce9d7e5..66ceefbf 100644 --- a/src/server/config/spells/spellCharge.js +++ b/src/server/config/spells/spellCharge.js @@ -95,6 +95,18 @@ module.exports = { let obj = this.obj; + const moveEvent = { + oldPos: { + x: obj.x, + y: obj.y + }, + newPos: targetPos, + source: this, + target: this, + spellName: 'charge', + spell: this + }; + obj.instance.physics.removeObject(obj, obj.x, obj.y); obj.x = targetPos.x; @@ -122,13 +134,6 @@ module.exports = { spellName: 'charge' }); - const moveEvent = { - newPos: targetPos, - source: this, - target: this, - spellName: 'charge', - spell: this - }; this.obj.fireEvent('afterPositionChange', moveEvent); if (this.castOnEnd) diff --git a/src/server/config/spells/spellFireblast.js b/src/server/config/spells/spellFireblast.js index 2fc1881c..6c3c4e94 100644 --- a/src/server/config/spells/spellFireblast.js +++ b/src/server/config/spells/spellFireblast.js @@ -179,6 +179,10 @@ module.exports = { syncer.o.y = yFinal; const moveEvent = { + oldPos: { + x: xOld, + y: yOld + }, newPos: { x: xFinal, y: yFinal