Continuing rewriting engine
This commit is contained in:
29
koptilnya/engine_remastered/gearboxes/manual.txt
Normal file
29
koptilnya/engine_remastered/gearboxes/manual.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
ManualGearbox = class('ManualGearbox')
|
||||
|
||||
function ManualGearbox:initialize(config)
|
||||
self.ratios = config.Ratios
|
||||
self.reverse = config.Reverse
|
||||
|
||||
self.rpm = 0
|
||||
self.torque = 0
|
||||
self.gear = 0
|
||||
|
||||
self:recalcRatio()
|
||||
|
||||
self.axles = {}
|
||||
self.clutch = {}
|
||||
end
|
||||
|
||||
function ManualGearbox:update()
|
||||
if self.clutch ~= nil then
|
||||
self.torque = self.clutch.torque * self.ratio
|
||||
end
|
||||
|
||||
local axlesRPM = table.map(self.axles, function(diff)
|
||||
return diff.avgRPM
|
||||
end)
|
||||
|
||||
local maxAxlesRPM = math.max(unpack(axlesRPM))
|
||||
|
||||
self.rpm = maxAxlesRPM * self.ratio
|
||||
end
|
||||
Reference in New Issue
Block a user