Skip to content

Commit

Permalink
v2.0 conversion to FS17
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogli12 committed Oct 26, 2016
1 parent 800d93e commit 09aaf8d
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 97 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# KeyboardSteer for Farming Simulator 2015
# KeyboardSteer for Farming Simulator 2017

## Motivation
Although I have a steering wheel, but almost always play with the keyboard. On winding roads, I am again and again landed in the ditch in front of nights or power poles.
Expand Down
10 changes: 1 addition & 9 deletions deploy.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
@echo "mods"
@xcopy zzzKeyboardSteer.zip "C:\Users\d027464\Documents\My Games\FarmingSimulator2015\mods" /R/U/Y/Q
@echo "mods_mig"
@xcopy zzzKeyboardSteer.zip "C:\Users\d027464\Documents\My Games\FarmingSimulator2015\mods_mig" /R/U/Y/Q
@echo "mods_holz"
@xcopy zzzKeyboardSteer.zip "C:\Users\d027464\Documents\My Games\FarmingSimulator2015\mods_holz" /R/U/Y/Q
@echo "mods_wild"
@xcopy zzzKeyboardSteer.zip "C:\Users\d027464\Documents\My Games\FarmingSimulator2015\mods_wild" /R/U/Y/Q
@echo "mods_lim"
@xcopy zzzKeyboardSteer.zip "C:\Users\d027464\Documents\My Games\FarmingSimulator2015\mods_lim" /R/U/Y/Q
@xcopy zzzKeyboardSteer.zip "C:\Users\d027464\Documents\My Games\FarmingSimulator2017\mods" /R/U/Y/Q
Binary file modified zzzKeyboardSteer.zip
Binary file not shown.
49 changes: 11 additions & 38 deletions zzzKeyboardSteer/keyboardSteerMogli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function keyboardSteerMogli:isValidCam( index, createIfMissing )
return false
end

function keyboardSteerMogli:load(xmlFile)
function keyboardSteerMogli:load(savegame)
self.ksmScaleFx = keyboardSteerMogli.scaleFx
self.ksmSetState = keyboardSteerMogli.mbSetState
self.ksmIsValidCam = keyboardSteerMogli.isValidCam
Expand All @@ -140,7 +140,6 @@ function keyboardSteerMogli:load(xmlFile)
keyboardSteerMogli.registerState( self, "ksmCamFwd" , true , keyboardSteerMogli.ksmOnSetCamFwd )
keyboardSteerMogli.registerState( self, "ksmExponent" , 1 , keyboardSteerMogli.ksmOnSetFactor )
keyboardSteerMogli.registerState( self, "ksmWarningText" , "" , keyboardSteerMogli.ksmOnSetWarningText )
keyboardSteerMogli.registerState( self, "ksmMirror" , true , keyboardSteerMogli.ksmOnSetMirror )
keyboardSteerMogli.registerState( self, "ksmLCtrlPressed", false )
keyboardSteerMogli.registerState( self, "ksmLShiftPressed", false )

Expand All @@ -157,8 +156,6 @@ function keyboardSteerMogli:load(xmlFile)
self.ksmLastAxisFwd = 0
self.ksmDirChangeTimer= 0
self.ksmChangeDir = false
self.ksmAddMirror = true
self.mirrorAvailable = self.ksmMirror

if KSMGlobals.ksmSteeringIsOn then
self:ksmSetState( "ksmSteeringIsOn", true, true )
Expand Down Expand Up @@ -190,8 +187,6 @@ function keyboardSteerMogli:update(dt)
elseif InputBinding.hasEvent(InputBinding.ksmMINUS) then
self:ksmSetState( "ksmExponent", self.ksmExponent -1 )
self:ksmSetState( "ksmWarningText", string.format("Sensitivity %3.0f %%", 100 * self.ksmFactor, true ) )
elseif self.ksmAddMirror and InputBinding.hasEvent(InputBinding.ksmMIRROR) then
self:ksmSetState( "ksmMirror", not self.ksmMirror )
elseif InputBinding.hasEvent(InputBinding.ksmENABLE) then
self:ksmSetState( "ksmSteeringIsOn", not self.ksmSteeringIsOn )
elseif InputBinding.hasEvent(InputBinding.ksmCAMERA) then
Expand Down Expand Up @@ -377,27 +372,23 @@ end

function keyboardSteerMogli:draw()
if self.ksmLCtrlPressed then
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmPLUS"), InputBinding.ksmPLUS)
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmMINUS"), InputBinding.ksmMINUS)

if self.ksmAddMirror then
if self.ksmMirror then
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmMIRROR_ON"), InputBinding.ksmMIRROR)
if self.ksmLShiftPressed then
if self.ksmAnalogIsOn then
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmANALOG_ON"), InputBinding.ksmANALOG)
else
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmMIRROR_OFF"), InputBinding.ksmMIRROR)
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmANALOG_OFF"), InputBinding.ksmANALOG)
end
else
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("input_ksmPLUS"), InputBinding.ksmPLUS)
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("input_ksmMINUS"), InputBinding.ksmMINUS)
end

