Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
v1.3 rc2
Browse files Browse the repository at this point in the history
New (alternative) way to specify the names of the mod and the xmlFile.
  • Loading branch information
Mogli12 committed Feb 4, 2016
1 parent acde878 commit 6cff5c7
Show file tree
Hide file tree
Showing 9 changed files with 972 additions and 472 deletions.
Binary file modified Documents/MotorNeu.xlsx
Binary file not shown.
Binary file added Documents/VehicleTypes.xlsx
Binary file not shown.
Binary file modified Documents/hydro.xlsx
Binary file not shown.
Binary file modified zzzMrGearboxAddon.zip
Binary file not shown.
20 changes: 10 additions & 10 deletions zzzMrGearboxAddon/modDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
</description>
<multiplayer supported="true"/>
<iconFilename>dds/store.dds</iconFilename>
<version>1.3.0.2</version>
<version>1.3.0.3</version>
<l10n>
<text name="mrGearboxMogliVERSION">
<de>Getriebe v1.3 rc2 von Mogli</de>
<en>Gearbox v1.3 rc2 by mogli</en></text>
<de>Getriebe v1.3 rc3 von Mogli</de>
<en>Gearbox v1.3 rc3 by mogli</en></text>
<text name="mrGearboxMogliSHIFTGEARUP"><de>Getriebe: Gang hoch</de><en>Gearbox: Gear up</en></text>
<text name="mrGearboxMogliSHIFTGEARDOWN"><de>Getriebe: Gang runter</de><en>Gearbox: Gear down</en></text>
<text name="mrGearboxMogliSHIFTRANGEUP"><de>Getriebe: Gruppe hoch</de><en>Gearbox: Range up</en></text>
Expand All @@ -43,13 +43,13 @@
<text name="mrGearboxMogliMINRPM"><de>Getriebe: Handgas</de><en>Gearbox: hand throttle</en></text>
<text name="mrGearboxMogliMINRPM_1"><de>Getriebe: Handgas runter</de><en>Gearbox: hand throttle</en></text>
<text name="mrGearboxMogliMINRPM_2"><de>Getriebe: Handgas rauf</de><en>Gearbox: hand throttle</en></text>
<text name="mrGearboxMogliGEAR1"><de>Getriebe: 1</de><en>Gearbox: 1</en></text>
<text name="mrGearboxMogliGEAR2"><de>Getriebe: 2</de><en>Gearbox: 2</en></text>
<text name="mrGearboxMogliGEAR3"><de>Getriebe: 3</de><en>Gearbox: 3</en></text>
<text name="mrGearboxMogliGEAR4"><de>Getriebe: 4</de><en>Gearbox: 4</en></text>
<text name="mrGearboxMogliGEAR5"><de>Getriebe: 5</de><en>Gearbox: 5</en></text>
<text name="mrGearboxMogliGEAR6"><de>Getriebe: 6</de><en>Gearbox: 6</en></text>
<text name="mrGearboxMogliGEARR"><de>Getriebe: 6</de><en>Gearbox: 6</en></text>
<text name="mrGearboxMogliGEAR1"><de>Getriebe: G27 1</de><en>Gearbox: G27 1</en></text>
<text name="mrGearboxMogliGEAR2"><de>Getriebe: G27 2</de><en>Gearbox: G27 2</en></text>
<text name="mrGearboxMogliGEAR3"><de>Getriebe: G27 3</de><en>Gearbox: G27 3</en></text>
<text name="mrGearboxMogliGEAR4"><de>Getriebe: G27 4</de><en>Gearbox: G27 4</en></text>
<text name="mrGearboxMogliGEAR5"><de>Getriebe: G27 5</de><en>Gearbox: G27 5</en></text>
<text name="mrGearboxMogliGEAR6"><de>Getriebe: G27 6</de><en>Gearbox: G27 6</en></text>
<text name="mrGearboxMogliGEARR"><de>Getriebe: G27 R</de><en>Gearbox: G27 R</en></text>
<text name="mrGearboxMogliGEARFWD"><de>Getriebe: forwärts</de><en>Gearbox: fwd</en></text>
<text name="mrGearboxMogliGEARBACK"><de>Getriebe: rückwärts</de><en>Gearbox: back</en></text>
<text name="mrGearboxMogliSPEEDLIMIT"><de>Getriebe: Begrenzer</de><en>Gearbox: limiter</en></text>
Expand Down
96 changes: 78 additions & 18 deletions zzzMrGearboxAddon/mrGearboxMogli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ mrGearboxMogliGlobals.grindingMinRpmDelta = 200
mrGearboxMogliGlobals.grindingMaxRpmSound = 600
mrGearboxMogliGlobals.grindingMaxRpmDelta = mrGearboxMogli.huge
mrGearboxMogliGlobals.hydroTransVolRatio = 0.2
mrGearboxMogliGlobals.defaultAIAllAuto = false


