Finished stuff with manual gearbox

This commit is contained in:
Ivan Grachyov
2021-11-13 01:52:35 +05:00
parent b5fb04cce8
commit 54202989c1
9 changed files with 190 additions and 97 deletions

View File

@@ -2,12 +2,14 @@
--
-- @include ./engine.txt
-- @include ./clutch.txt
-- @include ./differential.txt
--
-- Helpers & stuff
-- @include ./factories/gearbox.txt
-- @include /koptilnya/libs/table.txt
require('./engine.txt')
require('./clutch.txt')
require('./differential.txt')
require('./factories/gearbox.txt')
require('/koptilnya/libs/table.txt')
@@ -23,20 +25,20 @@ function Vehicle:initialize(config)
self.clutch = Clutch:new(config.Clutch)
self.engine = Engine:new(config.Engine, self.clutch)
local axleOrder = 0
self.axles = table.map(config.Axles, function(config)
return Differential:new(config)
axleOrder = axleOrder + 1
return Differential:new(config, axleOrder)
end)
self.gearbox = GearboxFactory.create(config.Gearbox, self.clutch, self.axles)
-- self.axles = table.map(config.Axles, function(config)
-- return Differential:new(config)
-- end)
-- self.systems = table.map(config.Systems, function(config)
-- return SystemsBuilder:create(config)
-- return SystemsFactory.create(config)
-- end)
self.components = {self.clutch, self.engine, self.gearbox} -- , self.gearbox, self.clutch}
self.components = {self.clutch, self.engine, self.gearbox}
self.components = table.add(self.components, self.axles)
-- self.components = table.add(self.components, self.axles)
-- self.components = table.add(self.components, self.systems)
@@ -50,11 +52,6 @@ function Vehicle:initialize(config)
wire.adjustPorts(inputs, outputs)
-- for _, ent in self.entities do
-- ent:createInputs()
-- ent:createOutputs()
-- end
hook.add('tick', 'vehicle_update', function()
local outputs = {}