--Lemken Gigant -- --Class for Lemken Gigant -- --@author Acid_Burn84© --@date 27/08/08 -- -- --@author fiat100© --@date 15/10/09 Lemken_Gigant = {}; function Lemken_Gigant.prerequisitesPresent(specializations) return SpecializationUtil.hasSpecialization(Trailer, specializations); end; function Lemken_Gigant:load(xmlFile) self.aiTerrainDetailChannel1 = g_currentMission.ploughChannel; self.aiTerrainDetailChannel2 = g_currentMission.sowingChannel; self.safeMode = true self.drumNodeLeft1 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index1")); self.drumNodeLeft2 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index2")); self.drumNodeLeft3 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index3")); self.drumNodeLeft4 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index4")); self.drumNodeRight1 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index5")); self.drumNodeRight2 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index6")); self.drumNodeRight3 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index7")); self.drumNodeRight4 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.drum#index8")); self.drumNode = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.carryingWheel#index")); self.drumNode2 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.carryingWheel#index2")); self.drumRotationScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.drum#rotationScale"), 1); self.drumRotationScale2 = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.carryingWheel#rotationScale"), 1); local workSound = getXMLString(xmlFile, "vehicle.workSound#file"); if workSound ~= nil and workSound ~= "" then self.workSound = createSample("workSound"); loadSample(self.workSound, workSound, false); end; local rotationPartNodeRight = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartRight#index")); if rotationPartNodeRight ~= nil then self.rotationPartRight = {}; self.rotationPartRight.node = rotationPartNodeRight; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartRight#minRot")); self.rotationPartRight.minRot = {}; self.rotationPartRight.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartRight.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartRight.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartRight#maxRot")); self.rotationPartRight.maxRot = {}; self.rotationPartRight.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartRight.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartRight.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartRight.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartRight#rotTime"), 2)*1000; self.rotationPartRight.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartRight#touchRotLimit"), 10)); end; local rotationPartNodeLeft = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartLeft#index")); if rotationPartNodeLeft ~= nil then self.rotationPartLeft = {}; self.rotationPartLeft.node = rotationPartNodeLeft; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartLeft#minRot")); self.rotationPartLeft.minRot = {}; self.rotationPartLeft.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartLeft.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartLeft.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartLeft#maxRot")); self.rotationPartLeft.maxRot = {}; self.rotationPartLeft.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartLeft.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartLeft.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartLeft.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartLeft#rotTime"), 2)*1000; self.rotationPartLeft.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartLeft#touchRotLimit"), 10)); end; local rotationPartNodeMain = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartMain#index")); if rotationPartNodeMain ~= nil then self.rotationPartMain = {}; self.rotationPartMain.node = rotationPartNodeMain; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartMain#minRot")); self.rotationPartMain.minRot = {}; self.rotationPartMain.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartMain.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartMain.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartMain#maxRot")); self.rotationPartMain.maxRot = {}; self.rotationPartMain.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartMain.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartMain.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartMain.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartMain#rotTime"), 2)*1000; self.rotationPartMain.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartMain#touchRotLimit"), 10)); end; local rotationPartNodeTransport = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartTransport#index")); if rotationPartNodeTransport ~= nil then self.rotationPartTransport = {}; self.rotationPartTransport.node = rotationPartNodeTransport; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTransport#minRot")); self.rotationPartTransport.minRot = {}; self.rotationPartTransport.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartTransport.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartTransport.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTransport#maxRot")); self.rotationPartTransport.maxRot = {}; self.rotationPartTransport.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartTransport.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartTransport.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartTransport.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTransport#rotTime"), 2)*1000; self.rotationPartTransport.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTransport#touchRotLimit"), 10)); end; local rotationPartNodeZylinderMain = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartZylinderMain#index")); if rotationPartNodeZylinderMain ~= nil then self.rotationPartZylinderMain = {}; self.rotationPartZylinderMain.node = rotationPartNodeZylinderMain; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain#minRot")); self.rotationPartZylinderMain.minRot = {}; self.rotationPartZylinderMain.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderMain.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderMain.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain#maxRot")); self.rotationPartZylinderMain.maxRot = {}; self.rotationPartZylinderMain.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderMain.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderMain.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartZylinderMain.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain#rotTime"), 2)*1000; self.rotationPartZylinderMain.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain#touchRotLimit"), 10)); end; local rotationPartNodeZylinderMain1 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartZylinderMain1#index")); if rotationPartNodeZylinderMain1 ~= nil then self.rotationPartZylinderMain1 = {}; self.rotationPartZylinderMain1.node = rotationPartNodeZylinderMain1; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain1#minRot")); self.rotationPartZylinderMain1.minRot = {}; self.rotationPartZylinderMain1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderMain1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderMain1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain1#maxRot")); self.rotationPartZylinderMain1.maxRot = {}; self.rotationPartZylinderMain1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderMain1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderMain1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartZylinderMain1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain1#rotTime"), 2)*1000; self.rotationPartZylinderMain1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderMain1#touchRotLimit"), 10)); end; local rotationPartNodeZylinderLeft = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartZylinderLeft#index")); if rotationPartNodeZylinderLeft ~= nil then self.rotationPartZylinderLeft = {}; self.rotationPartZylinderLeft.node = rotationPartNodeZylinderLeft; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderLeft#minRot")); self.rotationPartZylinderLeft.minRot = {}; self.rotationPartZylinderLeft.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderLeft.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderLeft.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderLeft#maxRot")); self.rotationPartZylinderLeft.maxRot = {}; self.rotationPartZylinderLeft.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderLeft.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderLeft.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartZylinderLeft.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderLeft#rotTime"), 2)*1000; self.rotationPartZylinderLeft.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderLeft#touchRotLimit"), 10)); end; local rotationPartNodeZylinderRight = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartZylinderRight#index")); if rotationPartNodeZylinderRight ~= nil then self.rotationPartZylinderRight = {}; self.rotationPartZylinderRight.node = rotationPartNodeZylinderRight; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderRight#minRot")); self.rotationPartZylinderRight.minRot = {}; self.rotationPartZylinderRight.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderRight.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderRight.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartZylinderRight#maxRot")); self.rotationPartZylinderRight.maxRot = {}; self.rotationPartZylinderRight.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0)); self.rotationPartZylinderRight.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0)); self.rotationPartZylinderRight.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0)); self.rotationPartZylinderRight.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderRight#rotTime"), 2)*1000; self.rotationPartZylinderRight.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartZylinderRight#touchRotLimit"), 10)); end; local translationPartNode = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.translationPart#index")); if translationPartNode ~= nil then self.translationPart = {}; self.translationPart.node = translationPartNode; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart#minTrans")); self.translationPart.minTrans = {}; self.translationPart.minTrans[1] = Utils.getNoNil(x, 0); self.translationPart.minTrans[2] = Utils.getNoNil(y, 0); self.translationPart.minTrans[3] = Utils.getNoNil(z, 0); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart#maxTrans")); self.translationPart.maxTrans = {}; self.translationPart.maxTrans[1] = Utils.getNoNil(x, 0); self.translationPart.maxTrans[2] = Utils.getNoNil(y, 0); self.translationPart.maxTrans[3] = Utils.getNoNil(z, 0); self.translationPart.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart#transTime"), 2)*1000; self.translationPart.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart#touchTransLimit"), 10); end; local translationPartNodeZylinderMain = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.translationPartZylinderMain#index")); if translationPartNodeZylinderMain ~= nil then self.translationPartZylinderMain = {}; self.translationPartZylinderMain.node = translationPartNodeZylinderMain; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderMain#minTrans")); self.translationPartZylinderMain.minTrans = {}; self.translationPartZylinderMain.minTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderMain.minTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderMain.minTrans[3] = Utils.getNoNil(z, 0); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderMain#maxTrans")); self.translationPartZylinderMain.maxTrans = {}; self.translationPartZylinderMain.maxTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderMain.maxTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderMain.maxTrans[3] = Utils.getNoNil(z, 0); self.translationPartZylinderMain.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderMain#transTime"), 2)*1000; self.translationPartZylinderMain.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderMain#touchTransLimit"), 10); end; local translationPartNodeZylinderMain1 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.translationPartZylinderMain1#index")); if translationPartNodeZylinderMain1 ~= nil then self.translationPartZylinderMain1 = {}; self.translationPartZylinderMain1.node = translationPartNodeZylinderMain1; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderMain1#minTrans")); self.translationPartZylinderMain1.minTrans = {}; self.translationPartZylinderMain1.minTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderMain1.minTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderMain1.minTrans[3] = Utils.getNoNil(z, 0); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderMain1#maxTrans")); self.translationPartZylinderMain1.maxTrans = {}; self.translationPartZylinderMain1.maxTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderMain1.maxTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderMain1.maxTrans[3] = Utils.getNoNil(z, 0); self.translationPartZylinderMain1.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderMain1#transTime"), 2)*1000; self.translationPartZylinderMain1.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderMain1#touchTransLimit"), 10); end; local translationPartNodeZylinderLeft = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.translationPartZylinderLeft#index")); if translationPartNodeZylinderLeft ~= nil then self.translationPartZylinderLeft = {}; self.translationPartZylinderLeft.node = translationPartNodeZylinderLeft; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderLeft#minTrans")); self.translationPartZylinderLeft.minTrans = {}; self.translationPartZylinderLeft.minTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderLeft.minTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderLeft.minTrans[3] = Utils.getNoNil(z, 0); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderLeft#maxTrans")); self.translationPartZylinderLeft.maxTrans = {}; self.translationPartZylinderLeft.maxTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderLeft.maxTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderLeft.maxTrans[3] = Utils.getNoNil(z, 0); self.translationPartZylinderLeft.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderLeft#transTime"), 2)*1000; self.translationPartZylinderLeft.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderLeft#touchTransLimit"), 10); end; local translationPartNodeZylinderRight = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.translationPartZylinderRight#index")); if translationPartNodeZylinderRight ~= nil then self.translationPartZylinderRight = {}; self.translationPartZylinderRight.node = translationPartNodeZylinderRight; local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderRight#minTrans")); self.translationPartZylinderRight.minTrans = {}; self.translationPartZylinderRight.minTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderRight.minTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderRight.minTrans[3] = Utils.getNoNil(z, 0); x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPartZylinderRight#maxTrans")); self.translationPartZylinderRight.maxTrans = {}; self.translationPartZylinderRight.maxTrans[1] = Utils.getNoNil(x, 0); self.translationPartZylinderRight.maxTrans[2] = Utils.getNoNil(y, 0); self.translationPartZylinderRight.maxTrans[3] = Utils.getNoNil(z, 0); self.translationPartZylinderRight.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderRight#transTime"), 2)*1000; self.translationPartZylinderRight.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPartZylinderRight#touchTransLimit"), 10); end; self.threshingParticleSystems1 = {}; local psName = "vehicle.threshingParticleSystem1"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems1, psName, self.rootNode, false) self.threshingParticleSystems2 = {}; local psName = "vehicle.threshingParticleSystem2"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems2, psName, self.rootNode, false) self.threshingParticleSystems3 = {}; local psName = "vehicle.threshingParticleSystem3"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems3, psName, self.rootNode, false) self.threshingParticleSystems4 = {}; local psName = "vehicle.threshingParticleSystem4"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems4, psName, self.rootNode, false) self.threshingParticleSystems5 = {}; local psName = "vehicle.threshingParticleSystem5"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems5, psName, self.rootNode, false) self.threshingParticleSystems6 = {}; local psName = "vehicle.threshingParticleSystem6"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems6, psName, self.rootNode, false) self.threshingParticleSystems7 = {}; local psName = "vehicle.threshingParticleSystem7"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems7, psName, self.rootNode, false) self.threshingParticleSystems8 = {}; local psName = "vehicle.threshingParticleSystem8"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems8, psName, self.rootNode, false) self.threshingParticleSystems9 = {}; local psName = "vehicle.threshingParticleSystem9"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems9, psName, self.rootNode, false) self.threshingParticleSystems10 = {}; local psName = "vehicle.threshingParticleSystem10"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems10, psName, self.rootNode, false) self.threshingParticleSystems11 = {}; local psName = "vehicle.threshingParticleSystem11"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems11, psName, self.rootNode, false) self.threshingParticleSystems12 = {}; local psName = "vehicle.threshingParticleSystem12"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems12, psName, self.rootNode, false) self.threshingParticleSystems13 = {}; local psName = "vehicle.threshingParticleSystem13"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems13, psName, self.rootNode, false) self.threshingParticleSystems14 = {}; local psName = "vehicle.threshingParticleSystem14"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems14, psName, self.rootNode, false) self.threshingParticleSystems15 = {}; local psName = "vehicle.threshingParticleSystem15"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems15, psName, self.rootNode, false) self.threshingParticleSystems16 = {}; local psName = "vehicle.threshingParticleSystem16"; Utils.loadParticleSystem(xmlFile, self.threshingParticleSystems16, psName, self.rootNode, false) self.vehicleType = getXMLString(xmlFile, "vehicle#type"); self.AIon = false; self.saveAILM = self.aiLeftMarker; self.aiLeftMarker = nil; self.attacherBackup = nil; self.TurnRadiusBackup = 0; self.helpPanelPath = Utils.getFilename("Lemkenhud.png", self.baseDirectory); self.HudWidth = 0.352; self.HudHeight = 0.272; --old 0.256; self.HudPosX = -0.05; self.HudPosY = 0.001; self.helpPanelTextPosX = 0.002; self.helpPanelTextPosY = 0.356; self.helpPanelOverlay = Overlay:new("Lemkenhud", self.helpPanelPath, self.HudPosX, self.HudPoxY, self.HudWidth, self.HudHeight); self.helpPanelActive = false; delete(xmlFile); return self; end; function Lemken_Gigant:keyEvent(unicode, sym, modifier, isDown) Trailer.keyEvent(self, unicode, sym, modifier, isDown); if isDown and sym == Input.KEY_x then self.rotationMaxTransport = not self.rotationMaxTransport; self.rotationMaxLeft = not self.rotationMaxLeft; self.rotationMaxRight = not self.rotationMaxRight; self.translationMaxZylinderLeft = not self.translationMaxZylinderLeft; self.translationMaxZylinderRight = not self.translationMaxZylinderRight; self.translationMaxZylinderMain = not self.translationMaxZylinderMain; self.rotationMaxZylinderMain = not self.rotationMaxZylinderMain; self.rotationMaxZylinderLeft = not self.rotationMaxZylinderLeft; self.rotationMaxZylinderRight = not self.rotationMaxZylinderRight; end; if isDown and sym == Input.KEY_v then self.rotationMaxMain = not self.rotationMaxMain self.rotationMaxZylinderMain1 = not self.rotationMaxZylinderMain1; self.translationMaxZylinderMain1 = not self.translationMaxZylinderMain1; end; if isDown and sym==Input.KEY_0 then self.helpPanelActive = not self.helpPanelActive; end; end; function Lemken_Gigant:update(dt) if self.attacherVehicle then if self.attacherVehicle.isAITractorActivated ~= nil then self.AIon = self.attacherVehicle.isAITractorActivated; end; if self.attacherVehicle.isAITractorActivated ~= nil then self.aiLeftMarker = self.saveAILM; AITractor.updateToolsInfo(self.attacherVehicle) end; if self.AIon then self.attacherVehicle.steeringAxleAngle = 0; end; if self.attacherBackup == nil and self.attacherVehicle ~= nil then self.attacherBackup = self.attacherVehicle; end; self.isExpandedCultivator = false; if self.rotationPartRight ~= nil then local x, y, z = getRotation(self.rotationPartRight.node); local maxRot = self.rotationPartRight.maxRot; local eps = self.rotationPartRight.touchRotLimit; if math.abs(x-maxRot[1]) < eps and math.abs(y-maxRot[2]) < eps and math.abs(z-maxRot[3]) < eps then self.isExpandedCultivator = true; end; end; self.isExpanded = false; if self.rotationPartMain ~= nil then local x, y, z = getRotation(self.rotationPartMain.node); local maxRot = self.rotationPartMain.maxRot; local eps = self.rotationPartMain.touchRotLimit; if math.abs(x-maxRot[1]) < eps and math.abs(y-maxRot[2]) < eps and math.abs(z-maxRot[3]) < eps then self.isExpanded = true; end; end; self.transportPosition = false; if self.rotationPartTransport ~= nil then local x, y, z = getRotation(self.rotationPartTransport.node); local minRot = self.rotationPartTransport.minRot; local eps = self.rotationPartTransport.touchRotLimit; if math.abs(x-minRot[1]) < eps and math.abs(y-minRot[2]) < eps and math.abs(z-minRot[3]) < eps then self.transportPosition = true; end; end; self.translationMax = true; if self.isExpanded and self.isExpandedCultivator then Utils.setEmittingState(self.threshingParticleSystems1, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems2, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems3, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems4, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems5, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems6, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems7, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems8, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems9, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems10, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems11, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems12, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems13, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems14, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems15, (self.attacherVehicle.lastSpeed*3600 > 2 )); Utils.setEmittingState(self.threshingParticleSystems16, (self.attacherVehicle.lastSpeed*3600 > 2 )); if self.drumNodeLeft1 ~= nil then rotate(self.drumNodeLeft1, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNodeLeft2 ~= nil then rotate(self.drumNodeLeft2, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNodeLeft3 ~= nil then rotate(self.drumNodeLeft3, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNodeLeft4 ~= nil then rotate(self.drumNodeLeft4, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNodeRight1 ~= nil then rotate(self.drumNodeRight1, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNodeRight2 ~= nil then rotate(self.drumNodeRight2, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNodeRight3 ~= nil then rotate(self.drumNodeRight3, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNodeRight4 ~= nil then rotate(self.drumNodeRight4, self.drumRotationScale * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNode ~= nil then rotate(self.drumNode, self.drumRotationScale2 * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; if self.drumNode2 ~= nil then rotate(self.drumNode2, self.drumRotationScale2 * self.attacherVehicle.lastSpeed * self.attacherVehicle.movingDirection, 0, 0); end; for i=1, table.getn(self.cuttingAreas) do local x,y,z = getWorldTranslation(self.cuttingAreas[i].start); local x1,y1,z1 = getWorldTranslation(self.cuttingAreas[i].width); local x2,y2,z2 = getWorldTranslation(self.cuttingAreas[i].height); if self.safeMode then Cultivator.updateSafeArea(x, z, x1, z1, x2, z2) else Utils.updateCultivatorArea(x, z, x1, z1, x2, z2); end; end; end; if self.isExpanded and self.isExpandedCultivator and self.attacherVehicle.lastSpeed*3600 > 2 then if not self.workSoundRunning then print("start"); playSample(self.workSound, 0, 1.6, 0); self.workSoundRunning = true; end; end; if not self.isExpanded or not self.isExpandedCultivator or self.attacherVehicle.lastSpeed*3600 < 2 then if self.workSoundRunning then print("end"); stopSample(self.workSound, 0, 1.6, 0); self.workSoundRunning = false; end; Utils.setEmittingState(self.threshingParticleSystems1, false); Utils.setEmittingState(self.threshingParticleSystems2, false); Utils.setEmittingState(self.threshingParticleSystems3, false); Utils.setEmittingState(self.threshingParticleSystems4, false); Utils.setEmittingState(self.threshingParticleSystems5, false); Utils.setEmittingState(self.threshingParticleSystems6, false); Utils.setEmittingState(self.threshingParticleSystems7, false); Utils.setEmittingState(self.threshingParticleSystems8, false); Utils.setEmittingState(self.threshingParticleSystems9, false); Utils.setEmittingState(self.threshingParticleSystems10, false); Utils.setEmittingState(self.threshingParticleSystems11, false); Utils.setEmittingState(self.threshingParticleSystems12, false); Utils.setEmittingState(self.threshingParticleSystems13, false); Utils.setEmittingState(self.threshingParticleSystems14, false); Utils.setEmittingState(self.threshingParticleSystems15, false); Utils.setEmittingState(self.threshingParticleSystems16, false); end; end; if not self.isExpanded then if self.rotationPartRight ~= nil then local x, y, z = getRotation(self.rotationPartRight.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartRight.maxRot, self.rotationPartRight.minRot, 3, self.rotationPartRight.rotTime, dt, not self.rotationMaxRight); setRotation(self.rotationPartRight.node, unpack(newRot)); end; if self.rotationPartLeft ~= nil then local x, y, z = getRotation(self.rotationPartLeft.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartLeft.maxRot, self.rotationPartLeft.minRot, 3, self.rotationPartLeft.rotTime, dt, not self.rotationMaxLeft); setRotation(self.rotationPartLeft.node, unpack(newRot)); end; if self.rotationPartTransport ~= nil then local x, y, z = getRotation(self.rotationPartTransport.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartTransport.maxRot, self.rotationPartTransport.minRot, 3, self.rotationPartTransport.rotTime, dt, not self.rotationMaxTransport); setRotation(self.rotationPartTransport.node, unpack(newRot)); end; if self.rotationPartZylinderMain ~= nil then local x, y, z = getRotation(self.rotationPartZylinderMain.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartZylinderMain.maxRot, self.rotationPartZylinderMain.minRot, 3, self.rotationPartZylinderMain.rotTime, dt, not self.rotationMaxZylinderMain); setRotation(self.rotationPartZylinderMain.node, unpack(newRot)); end; if self.translationPartZylinderMain ~= nil then local x, y, z = getTranslation(self.translationPartZylinderMain.node); local trans = {x,y,z}; local newTrans = Utils.getMovedLimitedValues(trans, self.translationPartZylinderMain.maxTrans, self.translationPartZylinderMain.minTrans, 3, self.translationPartZylinderMain.transTime*4.8, dt, not self.translationMaxZylinderMain); setTranslation(self.translationPartZylinderMain.node, unpack(newTrans)); end; if self.rotationPartZylinderRight ~= nil then local x, y, z = getRotation(self.rotationPartZylinderRight.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartZylinderRight.maxRot, self.rotationPartZylinderRight.minRot, 3, self.rotationPartZylinderRight.rotTime, dt, not self.rotationMaxZylinderRight); setRotation(self.rotationPartZylinderRight.node, unpack(newRot)); end; if self.rotationPartZylinderLeft ~= nil then local x, y, z = getRotation(self.rotationPartZylinderLeft.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartZylinderLeft.maxRot, self.rotationPartZylinderLeft.minRot, 3, self.rotationPartZylinderLeft.rotTime, dt, not self.rotationMaxZylinderLeft); setRotation(self.rotationPartZylinderLeft.node, unpack(newRot)); end; if self.translationPartZylinderLeft ~= nil then local x, y, z = getTranslation(self.translationPartZylinderLeft.node); local trans = {x,y,z}; local newTrans = Utils.getMovedLimitedValues(trans, self.translationPartZylinderLeft.maxTrans, self.translationPartZylinderLeft.minTrans, 3, self.translationPartZylinderLeft.transTime, dt, not self.translationMaxZylinderLeft); setTranslation(self.translationPartZylinderLeft.node, unpack(newTrans)); end; if self.translationPartZylinderRight ~= nil then local x, y, z = getTranslation(self.translationPartZylinderRight.node); local trans = {x,y,z}; local newTrans = Utils.getMovedLimitedValues(trans, self.translationPartZylinderRight.maxTrans, self.translationPartZylinderRight.minTrans, 3, self.translationPartZylinderRight.transTime, dt, not self.translationMaxZylinderRight); setTranslation(self.translationPartZylinderRight.node, unpack(newTrans)); end; end; if not self.transportPosition then if self.rotationPartMain ~= nil then local x, y, z = getRotation(self.rotationPartMain.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartMain.maxRot, self.rotationPartMain.minRot, 3, self.rotationPartMain.rotTime, dt, not self.rotationMaxMain); setRotation(self.rotationPartMain.node, unpack(newRot)); end; if self.rotationPartZylinderMain1 ~= nil then local x, y, z = getRotation(self.rotationPartZylinderMain1.node); local rot = {x,y,z}; local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartZylinderMain1.maxRot, self.rotationPartZylinderMain1.minRot, 3, self.rotationPartZylinderMain1.rotTime, dt, not self.rotationMaxZylinderMain1); setRotation(self.rotationPartZylinderMain1.node, unpack(newRot)); end; if self.translationPartZylinderMain1 ~= nil then local x, y, z = getTranslation(self.translationPartZylinderMain1.node); local trans = {x,y,z}; local newTrans = Utils.getMovedLimitedValues(trans, self.translationPartZylinderMain1.maxTrans, self.translationPartZylinderMain1.minTrans, 3, self.translationPartZylinderMain1.transTime, dt, not self.translationMaxZylinderMain1); setTranslation(self.translationPartZylinderMain1.node, unpack(newTrans)); end; end; if self.translationPart ~= nil then local x, y, z = getTranslation(self.translationPart.node); local trans = {x,y,z}; local newTrans = Utils.getMovedLimitedValues(trans, self.translationPart.maxTrans, self.translationPart.minTrans, 3, self.translationPart.transTime, dt, not self.translationMax); setTranslation(self.translationPart.node, unpack(newTrans)); end; Trailer.update(self, dt); end; function Lemken_Gigant:draw() Trailer.draw(self); if self.helpPanelActive then g_currentMission:addExtraPrintText("Taste 0: Lemken Gigant 1000: Hilfe aus"); self.helpPanelOverlay:render(); setTextColor(1.0 , 1.0, 1.0, 1.0); if not self.transportPosition then renderText(self.helpPanelTextPosX, self.helpPanelTextPosY-0.222, 0.024, " Taste X: Transportstellung"); else renderText(self.helpPanelTextPosX, self.helpPanelTextPosY-0.222, 0.024, " Taste X: Arbeitstellung"); end; if self.isExpanded and self.isExpandedCultivator then renderText(self.helpPanelTextPosX, self.helpPanelTextPosY-0.258, 0.024, " Taste V: Gerät ausheben"); else renderText(self.helpPanelTextPosX, self.helpPanelTextPosY-0.258, 0.024, " Taste V: Gerät ablassen"); end; else g_currentMission:addExtraPrintText("Taste 0: Lemken Gigant 1000: Hilfe an"); end; end; function Lemken_Gigant:onAttach(attacherVehicle) self.TurnRadiusBackup = self.attacherVehicle.aiTractorTurnRadius; self.attacherVehicle.aiTractorTurnRadius = 0; end; function Lemken_Gigant:onDetach() Trailer.onDetach(self); Utils.setEmittingState(self.threshingParticleSystems1, false); Utils.setEmittingState(self.threshingParticleSystems2, false); Utils.setEmittingState(self.threshingParticleSystems3, false); Utils.setEmittingState(self.threshingParticleSystems4, false); Utils.setEmittingState(self.threshingParticleSystems5, false); Utils.setEmittingState(self.threshingParticleSystems6, false); Utils.setEmittingState(self.threshingParticleSystems7, false); Utils.setEmittingState(self.threshingParticleSystems8, false); Utils.setEmittingState(self.threshingParticleSystems9, false); Utils.setEmittingState(self.threshingParticleSystems10, false); Utils.setEmittingState(self.threshingParticleSystems11, false); Utils.setEmittingState(self.threshingParticleSystems12, false); Utils.setEmittingState(self.threshingParticleSystems13, false); Utils.setEmittingState(self.threshingParticleSystems14, false); Utils.setEmittingState(self.threshingParticleSystems15, false); Utils.setEmittingState(self.threshingParticleSystems16, false); stopSample(self.workSound); self.translationMax = false; self.attacherBackup.aiTractorTurnRadius = self.TurnRadiusBackup; self.attacherVehicle = self.attacherBackup; self.attacherVehicle = nil; self.attacherBackup = nil; end; function Utils.destroyCompleteArea(startWorldX, startWorldZ, widthWorldX, widthWorldZ, heightWorldX, heightWorldZ) local meadowId = g_currentMission.meadowId; local cuttedMeadowId = g_currentMission.cuttedMeadowId; Utils.updateDensity(meadowId, startWorldX, startWorldZ, widthWorldX, widthWorldZ, heightWorldX, heightWorldZ, 0, 0); Utils.updateDensity(cuttedMeadowId, startWorldX, startWorldZ, widthWorldX, widthWorldZ, heightWorldX, heightWorldZ, 0, 0); end; function Lemken_Gigant:delete() end; function Lemken_Gigant:mouseEvent(posX, posY, isDown, isUp, button) end; function Lemken_Gigant:aiLower() self.rotationMaxMain = not self.rotationMaxMain self.rotationMaxZylinderMain1 = not self.rotationMaxZylinderMain1; self.translationMaxZylinderMain1 = not self.translationMaxZylinderMain1; self.isExpandedCultivator = true; end; function Lemken_Gigant:aiRaise() self.rotationMaxMain = not self.rotationMaxMain self.rotationMaxZylinderMain1 = not self.rotationMaxZylinderMain1; self.translationMaxZylinderMain1 = not self.translationMaxZylinderMain1; self.isExpandedCultivator = true; end;