Continuing rewriting engine

This commit is contained in:
Ivan Grachyov
2021-11-12 00:29:52 +05:00
parent 902d2d18bb
commit 1650ac9a6d
9 changed files with 121 additions and 7 deletions

View File

@@ -1,18 +1,28 @@
-- Core components
--
-- @include ./engine.txt
-- @include ./clutch.txt
--
-- Helpers & stuff
-- @include ./factories/gearbox.txt
-- @include /koptilnya/libs/table.txt
require('./engine.txt')
require('./clutch.txt')
require('./factories/gearbox.txt')
require('/koptilnya/libs/table.txt')
Vehicle = class('Vehicle')
function Vehicle:initialize(config)
-- should probably validate config here
if config == nil then
throw('Vehicle config not provided')
end
-- self.clutch = Clutch:new(config.Clutch)
self.clutch = Clutch:new(config.Clutch)
self.engine = Engine:new(config.Engine, self.clutch)
-- self.gearbox = GearboxBuilder:create(config.Gearbox, self.clutch)
self.gearbox = GearboxFactory.create(config.Gearbox, self.clutch)
-- self.axles = table.map(config.Axles, function(config)
-- return Differential:new(config)
-- end)
@@ -20,7 +30,7 @@ function Vehicle:initialize(config)
-- return SystemsBuilder:create(config)
-- end)
self.components = {self.engine} -- , self.gearbox, self.clutch}
self.components = {self.clutch, self.engine} -- , self.gearbox, self.clutch}
-- self.components = table.add(self.components, self.axles)
-- self.components = table.add(self.components, self.systems)