feat: ajoute parent

This commit is contained in:
Kazhnuz 2024-08-02 11:43:34 +02:00
parent 9b1d92449e
commit d7e721f49a
4 changed files with 6 additions and 5 deletions

View file

@ -38,10 +38,10 @@ function BeastFile:loadMixin(mixin)
end
end
function BeastFile:prepareJson(simplercreatures, creatures)
function BeastFile:prepareJson(simplercreatures, creatures, parent)
assert(simplercreatures ~= nil)
assert(creatures ~= nil)
self.datas:prepareJson(simplercreatures, creatures)
self.datas:prepareJson(simplercreatures, creatures, parent)
end
return BeastFile

View file

@ -7,7 +7,6 @@ function SimpleHolder:new(key, datas)
end
function SimpleHolder:applyCommand(command, args)
print(self.key, command, args)
self.value = args
end

View file

@ -97,9 +97,11 @@ function DataList:reduce()
--TODO
end
function DataList:prepareJson(simplercreatures, creatures)
function DataList:prepareJson(simplercreatures, creatures, parent)
self:reduce()
self.reducedList.parent = parent
table.insert(simplercreatures, {nom = self.reducedList.name, level = self.reducedList.level, nomType = self.reducedList.nomType, categorie = self.reducedList.categorie})
table.insert(creatures, self.reducedList)
end

View file

@ -29,7 +29,7 @@ end
function FolderLoader:prepareJson(simplercreatures, creatures)
for _, file in ipairs(self.files) do
file:prepareJson(simplercreatures, creatures)
file:prepareJson(simplercreatures, creatures, self.data.nom)
end
end