feat: ajout support des mixins
This commit is contained in:
parent
8006a7789b
commit
3001301a31
1 changed files with 24 additions and 1 deletions
|
@ -12,7 +12,30 @@ function BeastFile:new(folder, name)
|
|||
end
|
||||
|
||||
function BeastFile:readLines()
|
||||
local lines = parseFile(self.filepath, function (line) self.datas:addLine(line) end)
|
||||
self:readAllLines(self.filepath)
|
||||
end
|
||||
|
||||
function BeastFile:readAllLines(path)
|
||||
parseFile(path, function (line) self:addLine(line) end)
|
||||
end
|
||||
|
||||
function BeastFile:addLine(line)
|
||||
if (utils.startswith(line, "mixin;") or utils.startswith(line, "mixins;")) then
|
||||
local mixin = utils.split(line, ";", true)[2]
|
||||
self:loadMixin(mixin)
|
||||
elseif (utils.startswith(line, "type;") or utils.startswith(line, "types;")) then
|
||||
local mixin = utils.split(line, ";", true)[2]
|
||||
self:loadMixin("types/" .. mixin)
|
||||
else
|
||||
self.datas:addLine(line)
|
||||
end
|
||||
end
|
||||
|
||||
function BeastFile:loadMixin(mixin)
|
||||
local testpath = "data/" .. utils.trim(mixin) .. ".beast"
|
||||
if (testpath ~= nil) then
|
||||
self:readAllLines(testpath)
|
||||
end
|
||||
end
|
||||
|
||||
function BeastFile:prepareJson()
|
||||
|
|
Loading…
Reference in a new issue