ShawnsSpace

FS19_LevitatorScript

Nov 28th, 2020
1,084
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. /*******************************************************************************\
  3. *                                                                               *
  4. * LevitatorSprayer.lua                                                                 *
  5. *                                                                               *
  6. *********************************************************************************
  7. * Licensed under the MIT or X11 License                                         *
  8. *                                                                               *
  9. * Copyright (c) 2016 Eisbearg                                                   *
  10. *                                                                               *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy  *
  12. * of this software and associated documentation files (the "Software"), to deal *
  13. * in the Software without restriction, including without limitation the rights  *
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell     *
  15. * copies of the Software, and to permit persons to whom the Software is         *
  16. * furnished to do so, subject to the following conditions:                      *
  17. *                                                                               *
  18. * The above copyright notice and this permission notice shall be included in    *
  19. * all copies or substantial portions of the Software.                           *
  20. *                                                                               *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR    *
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,      *
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE   *
  24. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER        *
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN     *
  27. * THE SOFTWARE.                                                                 *
  28. \*******************************************************************************/
  29. --]]
  30. -- Edit FS17: werik, Silak_68
  31. --28.05.17 network edition by igor29381
  32. --Edit port to FS19: Zippyo v0.99b
  33.  
  34.  
  35. LevitatorSprayer = {};
  36.  
  37. LevitatorSprayer._NAME          = "LevitatorSprayer"
  38. LevitatorSprayer.title = "FS19 LEV";
  39. LevitatorSprayer.author = "zip";
  40. LevitatorSprayer.modDirectory  = g_currentModDirectory;
  41.  
  42. function LevitatorSprayer.prerequisitesPresent(specializations)
  43.     return true;
  44.     end;
  45.  
  46. function LevitatorSprayer.registerFunctions(vehicleType)
  47.     SpecializationUtil.registerFunction(vehicleType, "mouseEvent", LevitatorSprayer.mouseEvent)
  48.     SpecializationUtil.registerFunction(vehicleType, "keyEvent", LevitatorSprayer.keyEvent)
  49.     SpecializationUtil.registerFunction(vehicleType, "activateFlightMode", LevitatorSprayer.activateFlightMode)
  50.     SpecializationUtil.registerFunction(vehicleType, "deactivateFlightMode", LevitatorSprayer.deactivateFlightMode)
  51.     SpecializationUtil.registerFunction(vehicleType, "toggleLevitatorSprayer", LevitatorSprayer.toggleLevitatorSprayer)
  52.     SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree", LevitatorSprayer.getMorldDirectionDegree)
  53.     SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree2", LevitatorSprayer.getMorldDirectionDegree2)
  54.     SpecializationUtil.registerFunction(vehicleType, "getMorldDirectionDegree3", LevitatorSprayer.getMorldDirectionDegree3)
  55.     SpecializationUtil.registerFunction(vehicleType, "getAltitude", LevitatorSprayer.getAltitude)
  56.     SpecializationUtil.registerFunction(vehicleType, "getTailForce", LevitatorSprayer.getTailForce)
  57.     SpecializationUtil.registerFunction(vehicleType, "updateMovement", LevitatorSprayer.updateMovement)
  58.   --SpecializationUtil.registerFunction(vehicleType, "saveToXMLFile", LevitatorSprayer.saveToXMLFile)
  59. end;
  60.  
  61. function LevitatorSprayer.registerEventListeners(vehicleType)
  62.     for _, functionName in pairs( { "onLoad", "onPostLoad", "onUpdate", "onUpdateTick", "onDraw", "saveToXMLFile" } ) do
  63.         SpecializationUtil.registerEventListener(vehicleType, functionName, LevitatorSprayer);
  64.     end;
  65. end;
  66.  
  67. function LevitatorSprayer:onLoad(savegame)
  68.     self.isSelectable = true;
  69.     self.toggleLevitatorSprayer = SpecializationUtil.callSpecializationsFunction("toggleLevitatorSprayer");
  70.     self.LevitatorSprayer = {};
  71.  
  72.     local name = getXMLString(self.xmlFile, "vehicle.storeData.name");
  73.     if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.en"); end;
  74.     if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.de"); end;
  75.     if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.es"); end;
  76.     if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.fr"); end;
  77.     if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.pt"); end;
  78.     if name == nil then name = getXMLString(self.xmlFile, "vehicle.storeData.name.ru"); end;
  79.     if name == nil then name = "UnknownVehicle"; end;
  80.  
  81.     self.LevitatorSprayer.id = LevitatorSprayer._NAME;
  82.     self.LevitatorSprayer.name = name;
  83.     self.LevitatorSprayer.move = false;
  84.     self.LevitatorSprayer.active = false;
  85.     self.LevitatorSprayer.downForce = 0;
  86.     self.LevitatorSprayer.yForce = 0;
  87.     self.LevitatorSprayer.pitch = 0;
  88.     self.LevitatorSprayer.sendPitch = 0;
  89.     self.LevitatorSprayer.startTimer = 0;
  90.     self.LevitatorSprayer.levitatorSprayerFlag = self:getNextDirtyFlag();
  91.     self.LevitatorSprayer.lastDigitalSide = 0;
  92.     self.workAreaPositions = {};
  93.     local lworkAreas = self.spec_workArea.workAreas[1]
  94.     for k,c in pairs (self.spec_workArea) do
  95.        local xs,ys,zs = getWorldTranslation(lworkAreas.start);
  96.        local xw,yw,zw = getWorldTranslation(lworkAreas.width);
  97.        local xh,yh,zh = getWorldTranslation(lworkAreas.height);
  98.        local cap = {};
  99.        cap.start = {xs,ys,zs};
  100.        cap.width = {xw,yw,zw};
  101.        cap.height = {xh,yh,zh};
  102.        table.insert(self.workAreaPositions, cap);
  103.    end;
  104.  
  105.       self.pipeGrainParticleSystem = {};
  106. --    self.pipeGrainParticleSystemindex = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem#index"));
  107. --    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem, "vehicle.pipeGrainParticleSystem", self.pipeGrainParticleSystemindex, false, nil, self.baseDirectory);
  108. --    self.pipeGrainParticleSystem2 = {};
  109. --    self.pipeGrainParticleSystem2index = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.pipeGrainParticleSystem2#index"));
  110. --    Utils.loadParticleSystem(self.xmlFile, self.pipeGrainParticleSystem2, "vehicle.pipeGrainParticleSystem2", self.pipeGrainParticleSystem2index, false, nil, self.baseDirectory);
  111.     print("Load mod: '"..LevitatorSprayer.title.."' by: '"..LevitatorSprayer.author.."' loaded sucessfully.");
  112. end;
  113.  
  114. function LevitatorSprayer:onDelete()
  115. --    Utils.deleteParticleSystem(self.pipeGrainParticleSystem);
  116. --    Utils.deleteParticleSystem(self.pipeGrainParticleSystem2);
  117. end;
  118.  
  119. function LevitatorSprayer:mouseEvent(posX, posY, isDown, isUp, button)
  120. end;
  121.  
  122. function LevitatorSprayer:keyEvent(unicode, sym, modifier, isDown)
  123. end;
  124.  
  125. function LevitatorSprayer:activateFlightMode()
  126.     local component = self.components[1]
  127.     local massresult = self:getTotalMass(true)
  128.         setLinearDamping(component.node, 0.15);
  129.         setAngularDamping(component.node, 0.01);
  130.         self.LevitatorSprayer.downForce = massresult * -9.81;
  131.         self.massresult = massresult *1000;
  132.         self.yForce = self.LevitatorSprayer.downForce * -5;
  133. --    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
  134. --    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
  135. end;
  136.  
  137. function LevitatorSprayer:deactivateFlightMode()
  138.     local component = self.components[1]
  139.         setLinearDamping(component.node, 0.0);
  140.         setAngularDamping(component.node, 0.01);
  141.         self.LevitatorSprayer.downForce = self:getTotalMass(true) * -9.81;
  142.         self.yForce = 0;
  143. --    self.cruiseControl.average = (self.cruiseControl.minSpeed + self.cruiseControl.maxSpeed);
  144. --    self.setCruiseControlMaxSpeed(self, self.cruiseControl.average);
  145. end;
  146.  
  147. function LevitatorSprayer:onPostLoad(savegame)
  148. --[[
  149. ]]
  150. end;
  151.  
  152. function LevitatorSprayer:onUpdate(dt, isActiveForInput, isActiveForInputIgnoreSelection, isSelected)
  153.     local massresult = (self:getTotalMass(false)) * 1000
  154.         self.massresult = massresult
  155.  
  156.     local component = self.components[1]
  157.     local altAboveGround, altAboveNN = self.getAltitude(component.node);
  158.    
  159.     if self.getIsMotorStarted and altAboveGround < 4 then
  160. --        Utils.setEmittingState(self.pipeGrainParticleSystem, true);
  161.     else
  162. --        Utils.setEmittingState(self.pipeGrainParticleSystem, false);
  163.     end;
  164.     if self.getIsMotorStarted and altAboveGround < 9 then
  165. --        Utils.setEmittingState(self.pipeGrainParticleSystem2, true);
  166.     else
  167. --        Utils.setEmittingState(self.pipeGrainParticleSystem2, false);
  168.     end;
  169.  
  170.     if self.spec_motorized.isMotorStarted and self.spec_enterable.isEntered then
  171.         if not self.LevitatorSprayer.active then
  172.             self.LevitatorSprayer.startTimer = self.LevitatorSprayer.startTimer + dt;
  173.             if self.LevitatorSprayer.startTimer > 18000 then
  174.                 LevitatorSprayer.activateFlightMode(self);
  175.                 self.LevitatorSprayer.active = true;
  176.                 self.wiper = true;
  177.                 self.LevitatorSprayer.startTimer = 0;
  178.             end;
  179.         end;
  180.     elseif self.LevitatorSprayer.active then
  181.         LevitatorSprayer.deactivateFlightMode(self);
  182.         self.LevitatorSprayer.active = false;
  183.         self.wiper = false;
  184.     end;
  185.     if not self.LevitatorSprayer.active then return end;
  186. local collectiveup = getInputAxis(10, 0);
  187. local collectivedown = getInputAxis(11, 0);
  188. local gamepads = getNumOfGamepads();
  189. self.normalizedCollectiveUp = (collectiveup - (-1)) / (1 - (-1));
  190. self.normalizedCollectiveDown = (collectivedown - (-1)) / (1 - (-1));
  191. LevitatorSprayer.updateMovement(self, dt);
  192.     if self.isActive and isActiveForInput and gamepads>0 then
  193. if collectiveup <= 1 or collectivedown <= 1 then
  194.             if collectiveup < 1 then
  195.                 self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 1/self.normalizedCollectiveUp/4, self.LevitatorSprayer.downForce * -0.85);
  196.             end;
  197.             if collectivedown < 1 then
  198.                 self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 1/self.normalizedCollectiveDown/4, -25.02);
  199.             end;
  200.         end;
  201. if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT) or Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
  202.             if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_LEFT)then
  203.                 self.LevitatorSprayer.pitch = math.min(self.LevitatorSprayer.pitch + 2, self.LevitatorSprayer.downForce * -0.85);
  204.             end;
  205.             if Input.isMouseButtonPressed(Input.MOUSE_BUTTON_RIGHT)then
  206.                 self.LevitatorSprayer.pitch = math.max(self.LevitatorSprayer.pitch - 2, -25.02);
  207.             end;
  208.        elseif self.LevitatorSprayer.pitch ~= 0 then
  209. if collectiveup == 1 and collectivedown == 1 then
  210.               self.LevitatorSprayer.pitch = 0;
  211.            end;
  212.         end;
  213.     end;
  214.         if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
  215.             if not g_server then
  216.                 self:raiseDirtyFlags(self.levitatorSprayerFlag);
  217.             end;
  218.             self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
  219.         end;
  220.         if self.LevitatorSprayer.pitch ~= self.LevitatorSprayer.sendPitch then
  221.             if not g_server then
  222.                 self:raiseDirtyFlags(self.levitatorSprayerFlag);
  223.             end;
  224.             self.LevitatorSprayer.sendPitch = self.LevitatorSprayer.pitch;
  225.         end;
  226.     if self.isServer then
  227.         local dX,dY,dZ = localDirectionToWorld(component.node, 1, 0, 0);
  228.         local sinDir = dX / 15;
  229.         local cosDir = dZ / -15;
  230.         self.sd = 307;
  231.         if self.spec_motorized.getIsMotorStarted then
  232.             self.sd = 250;
  233.         end;
  234.         local zSteer = self.sd * self.spec_drivable.axisForward;
  235.         local xForce = zSteer * cosDir;
  236.         local zForce = zSteer * sinDir;
  237.         if self.spec_drivable.axisForward == 1 or self.spec_drivable.axisForward == -1 or self.spec_drivable.lastDigitalForward == 1 or self.spec_drivable.lastDigitalForward == -1  then
  238.             dg = 0.01;
  239.         else
  240.             dg = 3;
  241.         end;
  242.         local component = self.components[1]
  243.                 self.LevitatorSprayer.yForce = (self.LevitatorSprayer.pitch + self.LevitatorSprayer.downForce * -0.8422);
  244.                 addForce(component.node, xForce, self.LevitatorSprayer.yForce,  zForce, 0, dg, 0, true);
  245.         local yTurnSpeed = 0;
  246.         if self.spec_drivable.axisSide > 0.1 or self.spec_drivable.axisSide < -0.1 or self.spec_drivable.lastDigitalSide > 0.1 or self.spec_drivable.lastDigitalSide < -0.1  then
  247.             if InputBinding.getIsAnalogInput then
  248.                 yTurnSpeed = self.spec_drivable.axisSide * -0.95;
  249.             else
  250.                 yTurnSpeed = self.spec_drivable.lastDigitalSide * -0.95;
  251.             end;
  252.         end;
  253.  
  254.         local AVx, AVy, AVz = getAngularVelocity(component.node);
  255.         if yTurnSpeed == 0 then
  256.            yTurnSpeed = AVy * 0.85;
  257.         end;
  258.         setAngularVelocity(component.node, AVx * 0.75, yTurnSpeed, AVz * 0.75);
  259.         self.yLV = getLinearVelocity(component.node);
  260.         if self.getIsActive and self.getIsTurnedOn then
  261.             local altAboveGround = self.getAltitude(component.node);
  262.             local addw = altAboveGround*6.5;
  263.             local addh = altAboveGround/5;
  264.             local addz = (altAboveGround/2) + (self.lastSpeed * 3850/50);
  265. local lworkAreas = self.spec_workArea.workAreas[1]
  266.             for c=1, table.getn(lworkAreas) do
  267.                 local cp = self.workAreaPositions[c];
  268.                 local ca = lworkAreas[c];
  269.                 setTranslation(ca.start ,  cp.start[1]+ (cp.start[1] *addw/100) , cp.start[2]  , cp.start[3]- addz);
  270.                 setTranslation(ca.width ,  cp.width[1]+ (cp.width[1] *addw/100) , cp.width[2]  , cp.width[3]- addz);
  271.                 if altAboveGround > 50 then
  272.                     setTranslation(ca.height , cp.start[1]+(cp.start[1]*addw/100) , cp.start[2] , cp.start[3] - addz);
  273.                 else
  274.                     setTranslation(ca.height , cp.height[1]+(cp.height[1]*addw/100) , cp.height[2] , cp.height[3]-addz-addh);
  275.                 end;
  276.             end;
  277.         end;
  278.     end;
  279. end;
  280.  
  281. function LevitatorSprayer:onUpdateTick(dt)
  282. end;
  283.  
  284. function LevitatorSprayer:saveToXMLFile(xmlFile, key)
  285. --[[ key includes the name of the script
  286. ]]
  287. end;
  288.  
  289. function LevitatorSprayer:onDraw()
  290.     local component = self.components[1]
  291.     local text = g_i18n.modEnvironments.Ka26.texts.move --just digging...should b fetched from XML as :getText("move")
  292.     local LVx, LVy, LVz = getLinearVelocity(component.node);
  293.     if self.spec_enterable.getIsEntered then
  294.  
  295.         setTextAlignment(RenderText.ALIGN_CENTER);
  296.         setTextColor(1,1,1,1);
  297.         if self.LevitatorSprayer.active then
  298.             renderText(0.17, 0.29, 0.016, text);
  299.             renderText(0.17, 0.36, 0.025, string.format("V S I=" .. " %4.2f m/s", LVy));
  300.             local altAboveGround, altAboveNN = self.getAltitude(component.node);
  301.           --renderText(0.17, 0.33, 0.025, string.format(g_i18n.modEnvironments.Ka26.texts.ground .. " %4.2f m", altAboveGround));
  302.             renderText(0.17, 0.33, 0.025, string.format("A G L=" .. " %4.2f m", altAboveGround));
  303.             renderText(0.17, 0.26, 0.016, string.format("BLADE PITCH" .. " %3.4f ", self.LevitatorSprayer.pitch));
  304.             renderText(0.17, 0.24, 0.016, string.format("pretend G Downforce" .. " %4.2f m/s", self.LevitatorSprayer.downForce));
  305.             renderText(0.17, 0.22, 0.016, string.format("LevitatorFORCE" .. " %4.2f m/s", self.LevitatorSprayer.yForce));
  306.             renderText(0.17, 0.20, 0.016, string.format("MASS" .. " %4.2f kg", self.massresult));
  307.             setTextBold(false);
  308.         end;
  309.  
  310.         setTextAlignment(RenderText.ALIGN_LEFT);
  311.         setTextColor(1,1,1,1);
  312.     end;
  313. --            local altAboveGround = self.getAltitude(component.node);
  314. --        if self.isActive and altAboveGround > 50 then
  315. --        g_currentMission:showBlinkingWarning(g_i18n.modEnvironments.Ka26.texts.helpGrid, 600);
  316. --    end;
  317. end;
  318. function LevitatorSprayer:toggleLevitatorSprayer(state, nes)
  319. end;
  320.  
  321. function LevitatorSprayer:readStream(streamId, connection)
  322. end;
  323.  
  324. function LevitatorSprayer:writeStream(streamId, connection)
  325. end;
  326.  
  327. function LevitatorSprayer:getMorldDirectionDegree(rootNode)
  328.     local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
  329.     local sinus = dX / 1;
  330.     local cosinus = dZ / 1;
  331.     local direction = math.deg(math.atan2(sinus, cosinus));
  332.     return direction, sinus, cosinus;
  333. end;
  334.  
  335. function LevitatorSprayer:getMorldDirectionDegree2(rootNode)
  336.     local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, 1);
  337.     local sinus = dX / 1;
  338.     local cosinus = dZ / 1;
  339.     local direction = math.deg(math.atan2(cosinus, sinus));
  340.     return direction, sinus, cosinus;
  341. end;
  342.  
  343. function LevitatorSprayer:getMorldDirectionDegree3(rootNode)
  344.     local dX,dY,dZ = localDirectionToWorld(rootNode, 0, 0, -1);
  345.     local sinus = dX / 1;
  346.     local cosinus = dZ / 1;
  347.     local direction = math.deg(math.atan2(cosinus, sinus));
  348.     return direction, sinus, cosinus;
  349. end;
  350.  
  351. function LevitatorSprayer:getAltitude(rootNode)
  352.     local terrainHeight = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, getWorldTranslation(self));
  353.     local x, altAboveNN = getWorldTranslation(self);
  354.     local altAboveGround = altAboveNN - terrainHeight;
  355.     if altAboveGround < 0 then altAboveGround = 0.0 end;
  356.     return altAboveGround, altAboveNN, terrainHeight;
  357. end;
  358.  
  359. function LevitatorSprayer:getTailForce(rootNode, xSteer)
  360.         local dX,dY,dZ = localDirectionToWorld(self, 0, 0, -1);
  361.         local sinDir = dX / 1;
  362.         local cosDir = dZ / 1;
  363.         local xBackward = 10 * sinDir;
  364.         local zBackward = 10 * cosDir;
  365.  
  366.         dX,dY,dZ = localDirectionToWorld(rootNode, 1, 0, 0);
  367.         sinDir = dX / 1;
  368.         cosDir = dZ / 1;
  369.         local xTurnForce = xSteer * sinDir;
  370.         local zTurnForce = xSteer * cosDir;
  371.  
  372.     return xTurnForce, 0, zTurnForce, xBackward, 0.6, zBackward
  373. end;
  374.  
  375. function LevitatorSprayer:updateMovement(dt)
  376. self.axisSideIsAnalog = InputBinding.getIsAnalogInput
  377. self.axisForwardIsAnalog = InputBinding.getIsAnalogInput
  378.         if not self.getIsEntered then return; end
  379.         local axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate                
  380.         local axisBrake = self.spec_drivable.lastInputValues.axisBrake
  381.         local axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
  382.        
  383.         if InputBinding.isAxisZero(axisForward) then
  384.             axisAccelerate = self.spec_drivable.lastInputValues.axisAccelerate
  385.             axisBrake = self.spec_drivable.lastInputValues.axisBrake
  386.             self.axisForward = MathUtil.clamp((axisAccelerate - axisBrake)*0.5, -1, 1);
  387. fetch = self.axisForward
  388.         if not InputBinding.isAxisZero(self.axisForward) then
  389.             self.axisForwardIsAnalog = true;
  390.         end
  391.         self.lastDigitalForward = 0;
  392.     end
  393.     self.axisSide = self.spec_drivable.lastInputValues.axisSide
  394.     if InputBinding.isAxisZero(self.axisSide) then
  395.         self.axisSide = self.spec_drivable.lastInputValues.axisSide
  396.         if not InputBinding.isAxisZero(self.axisSide) then
  397.             self.axisSideIsAnalog = true;
  398.         end
  399.         self.lastDigitalSide = 0;
  400.     else
  401.         self.axisSide = MathUtil.clamp(self.lastDigitalSide + dt/self.axisSmoothTime*self.axisSide, -1, 1);
  402.         self.axisSideIsAnalog = false;
  403.         self.lastDigitalSide = self.axisSide;
  404.     end;
  405.  
  406.      if not self.getIsActiveForInput then
  407.         if not self.axisSideIsAnalog then
  408.             self.axisSide = 0;
  409.         end
  410.         if not self.axisForwardIsAnalog then
  411.             self.axisForward = 0;
  412.         end
  413.     end;
  414.     if not g_server then
  415.         self:raiseDirtyFlags(self.levitatorSprayerFlag);
  416.     end;
  417. end;
RAW Paste Data