-- -- farmerCar -- Specialization for farmer car mod -- -- @author Stefan Geiger -- @date 10/01/09 -- -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. farmerCar = {}; function farmerCar.prerequisitesPresent(specializations) return SpecializationUtil.hasSpecialization(Motorized, specializations); end; function farmerCar:load(xmlFile) hornSoundFile = Utils.getFilename("horn.wav", self.baseDirectory); self.hornSoundId = createSample("famerCarSound"); loadSample(self.hornSoundId, hornSoundFile, false); self.hornPlaying = false; self.tatuSoundId_an = false; self.tatuSoundId_laeuft = false; tatuSoundFile = Utils.getFilename("tatu1.wav", self.baseDirectory); self.tatuSoundId = createSample("famerCarSound"); loadSample(self.tatuSoundId, tatuSoundFile, false); end; function farmerCar:delete() delete(self.hornSoundId); delete(self.tatuSoundId); end; function farmerCar:mouseEvent(posX, posY, isDown, isUp, button) end; function farmerCar:keyEvent(unicode, sym, modifier, isDown) end; function farmerCar:update(dt) if self:getIsActiveForInput() and self:getIsActiveForSound() and InputBinding.isPressed(InputBinding.FARMER_CAR_HORN) then if not self.hornPlaying then playSample(self.hornSoundId, 0, 1, 0); self.hornPlaying = true; end; else if self.hornPlaying then stopSample(self.hornSoundId); self.hornPlaying = false; end; end; if self:getIsActiveForInput() and self:getIsActiveForSound() and InputBinding.isPressed(InputBinding.TATU) then self.tatuSoundId_an = not self.tatuSoundId_an; end; if self.tatuSoundId_an and not self.tatuSoundId_laeuft then playSample(self.tatuSoundId,0,1,0); self.tatuSoundId_laeuft = true; end; if self.tatuSoundId_laeuft and not self.tatuSoundId_an then stopSample(self.tatuSoundId); self.tatuSoundId_laeuft = false; end; end; function farmerCar:draw() g_currentMission:addHelpButtonText(g_i18n:getText("FarmerCarHorn"), InputBinding.FARMER_CAR_HORN); g_currentMission:addHelpButtonText(g_i18n:getText("Tatu"), InputBinding.TATU); end;