Skip to content

Commit

Permalink
1.2.1.0 - added headland trigger distance sound
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhooL committed Feb 18, 2022
1 parent 68939ff commit 18be3c7
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 32 deletions.
59 changes: 41 additions & 18 deletions FS22_EnhancedVehicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
--
-- Author: Majo76
-- email: [email protected]
-- @Date: 30.01.2022
-- @Version: 1.2.0.1
-- @Date: 18.02.2022
-- @Version: 1.2.1.0

--[[
CHANGELOG
2022-02-18 - V1.2.1.0
+ added "tüdelü" sound when approaching headland trigger (thx "andre020478" for the sample)
+ added config menu option to specify the distance to headland for the alarm sound
* translation updates
2022-01-30 - V1.2.0.1
* bugfix for parking brake status not saved to savegame
Expand Down Expand Up @@ -265,7 +270,7 @@ function FS22_EnhancedVehicle:new(mission, modDirectory, modName, i18n, gui, inp
if g_dedicatedServerInfo == nil then
local file, id
FS22_EnhancedVehicle.sounds = {}
for _, id in ipairs({"diff_lock", "brakeOn", "brakeOff", "snap_on", "snap_off"}) do
for _, id in ipairs({"diff_lock", "brakeOn", "brakeOff", "snap_on", "snap_off", "hl_approach"}) do
FS22_EnhancedVehicle.sounds[id] = createSample(id)
file = self.modDirectory.."resources/"..id..".ogg"
loadSample(FS22_EnhancedVehicle.sounds[id], file, false)
Expand Down Expand Up @@ -448,6 +453,7 @@ function FS22_EnhancedVehicle:activateConfig()
FS22_EnhancedVehicle.track.hideLinesAfter = lC:getConfigValue("track", "hideLinesAfter")
FS22_EnhancedVehicle.track.hideLinesAfterValue = 0
FS22_EnhancedVehicle.track.color = { lC:getConfigValue("track.color", "red"), lC:getConfigValue("track.color", "green"), lC:getConfigValue("track.color", "blue") }
FS22_EnhancedVehicle.track.headlandSoundTriggerDistance = lC:getConfigValue("track", "headlandSoundTriggerDistance")

-- HUD stuff
for _, section in pairs(FS22_EnhancedVehicle.sections) do
Expand All @@ -464,9 +470,10 @@ function FS22_EnhancedVehicle:activateConfig()
FS22_EnhancedVehicle.hud.colorStandby = { lC:getConfigValue("hud.colorStandby", "red"), lC:getConfigValue("hud.colorStandby", "green"), lC:getConfigValue("hud.colorStandby", "blue"), 1 }

FS22_EnhancedVehicle.sfx_volume = {}
FS22_EnhancedVehicle.sfx_volume.track = lC:getConfigValue("sfx.track", "volume")
FS22_EnhancedVehicle.sfx_volume.brake = lC:getConfigValue("sfx.brake", "volume")
FS22_EnhancedVehicle.sfx_volume.diff = lC:getConfigValue("sfx.diff", "volume")
FS22_EnhancedVehicle.sfx_volume.track = lC:getConfigValue("sfx.track", "volume")
FS22_EnhancedVehicle.sfx_volume.brake = lC:getConfigValue("sfx.brake", "volume")
FS22_EnhancedVehicle.sfx_volume.diff = lC:getConfigValue("sfx.diff", "volume")
FS22_EnhancedVehicle.sfx_volume.hl_approach = lC:getConfigValue("sfx.hl_approach", "volume")
end

-- #############################################################################
Expand Down Expand Up @@ -506,14 +513,15 @@ function FS22_EnhancedVehicle:resetConfig(disable)
lC:addConfigValue("snap.colorAttachmentSideLine", "blue", "float", 0/255)

-- track
lC:addConfigValue("track", "distanceAboveGround", "float", 0.15)
lC:addConfigValue("track", "numberOfTracks", "int", 5)
lC:addConfigValue("track", "showLines", "int", 1)
lC:addConfigValue("track", "hideLines", "bool", false)
lC:addConfigValue("track", "hideLinesAfter", "int", 5)
lC:addConfigValue("track.color", "red", "float", 255/255)
lC:addConfigValue("track.color", "green", "float", 150/255)
lC:addConfigValue("track.color", "blue", "float", 0/255)
lC:addConfigValue("track", "distanceAboveGround", "float", 0.15)
lC:addConfigValue("track", "numberOfTracks", "int", 5)
lC:addConfigValue("track", "showLines", "int", 1)
lC:addConfigValue("track", "hideLines", "bool", false)
lC:addConfigValue("track", "hideLinesAfter", "int", 5)
lC:addConfigValue("track.color", "red", "float", 255/255)
lC:addConfigValue("track.color", "green", "float", 150/255)
lC:addConfigValue("track.color", "blue", "float", 0/255)
lC:addConfigValue("track", "headlandSoundTriggerDistance", "int", 10)

-- fuel
lC:addConfigValue("hud.fuel", "enabled", "bool", true)
Expand Down Expand Up @@ -569,9 +577,10 @@ function FS22_EnhancedVehicle:resetConfig(disable)
lC:addConfigValue("hud.colorStandby", "blue", "float", 0/255)

-- sound volumes
lC:addConfigValue("sfx.track", "volume", "float", 0.10)
lC:addConfigValue("sfx.brake", "volume", "float", 0.10)
lC:addConfigValue("sfx.diff", "volume", "float", 0.50)
lC:addConfigValue("sfx.track", "volume", "float", 0.10)
lC:addConfigValue("sfx.brake", "volume", "float", 0.10)
lC:addConfigValue("sfx.diff", "volume", "float", 0.50)
lC:addConfigValue("sfx.hl_approach", "volume", "float", 0.10)
end

-- #############################################################################
Expand Down Expand Up @@ -791,7 +800,21 @@ function FS22_EnhancedVehicle:onUpdate(dt)
-- get distance to end-of-field each second
if self.vData.track.eofNext < g_currentMission.time then
FS22_EnhancedVehicle:getHeadlandDistance(self)
self.vData.track.eofNext = g_currentMission.time + 1000
self.vData.track.eofNext = g_currentMission.time + 500

-- play sound
if self.vData.is[5] and self.vData.is[6] then
if self.vData.track.headlandMode >= 1 and self.vData.track.isOnField > 5 and self.vData.track.eofDistance > 0 then
if self.vData.track.eofDistance < FS22_EnhancedVehicle.track.headlandSoundTriggerDistance then
if self.vData.track.hl_samplePlayed == nil then
playSample(FS22_EnhancedVehicle.sounds["hl_approach"], 1, Between(FS22_EnhancedVehicle.sfx_volume.hl_approach, 0, 10), 0, 0, 0)
self.vData.track.hl_samplePlayed = true
end
else
self.vData.track.hl_samplePlayed = nil
end
end
end
end

-- headland management
Expand Down
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<author>Majo76</author>
<contributors>dziuch</contributors>

<version>1.2.0.1</version>
<version>1.2.1.0</version>

<title>
<de>EnhancedVehicle</de>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_cs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="场地结束前"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="场地结束后"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="未启用轨迹助手."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="找不到具有工作宽度的设备. 使用默认轨道布局."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="工作宽度已重新计算."/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_cz.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="Před koncem pole"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="Za koncem pole"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="Asistent pro jízdu v pruhu není povolen."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Nenalezeno zařízení s pracovní šířkou. Použito výchozí rozložení stopy."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="Pracovní záběr byl přepočítán."/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="vor dem Feldende"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="hinter dem Feldende"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarmsound Abstand"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Legt fest, wieviel Meter vor dem Vorgewende ein Alarmsound gespielt wird"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="Der Fahrspurassistent ist nicht aktiviert."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Kein Gerät mit einer Arbeitsbreite gefunden. Verwende Standard-Fahrspuren."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="Die Arbeitsbreite wurde neu berechnet."/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="before end of field"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="behind end of field"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="Track Assistant is not enabled."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Did not find a device with a working width. Using a default track layout."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="The working width was recalculated."/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="Avant le bord du champ"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="Après le bord du champ"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="L'assistant de ligne n'est pas activé."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Aucun équipement avec largeur de travail détecté. Using a default track layout."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="The working width was recalculated."/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_it.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="Prima della fine del campo"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="Dopo la fine del campo"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="L'assistente di corsia non è attivato."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Nessun dispositivo trovato con una larghezza di lavoro. Using a default track layout."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="The working width was recalculated."/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_jp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="畑(フィールド)内"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="畑(フィールド)外"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="自動操舵が有効になっていません"/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="作業機(作業幅)が見つからなかった為、デフォルトの走行ラインを設定しました"/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="作業幅を再設定しました"/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_pl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="przed końcem pola"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="za końcem pola"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="TAsystent ścieżek nie jest włączony."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Nie znalazłem urządzenia o szerokości roboczej. Using a default track layout."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="The working width was recalculated."/>
Expand Down
3 changes: 3 additions & 0 deletions translations/translation_pt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="before end of field"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="behind end of field"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="Track Assistant is not enabled."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Did not find a device with a working width. Using a default track layout."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="The working width was recalculated."/>
Expand Down
25 changes: 14 additions & 11 deletions translations/translation_ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<texts>
<text name="input_FS22_EnhancedVehicle_SNAP_ONOFF" text="EV: Привязать текущее направление"/>
<text name="input_FS22_EnhancedVehicle_SNAP_REVERSE" text="EV: Обратное направление привязки (180°)"/>
<text name="input_FS22_EnhancedVehicle_SNAP_OPMODE" text="EV: Switch operational mode (snap direction/track)"/>
<text name="input_FS22_EnhancedVehicle_SNAP_OPMODE" text="EV: Переключить режим работы (привязать направление/трек)"/>
<text name="input_FS22_EnhancedVehicle_SNAP_ANGLE1_1" text="EV: Увеличить направление привязки на 1°"/>
<text name="input_FS22_EnhancedVehicle_SNAP_ANGLE1_2" text="EV: Уменьшить направление привязки на 1°"/>
<text name="input_FS22_EnhancedVehicle_SNAP_ANGLE2_1" text="EV: Увеличить направление привязки на 45°"/>
<text name="input_FS22_EnhancedVehicle_SNAP_ANGLE2_2" text="EV: Уменьшить направление привязки на 45°"/>
<text name="input_FS22_EnhancedVehicle_SNAP_ANGLE3_1" text="EV: Увеличить направление привязки на 90°"/>
<text name="input_FS22_EnhancedVehicle_SNAP_ANGLE3_2" text="EV: Уменьшить направление привязки на 90°"/>
<text name="input_FS22_EnhancedVehicle_SNAP_CALC_WW" text="EV: (Re)calculate working width"/>
<text name="input_FS22_EnhancedVehicle_SNAP_CALC_WW" text="EV: (Пере)рассчитать рабочую ширину"/>
<text name="input_FS22_EnhancedVehicle_SNAP_GRID_RESET" text="EV: Сбросить сетку"/>
<text name="input_FS22_EnhancedVehicle_SNAP_LINES_MODE" text="EV: Change display mode of lines"/>
<text name="input_FS22_EnhancedVehicle_SNAP_LINES_MODE" text="EV: Изменить режим отображения линий"/>
<text name="input_FS22_EnhancedVehicle_SNAP_TRACK_1" text="EV: Увеличить количество поворотных полос"/>
<text name="input_FS22_EnhancedVehicle_SNAP_TRACK_2" text="EV: Уменьшить количество поворотных полос"/>
<text name="input_FS22_EnhancedVehicle_SNAP_TRACKP_1" text="EV: Сдвинуть полосу вправо"/>
Expand Down Expand Up @@ -102,12 +102,12 @@
<text name="ui_FS22_EnhancedVehicle_visibleTracksTitle" text="Количество видимых полос"/>
<text name="ui_FS22_EnhancedVehicle_visibleTracksTT" text="Сколько всего показано полос(слева + справа от транспорта)"/>

<text name="ui_FS22_EnhancedVehicle_showLinesTitle" text="Show lines"/>
<text name="ui_FS22_EnhancedVehicle_showLinesTT" text="Specifies which kind of lines are shown"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption1" text="All"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption2" text="None"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption3" text="Tracks only"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption4" text="Vehicle+working width only"/>
<text name="ui_FS22_EnhancedVehicle_showLinesTitle" text="Показать линии"/>
<text name="ui_FS22_EnhancedVehicle_showLinesTT" text="Указывает, какие линии отображаются"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption1" text="Все"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption2" text="Никакие"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption3" text="Только полосы"/>
<text name="ui_FS22_EnhancedVehicle_showLinesOption4" text="Только транспортное средство+рабочая ширина"/>

<text name="ui_FS22_EnhancedVehicle_hideLinesTitle" text="Автоматически скрывать направляющие линии"/>
<text name="ui_FS22_EnhancedVehicle_hideLinesTT" text="Будут ли скрываться автоматически вспомогательные и направляющие линии"/>
Expand All @@ -126,9 +126,12 @@
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionBefore" text="до края поля"/>
<text name="ui_FS22_EnhancedVehicle_headlandDistanceOptionAfter" text="за краем поля"/>

<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTitle" text="Alarm sound distance"/>
<text name="ui_FS22_EnhancedVehicle_headlandSoundTriggerDistanceTT" text="Specifies how many meters before headland is reached an alarm sound is played"/>

<text name="global_FS22_EnhancedVehicle_snapNotEnabled" text="Помощник направления не включен."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Did not find a device with a working width. Using a default track layout."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="The working width was recalculated."/>
<text name="global_FS22_EnhancedVehicle_snapNoImplement" text="Не нашел устройства с рабочей шириной. Использую настройки по умолчанию."/>
<text name="global_FS22_EnhancedVehicle_workWidthUpdated" text="Рабочая ширина была пересчитана."/>
<text name="global_FS22_EnhancedVehicle_brakeBlocks" text="Сначала отпустите ручной тормоз."/>

</texts>
Expand Down
Loading

0 comments on commit 18be3c7

Please sign in to comment.