Continuing rewriting engine
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user