elseif KSMGlobals.ksmDrawIsOn or self.ksmLShiftPressed then
if self.ksmSteeringIsOn then
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmENABLE_ON"), InputBinding.ksmENABLE)
else
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmENABLE_OFF"), InputBinding.ksmENABLE)
end
if self.ksmAnalogIsOn then
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmANALOG_ON"), InputBinding.ksmANALOG)
else
g_currentMission:addHelpButtonText(keyboardSteerMogli.getText("ksmANALOG_OFF"), InputBinding.ksmANALOG)
end

if self:ksmIsValidCam() then
if self.ksmCameraIsOn then
Expand Down Expand Up @@ -466,9 +457,6 @@ function keyboardSteerMogli:getSaveAttributesAndNodes(nodeIdent)
if self.ksmAnalogIsOn ~= nil and self.ksmAnalogIsOn ~= KSMGlobals.enableAnalogCtrl then
attributes = attributes.." ksmAnalogIsOn=\"" .. tostring(self.ksmAnalogIsOn) .. "\""
end
if self.ksmMirror ~= nil and self.ksmMirror ~= true then
attributes = attributes.." ksmMirror=\"" .. tostring(self.ksmMirror) .. "\""
end

for i,b in pairs(self.ksmCameras) do
if b.rotation ~= keyboardSteerMogli.getDefaultRotation( self, i ) then
Expand All @@ -494,10 +482,6 @@ function keyboardSteerMogli:loadFromAttributesAndNodes(xmlFile, key, resetVehicl
if b ~= nil then
self.ksmAnalogIsOn = b
end
b = getXMLBool(xmlFile, key .. "#ksmMirror" )
if b ~= nil then
self:ksmSetState( "ksmMirror", b, true )
end

if self.ksmCameras == nil then
self.ksmCameras = {}
Expand Down Expand Up @@ -528,7 +512,7 @@ function keyboardSteerMogli:scaleFx( fx, mi, ma )
return Utils.clamp( 1 + self.ksmFactor * ( fx - 1 ), mi, ma )
end

function keyboardSteerMogli:newUpdateVehiclePhysics( superFunc, axisForward, axisForwardIsAnalog, axisSide, axisSideIsAnalog, dt)
function keyboardSteerMogli:newUpdateVehiclePhysics( superFunc, axisForward, axisForwardIsAnalog, axisSide, axisSideIsAnalog, doHandbrake, dt, ... )
local backup1 = self.autoRotateBackSpeed
local backup2 = self.minRotTime
local backup3 = self.maxRotTime
Expand Down Expand Up @@ -618,7 +602,7 @@ function keyboardSteerMogli:newUpdateVehiclePhysics( superFunc, axisForward, axi
self.ksmLastAxisFwd = math.min( axisForward, self.ksmLastAxisFwd + KSMGlobals.axisForwardSmooth * dt )
end

local state, result = pcall( superFunc, self, axisForward, axisForwardIsAnalog, axisSide, axisSideIsAnalog, dt )
local state, result = pcall( superFunc, self, axisForward, axisForwardIsAnalog, axisSide, axisSideIsAnalog, doHandbrake, dt, ... )
if not ( state ) then
print("Error in updateVehiclePhysics :"..tostring(result))
end
Expand Down Expand Up @@ -685,17 +669,6 @@ function keyboardSteerMogli:ksmSetCameraFwd( camFwd )
end
end

function keyboardSteerMogli:ksmOnSetMirror( old, new, noEventSend )
self.ksmMirror = new

if self.ksmAddMirror then
self.mirrorAvailable = new
if self.cameras[self.camIndex].useMirror then
self.setMirrorVisible(self, new)
end
end
end

function keyboardSteerMogli:ksmOnSetFactor( old, new, noEventSend )
self.ksmExponent = new
self.ksmFactor = 1.1 ^ new
Expand Down
29 changes: 14 additions & 15 deletions zzzKeyboardSteer/modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="23">
<modDesc descVersion="32">
<author>mogli</author>
<title>
<en>keyboardSteer</en>
Expand All @@ -15,25 +15,24 @@
</description>
<multiplayer supported="true"/>
<iconFilename>store.dds</iconFilename>
<version>1.9.0.1</version>
<version>2.0.0.0</version>
<l10n filenamePrefix="modDesc_l10n">
<text name="ksmVERSION">
<de>keyboardSteer v1.9 rc1</de>
<en>keyboardSteer v1.9 rc1</en>
<de>keyboardSteer v2.0</de>
<en>keyboardSteer v2.0</en>
</text>
</l10n>
<inputBindings>
<input name="ksmENABLE" key1="KEY_lshift KEY_e" button="" category="VEHICLE" />
<input name="ksmCAMERA" key1="KEY_lshift KEY_c" button="" category="VEHICLE" />
<input name="ksmREVERSE" key1="KEY_lshift KEY_r" button="" category="VEHICLE" />
<input name="ksmANALOG" key1="KEY_lshift KEY_lctrl KEY_c" button="" category="VEHICLE" />
<input name="ksmPLUS" key1="KEY_lctrl KEY_e" button="" category="VEHICLE" />
<input name="ksmMINUS" key1="KEY_lctrl KEY_c" button="" category="VEHICLE" />
<input name="ksmMIRROR" key1="KEY_lctrl KEY_r" button="" category="VEHICLE" />
<input name="ksmUP" key1="KEY_rshift KEY_up" button="" category="VEHICLE" />
<input name="ksmDOWN" key1="KEY_rshift KEY_down" button="" category="VEHICLE" />
<input name="ksmLEFT" key1="KEY_rshift KEY_left" button="" category="VEHICLE" />
<input name="ksmRIGHT" key1="KEY_rshift KEY_right" button="" category="VEHICLE" />
<input name="ksmENABLE" hidden="true" key1="KEY_lshift KEY_e" button="" category="VEHICLE" />
<input name="ksmCAMERA" hidden="true" key1="KEY_lshift KEY_c" button="" category="VEHICLE" />
<input name="ksmREVERSE" hidden="true" key1="KEY_lshift KEY_r" button="" category="VEHICLE" />
<input name="ksmANALOG" hidden="true" key1="KEY_lshift KEY_lctrl KEY_c" button="" category="VEHICLE" />
<input name="ksmPLUS" hidden="true" key1="KEY_lctrl KEY_e" button="" category="VEHICLE" />
<input name="ksmMINUS" hidden="true" key1="KEY_lctrl KEY_c" button="" category="VEHICLE" />
<input name="ksmUP" hidden="true" key1="KEY_rshift KEY_up" button="" category="VEHICLE" />
<input name="ksmDOWN" hidden="true" key1="KEY_rshift KEY_down" button="" category="VEHICLE" />
<input name="ksmLEFT" hidden="true" key1="KEY_rshift KEY_left" button="" category="VEHICLE" />
<input name="ksmRIGHT" hidden="true" key1="KEY_rshift KEY_right" button="" category="VEHICLE" />
</inputBindings>
<extraSourceFiles>
<sourceFile filename="register.lua" />
Expand Down
24 changes: 10 additions & 14 deletions zzzKeyboardSteer/modDesc_l10n_de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@
<text name="ksmANALOG_OFF" text="Analog Controller [aus]"/>
<text name="ksmREVERSE_ON" text="Zurückblicken [an]"/>
<text name="ksmREVERSE_OFF" text="Zurückblicken [aus]"/>
<text name="ksmPLUS" text="Geschwindigkeitsabh. +"/>
<text name="ksmMINUS" text="Geschwindigkeitsabh. -"/>
<text name="ksmMIRROR_ON" text="Spiegel [an]"/>
<text name="ksmMIRROR_OFF" text="Spiegel [aus]"/>

<text name="ksmENABLE" text="keyboardSteerMogli: Lenkung"/>
<text name="ksmCAMERA" text="keyboardSteerMogli: Kamerabewegung"/>
<text name="ksmREVERSE" text="keyboardSteerMogli: Zurückblicken"/>
<text name="ksmANALOG" text="keyboardSteerMogli: Analog Controller"/>
<text name="ksmMIRROR" text="keyboardSteerMogli: Spiegel"/>

<text name="ksmUP" text="keyboardSteerMogli: Nach vorne schauen"/>
<text name="ksmDOWN" text="keyboardSteerMogli: Nach hinten schauen"/>
<text name="ksmLEFT" text="keyboardSteerMogli: Nach links schauen"/>
<text name="ksmRIGHT" text="keyboardSteerMogli: Nach rechts schauen"/>
<text name="input_ksmENABLE" text="keyboardSteerMogli: Lenkung"/>
<text name="input_ksmCAMERA" text="keyboardSteerMogli: Kamerabewegung"/>
<text name="input_ksmREVERSE" text="keyboardSteerMogli: Zurückblicken"/>
<text name="input_ksmANALOG" text="keyboardSteerMogli: Analog Controller"/>
<text name="input_ksmPLUS" text="Geschwindigkeitsabh. +"/>
<text name="input_ksmMINUS" text="Geschwindigkeitsabh. -"/>
<text name="input_ksmUP" text="keyboardSteerMogli: Nach vorne schauen"/>
<text name="input_ksmDOWN" text="keyboardSteerMogli: Nach hinten schauen"/>
<text name="input_ksmLEFT" text="keyboardSteerMogli: Nach links schauen"/>
<text name="input_ksmRIGHT" text="keyboardSteerMogli: Nach rechts schauen"/>
</texts>
</l10n>
24 changes: 10 additions & 14 deletions zzzKeyboardSteer/modDesc_l10n_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@
<text name="ksmANALOG_OFF" text="analogue controller [off]"/>
<text name="ksmREVERSE_ON" text="look backwards [on]"/>
<text name="ksmREVERSE_OFF" text="look backwards [off]"/>
<text name="ksmPLUS" text="speed sensitivity +"/>
<text name="ksmMINUS" text="speed sensitivity -"/>
<text name="ksmMIRROR_ON" text="mirrors [on]"/>
<text name="ksmMIRROR_OFF" text="mirrors [off]"/>

<text name="ksmENABLE" text="keyboardSteerMogli: steering"/>
<text name="ksmCAMERA" text="keyboardSteerMogli: camera movement"/>
<text name="ksmREVERSE" text="keyboardSteerMogli: look backwards"/>
<text name="ksmANALOG" text="keyboardSteerMogli: analogue controller"/>
<text name="ksmMIRROR" text="keyboardSteerMogli: mirrors"/>

<text name="ksmUP" text="keyboardSteerMogli: look fwd"/>
<text name="ksmDOWN" text="keyboardSteerMogli: look back"/>
<text name="ksmLEFT" text="keyboardSteerMogli: look left"/>
<text name="ksmRIGHT" text="keyboardSteerMogli: look right"/>
<text name="input_ksmENABLE" text="keyboardSteerMogli: steering"/>
<text name="input_ksmCAMERA" text="keyboardSteerMogli: camera movement"/>
<text name="input_ksmREVERSE" text="keyboardSteerMogli: look backwards"/>
<text name="input_ksmANALOG" text="keyboardSteerMogli: analogue controller"/>
<text name="input_ksmPLUS" text="speed sensitivity +"/>
<text name="input_ksmMINUS" text="speed sensitivity -"/>
<text name="input_ksmUP" text="keyboardSteerMogli: look fwd"/>
<text name="input_ksmDOWN" text="keyboardSteerMogli: look back"/>
<text name="input_ksmLEFT" text="keyboardSteerMogli: look left"/>
<text name="input_ksmRIGHT" text="keyboardSteerMogli: look right"/>
</texts>
</l10n>
5 changes: 3 additions & 2 deletions zzzKeyboardSteer/mogliBase.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
-- 3.04 hide warnings of missing input bindings
-- 3.05 string support in globalsLoad
-- 3.06 degrees support in globalsLoad
-- 3.10 FS17 version

-- Usage: source(Utils.getFilename("mogliBase.lua", g_currentModDirectory));
-- _G[g_currentModDirectory.."mogliBase"].newClass( "AutoCombine", "acParameters" )

local mogliBaseVersion = 3.06
local mogliBaseVersion = 3.10
local mogliBaseClass = g_currentModName..".mogliBase"
local mogliEventClass = g_currentModName..".mogliEvent"
--local mogliEventClass_mt = g_currentModDirectory.."mogliEvent_mt"
Expand Down Expand Up @@ -231,7 +232,7 @@ else
--********************************
-- load
--********************************
function _newClass_:load(xmlFile)
function _newClass_:load(savegame)
-- should always be overwritten
_newClass_.registerState( self, "mogliBasicsDummy", false, _newClass_.debugEvent )
end
Expand Down
6 changes: 2 additions & 4 deletions zzzKeyboardSteer/register.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ function keyboardSteerMogli_Register:loadMap(name)
g_i18n.globalI18N.texts["ksmREVERSE_OFF"] = g_i18n:getText("ksmREVERSE_OFF");
g_i18n.globalI18N.texts["ksmANALOG_ON"] = g_i18n:getText("ksmANALOG_ON");
g_i18n.globalI18N.texts["ksmANALOG_OFF"] = g_i18n:getText("ksmANALOG_OFF");
g_i18n.globalI18N.texts["ksmPLUS"] = g_i18n:getText("ksmPLUS");
g_i18n.globalI18N.texts["ksmMINUS"] = g_i18n:getText("ksmMINUS");
g_i18n.globalI18N.texts["ksmMIRROR_ON"] = g_i18n:getText("ksmMIRROR_ON");
g_i18n.globalI18N.texts["ksmMIRROR_OFF"] = g_i18n:getText("ksmMIRROR_OFF");
g_i18n.globalI18N.texts["input_ksmPLUS"] = g_i18n:getText("input_ksmPLUS");
g_i18n.globalI18N.texts["input_ksmMINUS"] = g_i18n:getText("input_ksmMINUS");
end;
end;

Expand Down

0 comments on commit 09aaf8d

Please sign in to comment.