Continuing rewriting engine
This commit is contained in:
@@ -27,7 +27,8 @@ function Engine:initialize(config, clutch)
|
||||
self._fwInertia = self.flywheelMass * self.flywheelRadius ^ 2 / 2
|
||||
self._limiterTime = 0
|
||||
|
||||
self._clutch = clutch
|
||||
self.clutch = clutch
|
||||
clutch.engine = self
|
||||
end
|
||||
|
||||
function Engine:getInputs()
|
||||
@@ -39,13 +40,13 @@ end
|
||||
function Engine:getOutputs()
|
||||
return {
|
||||
RPM = 'number',
|
||||
Torque = 'number'
|
||||
Engine_Torque = 'number'
|
||||
}
|
||||
end
|
||||
|
||||
function Engine:updateOutputs()
|
||||
wire.ports.RPM = self.rpm
|
||||
wire.ports.Torque = self.torque
|
||||
wire.ports.Engine_Torque = self.torque
|
||||
end
|
||||
|
||||
function Engine:getThrottle()
|
||||
@@ -77,7 +78,7 @@ function Engine:update()
|
||||
|
||||
local realInitialTorque = maxInitialTorque * masterThrottle
|
||||
|
||||
local loadTorque = self._clutch and self._clutch.torque or 0
|
||||
local loadTorque = self.clutch and self.clutch.torque or 0
|
||||
|
||||
self.torque = realInitialTorque + self.friction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user