diff --git a/module.json b/module.json index fc410be..6e14e57 100644 --- a/module.json +++ b/module.json @@ -7,7 +7,7 @@ "name": "saibot" } ], - "version": "3.0.0", + "version": "3.0.1", "compatibility": { "minimum": "10", "verified": "12" @@ -64,7 +64,7 @@ ] }, "url": "https://github.com/Saibot393/Rideable", - "download": "https://github.com/Saibot393/Rideable/archive/refs/tags/v3.0.0.zip", + "download": "https://github.com/Saibot393/Rideable/archive/refs/tags/v3.0.1.zip", "manifest": "https://github.com/Saibot393/Rideable/releases/latest/download/module.json", "readme": "https://github.com/Saibot393/Rideable/blob/main/README.md", "changelog": "https://github.com/Saibot393/Rideable/blob/main/CHANGELOG.md", diff --git a/scripts/RidingScript.js b/scripts/RidingScript.js index 9b459c5..7f97969 100644 --- a/scripts/RidingScript.js +++ b/scripts/RidingScript.js @@ -861,15 +861,21 @@ class Ridingmanager { if (RideableUtils.canbeMoved(pRidden)) { if (vPilot && RideableFlags.isPilotedby(pRidden, vPilot)) { - let vTarget = {}; + let vCurrentCenter = GeometricUtils.CenterPositionXY(pRidden); + let vTargetCenter = {x : vCurrentCenter.x + (pRelativChanges.x || 0), y : vCurrentCenter.y + (pRelativChanges.y || 0)} + let vCollision = CONFIG.Canvas.polygonBackends.move.testCollision(vCurrentCenter, vTargetCenter, {type : "move"}); - for (let i = 0; i < cMotionProperties.length; i++) { - if (pRelativChanges.hasOwnProperty(cMotionProperties[i]) && (cMotionProperties[i] != "rotation" || game.settings.get(cModuleName, "RiderRotation"))) { - vTarget[cMotionProperties[i]] = pRidden[cMotionProperties[i]] + pRelativChanges[cMotionProperties[i]]; + if (!vCollision.length) { + let vTarget = {}; + + for (let i = 0; i < cMotionProperties.length; i++) { + if (pRelativChanges.hasOwnProperty(cMotionProperties[i]) && (cMotionProperties[i] != "rotation" || game.settings.get(cModuleName, "RiderRotation"))) { + vTarget[cMotionProperties[i]] = pRidden[cMotionProperties[i]] + pRelativChanges[cMotionProperties[i]]; + } } + + pRidden.update(vTarget); } - - pRidden.update(vTarget); } else { RideablePopups.TextPopUpID(vPilot ,"cantPilot", {pRiddenName : RideableFlags.RideableName(pRidden)}); //MESSAGE POPUP @@ -937,7 +943,6 @@ class Ridingmanager { if (!vReplacement.x && !vReplacement.y) { return {}; } - return vReplacement; }