Category | Farming Simulator 22 |
Created | 10.02.2024 08:12 |
MathiasHun | 10.02.2024 08:12 |
---|---|
Hello. My question is, why is the code below not working? Original stopMotor() function. I would like the motorStop sound not to be played when the motor is shut down. I made this part inactive, but you can still hear the motorStop sound when the motor is stopped. g_soundManager:playSample(spec.samples.motorStop) function RVB.registerOverwrittenFunctions(vehicleType) SpecializationUtil.registerOverwrittenFunction(vehicleType, "stopMotor", RVB.stopMotor) -- Motorized.lua end ---Stop motor -- @param boolean noEventSend no event send function RVB:stopMotor(noEventSend) if noEventSend == nil or noEventSend == false then if g_server ~= nil then g_server:broadcastEvent(SetMotorTurnedOnEvent.new(self, false), nil, nil, self) else g_client:getServerConnection():sendEvent(SetMotorTurnedOnEvent.new(self, false)) end end local spec = self.spec_motorized if spec.isMotorStarted then spec.isMotorStarted = false if self.isClient then if spec.exhaustParticleSystems ~= nil then for _, ps in pairs(spec.exhaustParticleSystems) do ParticleUtil.setEmittingState(ps, false) end end if spec.exhaustEffects ~= nil then for _, effect in pairs(spec.exhaustEffects) do setVisibility(effect.effectNode, false) end end if spec.exhaustFlap ~= nil then setRotation(spec.exhaustFlap.node, 0, 0, 0) end g_soundManager:stopSamples(spec.samples) --g_soundManager:playSample(spec.samples.motorStop) g_soundManager:stopSamples(spec.motorSamples) g_soundManager:stopSamples(spec.gearboxSamples) spec.isBrakeSamplePlaying = false g_animationManager:stopAnimations(spec.animationNodes) if spec.motorStartAnimation ~= nil then self:playAnimation(spec.motorStartAnimation, -1, nil, true) end end SpecializationUtil.raiseEvent(self, "onStopMotor") self.rootVehicle:raiseStateChange(Vehicle.STATE_CHANGE_MOTOR_TURN_OFF) end spec.motor.lastMotorRpm = 0 if self.setDashboardsDirty ~= nil then self:setDashboardsDirty() end end Thanks in advance for all your help |
Note: Log in to post. Create a new account here.