From 86e3e234f934d41dbb50edb2f599e53c521a09bc Mon Sep 17 00:00:00 2001 From: Louis Demange <48560751+Nekzuris@users.noreply.github.com> Date: Sat, 14 Dec 2024 16:25:26 +0100 Subject: [PATCH] Update for FS patch 1.4 --- CropDestructionAnywhere.lua | 28 +++++++------ modDesc.xml | 82 +++++++++++++++++++++---------------- 2 files changed, 62 insertions(+), 48 deletions(-) diff --git a/CropDestructionAnywhere.lua b/CropDestructionAnywhere.lua index 0ab524e..abdbbe1 100644 --- a/CropDestructionAnywhere.lua +++ b/CropDestructionAnywhere.lua @@ -1,19 +1,21 @@ CropDestructionAnywhere = {} function CropDestructionAnywhere:update(dt, allowFoliageDestruction) - if allowFoliageDestruction then - local hasContact = self.wheel.physics.contact ~= WheelContactType.NONE - local doFruitDestruction = hasContact and not self.isCareWheel - if doFruitDestruction then - for _, destructionNode in ipairs(self.destructionNodes) do - local repr = self.wheel.repr - local width = 0.5 * destructionNode.width - local length = math.min(0.5, 0.5 * destructionNode.width) - local xShift, yShift, zShift = localToLocal(destructionNode.node, repr, 0, 0, 0) - local x0, _, z0 = localToWorld(repr, xShift + width, yShift, zShift - length) - local x1, _, z1 = localToWorld(repr, xShift - width, yShift, zShift - length) - local x2, _, z2 = localToWorld(repr, xShift + width, yShift, zShift + length) - self:destroyFruitArea(x0, z0, x1, z1, x2, z2) + if g_server ~= nil or self.vehicle.currentUpdateDistance < WheelDestruction.MAX_UPDATE_DISTANCE then + if allowFoliageDestruction then + local hasContact = self.wheel.physics.contact ~= WheelContactType.NONE + local doFruitDestruction = hasContact and not self.isCareWheel + if doFruitDestruction then + for _, destructionNode in ipairs(self.destructionNodes) do + local repr = self.wheel.repr + local width = 0.5 * destructionNode.width + local length = math.min(0.5, 0.5 * destructionNode.width) + local xShift, yShift, zShift = localToLocal(destructionNode.node, repr, 0, 0, 0) + local x0, _, z0 = localToWorld(repr, xShift + width, yShift, zShift - length) + local x1, _, z1 = localToWorld(repr, xShift - width, yShift, zShift - length) + local x2, _, z2 = localToWorld(repr, xShift + width, yShift, zShift + length) + self:destroyFruitArea(x0, z0, x1, z1, x2, z2) + end end end end diff --git a/modDesc.xml b/modDesc.xml index 1bcff8f..6160d2a 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -1,35 +1,47 @@ - - - Nekzuris - 1.0.0.0 - - <en>Crop Destruction Anywhere</en> - <fr>Destruction Des Cultures Partout</fr> - <de>Ernteschäden Überall</de> - - - - - - - - icon_CropDestructionAnywhere.dds - - - - + + + Nekzuris + 1.0.0.1 + + <en>Crop Destruction Anywhere</en> + <fr>Destruction Des Cultures Partout</fr> + <de>Ernteschäden Überall</de> + + + + + + + + icon_CropDestructionAnywhere.dds + + + +