--**********************************************************************************************************
Expand Down Expand Up @@ -460,6 +461,25 @@ function mrGearboxMogli:initFromXml(xmlFile,xmlString,xmlSource,serverAndClient)
self.mrGbMS.MinTargetRpm = Utils.getNoNil(getXMLFloat(xmlFile, xmlString .. "#minTargetRpm"), 0.6 * self.mrGbMS.IdleRpm + 0.3 * self.mrGbMS.RatedRpm )
self.mrGbMS.IdleEnrichment = Utils.getNoNil(getXMLFloat(xmlFile, xmlString .. "#idleEnrichment"), 0.15 )

local indoorCameraIndexListString = getXMLString(xmlFile, xmlString .. "#indoorCameraIndexList")
self.mrGbMS.IndoorCameraIndexList = {}

if indoorCameraIndexListString == nil then
for i,c in pairs( self.cameras ) do
if c.isInside then
self.mrGbMS.IndoorCameraIndexList[i] = true
end
end
elseif string.len( indoorCameraIndexListString ) > 0 then
local indoorCameraIndexList = Utils.splitString( indoorCameraIndexListString, " " )
for _,s in pairs( indoorCameraIndexList ) do
local i = tonumber( s )
if i ~= nil and i > 0 then
self.mrGbMS.IndoorCameraIndexList[i] = true
end
end
end

--**************************************************************************************************
--**************************************************************************************************
self.mrGbMS.Engine = {}
Expand Down Expand Up @@ -801,11 +821,11 @@ function mrGearboxMogli:initFromXml(xmlFile,xmlString,xmlSource,serverAndClient)
local clutchEngagingTimeMs = getXMLFloat(xmlFile, xmlString .. "#clutchEngagingTimeMs")
if clutchEngagingTimeMs == nil then
if self.mrGbMS.TorqueConverter then
clutchEngagingTimeMs = 0
clutchEngagingTimeMs = 200
elseif getXMLBool(xmlFile, xmlString .. ".gears#automatic") then
clutchEngagingTimeMs = 500
else
clutchEngagingTimeMs = 2000 -- 1000 = 1s
clutchEngagingTimeMs = 5000 -- 1000 = 1s
end
end

Expand Down Expand Up @@ -1252,8 +1272,10 @@ function mrGearboxMogli:initFromXml(xmlFile,xmlString,xmlSource,serverAndClient)
if enableAI == nil then
if self.mrGbMS.Hydrostatic then
self.mrGbMS.EnableAI = "Y"
else
elseif mrGearboxMogliGlobals.defaultAIAllAuto then
self.mrGbMS.EnableAI = "A"
else
self.mrGbMS.EnableAI = "Y" --"A"
end
elseif enableAI then
self.mrGbMS.EnableAI = "Y"
Expand Down Expand Up @@ -2225,10 +2247,18 @@ function mrGearboxMogli:update(dt)

local isIndoor = false
if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle.cameras ~= nil then
for _,camera in pairs(g_currentMission.controlledVehicle.cameras) do
if camera.isInside and camera.isActivated then
isIndoor = true
break
for i,camera in pairs(g_currentMission.controlledVehicle.cameras) do
if camera.isActivated then
if g_currentMission.controlledVehicle.mrGbMS ~= nil
and type( g_currentMission.controlledVehicle.mrGbMS.IndoorCameraIndexList ) == "table" then
if g_currentMission.controlledVehicle.mrGbMS.IndoorCameraIndexList[i] then
isIndoor = true
break
end
elseif camera.isInside then
isIndoor = true
break
end
end
end
end
Expand Down Expand Up @@ -4536,11 +4566,11 @@ function mrGearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc
self:mrGbMSetNeutralActive( true )
end
elseif acc < -0.001 then
acceleration = -acc
acceleration = math.min( -acc-acc, 1 )
self:mrGbMSetReverseActive( true )
self:mrGbMSetNeutralActive( false )
elseif acc > 0.001 then
acceleration = acc
acceleration = math.min( acc+acc, 1 )
self:mrGbMSetReverseActive( false )
self:mrGbMSetNeutralActive( false )
else
Expand Down Expand Up @@ -4625,6 +4655,8 @@ function mrGearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc

local absAccelerationPedal = math.abs(accelerationPedal)
local wheelDriveTorque = 0

self.lastAcceleration = accelerationPedal

