Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCraymer committed Aug 17, 2022
0 parents commit 69bb81d
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
*.zip
29 changes: 29 additions & 0 deletions AutomaticReelSpeed.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
AutomaticReelSpeed = {}

function AutomaticReelSpeed:onUpdate(dt, isActiveForInput, isActiveForInputIgnoreSelection, isSelected)
local spec = self.spec_turnOnVehicle

for i = 1, #spec.turnedOnAnimations do
local turnedOnAnimation = spec.turnedOnAnimations[i]
if turnedOnAnimation.name == "reelAnimation" and turnedOnAnimation.isTurnedOn then
local lastSpeed = math.ceil(self:getLastSpeed())
local workingSpeedLimit, isWorking = self:getSpeedLimit(true)
if not isWorking then
lastSpeed = 6
elseif lastSpeed < 2 then
lastSpeed = 2
elseif lastSpeed > 14 then
lastSpeed = 14
end

turnedOnAnimation.speedScale = (lastSpeed / 10) * 0.7
if turnedOnAnimation.speedScaleLast ~= nil and turnedOnAnimation.speedScaleLast ~= turnedOnAnimation.speedScale then
self:setAnimationSpeed(turnedOnAnimation.name, turnedOnAnimation.currentSpeed * turnedOnAnimation.speedScale)
end
turnedOnAnimation.speedScaleLast = turnedOnAnimation.speedScale
spec.turnedOnAnimations[i] = turnedOnAnimation
end
end
end

TurnOnVehicle.onUpdate = Utils.appendedFunction(TurnOnVehicle.onUpdate, AutomaticReelSpeed.onUpdate)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Automatic Reel Speed for Farming Simulator 22

__Important! This is an early version. Bugs may occur!__

This is a mod for realism fans. Modern combines are able to adjust the reel speed based on their driven speed. This script will just do that.

# Automatische Haspelgeschwindigkeit for Farming Simulator 22

__Achtung! Dies ist eine erste Version. Es können Bugs auftreten!__

Dieser Mod ist für Realismus-Fans. Moderne Mähdrescher können die Geschwindigkeit der Haspel des Schneidwerks automatisch der Fahrgeschwindigkeit anpassen. Dieses Script macht genau das.
Binary file added icon.dds
Binary file not shown.
Binary file added misc/FS22_AutomaticReelSpeed.afdesign
Binary file not shown.
Binary file added misc/FS22_AutomaticReelSpeed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions modDesc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="63">
<author>CptCray</author>
<version>0.1.0.0</version>
<title>
<en>Automatic Reel Speed</en>
<de>Automatische Haspelgeschwindigkeit</de>
</title>
<description>
<en><![CDATA[Adjusts the combine reel speed depending on driven speed]]></en>
<de><![CDATA[Passt die Geschwindigkeit der Drescher-Haspel entsprechend der Fahrgeschwindigkeit an]]></de>
</description>
<iconFilename>icon.dds</iconFilename>
<multiplayer supported="true"/>
<extraSourceFiles>
<sourceFile filename="AutomaticReelSpeed.lua"/>
</extraSourceFiles>
</modDesc>

0 comments on commit 69bb81d

Please sign in to comment.