if next(self.differentials) ~= nil and self.motorizedNode ~= nil then
local torque = self.motor:getTorque(accelerationPedal, false)
Expand Down Expand Up @@ -4655,8 +4687,9 @@ function mrGearboxMogli:newUpdateWheelsPhysics( superFunc, dt, currentSpeed, acc
setVehicleProps(self.motorizedNode, torque, maxRotSpeed, ratio, c )

if self.mrGbML.debugTimer ~= nil and g_currentMission.time < self.mrGbML.debugTimer then
print(string.format("%4.0f Nm, %4.0f U/min, %4.0f U/min, %4.0f U/min, %4.0f U/min, %2.2f km/h %2.2f km/h, %3.1f, %3.1f, %3.1f, %3.0f%%, %d",
print(string.format("%4.0f Nm, %4.0f Nm, %4.0f U/min, %4.0f U/min, %4.0f U/min, %4.0f U/min, %2.2f km/h %2.2f km/h, %3.1f, %3.1f, %3.1f, %3.0f%%, %d",
torque*1000,
brakePedal*1000,
self.motor.nonClampedMotorRpm,
self.motor.wheelRpm,
self.motor.maxPossibleRpm,
Expand Down Expand Up @@ -6003,6 +6036,27 @@ function mrGearboxMogliMotor:mrGbMUpdateGear( accelerationPedal )
local bestSpeed = nil
local minSpeed = nil
local maxSpeed = nil

local maxDcSpeed = math.huge

if self.vehicle.dCcheckModule ~= nil
and self.vehicle:dCcheckModule("gasAndGearLimiter")
and self.vehicle.driveControl.gasGearLimiter.gearLimiter ~= nil
and self.vehicle.driveControl.gasGearLimiter.gearLimiter < 1.0 then

local maxGearSpeed = 0
for i = 1,maxGear do
local i2g, i2r = mrGearboxMogliMotor.splitGear( self, i )
local spd = gearMaxSpeed * self.vehicle.mrGbMS.Gears[i2g].speed * self.vehicle.mrGbMS.Ranges[i2r].ratio
if maxGearSpeed < spd then
maxGearSpeed = spd
end
end

if maxGearSpeed > 0 then
maxDcSpeed = self.vehicle.driveControl.gasGearLimiter.gearLimiter * maxGearSpeed
end
end

for i = 1,maxGear do
local i2g, i2r = mrGearboxMogliMotor.splitGear( self, i )
Expand All @@ -6018,11 +6072,22 @@ function mrGearboxMogliMotor:mrGbMUpdateGear( accelerationPedal )
local spd = gearMaxSpeed * self.vehicle.mrGbMS.Gears[i2g].speed * self.vehicle.mrGbMS.Ranges[i2r].ratio
local rpm = self.absWheelSpeedRpm * mrGearboxMogli.gearSpeedToRatio( self.vehicle, spd )

if spd > maxDcSpeed then
isValidEntry = false
end

if i ~= currentGear then
local checkG = false
local checkR = false

if self.vehicle:mrGbMGetAutoShiftGears() and self.vehicle:mrGbMGetAutoShiftRange() then
if isValidEntry and self.vehicle:mrGbMGetAutoShiftGears() and mrGearboxMogli.mrGbMIsNotValidEntry( self.vehicle, self.vehicle.mrGbMS.Gears[i2g], i2g, i2r ) then
isValidEntry = false
end
if isValidEntry and self.vehicle:mrGbMGetAutoShiftRange() and mrGearboxMogli.mrGbMIsNotValidEntry( self.vehicle, self.vehicle.mrGbMS.Ranges[i2r], i2g, i2r ) then
isValidEntry = false
end

if isValidEntry and self.vehicle:mrGbMGetAutoShiftGears() and self.vehicle:mrGbMGetAutoShiftRange() then
--if i2r ~= mrGearboxMogli.mrGbMGetRangeForNewGear( self.vehicle, i2g )
-- and i2g ~= mrGearboxMogli.mrGbMGetGearForNewRange( self.vehicle, i2r ) then
if self.vehicle.mrGbMS.GearTimeToShiftGear > self.vehicle.mrGbMS.GearTimeToShiftHl + 10 then
Expand All @@ -6049,7 +6114,8 @@ function mrGearboxMogliMotor:mrGbMUpdateGear( accelerationPedal )
end
end

if timeToShift > self.vehicle.mrGbMG.maxTimeToSkipGear
if isValidEntry
and timeToShift > self.vehicle.mrGbMG.maxTimeToSkipGear
and bestSpeed ~= nil
and bestSpeed > self.vehicle.mrGbMS.LaunchGearSpeed + mrGearboxMogli.eps
and bestSpeed > self.vehicle.mrGbML.currentGearSpeed + mrGearboxMogli.eps
Expand Down Expand Up @@ -6089,12 +6155,6 @@ function mrGearboxMogliMotor:mrGbMUpdateGear( accelerationPedal )
isValidEntry = false
end
end
if isValidEntry and self.vehicle:mrGbMGetAutoShiftGears() and mrGearboxMogli.mrGbMIsNotValidEntry( self.vehicle, self.vehicle.mrGbMS.Gears[i2g], i2g, i2r ) then
isValidEntry = false
end
if isValidEntry and self.vehicle:mrGbMGetAutoShiftRange() and mrGearboxMogli.mrGbMIsNotValidEntry( self.vehicle, self.vehicle.mrGbMS.Ranges[i2r], i2g, i2r ) then
isValidEntry = false
end
end

if isValidEntry then
Expand Down
Loading

1 comment on commit 6cff5c7

@Mogli12
Copy link
Owner Author

@Mogli12 Mogli12 commented on 6cff5c7 Feb 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#16

Please sign in to comment.