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
end end
function BeastFile:prepareJson(simplercreatures, creatures) function BeastFile:prepareJson(simplercreatures, creatures, parent)
assert(simplercreatures ~= nil) assert(simplercreatures ~= nil)
assert(creatures ~= nil) assert(creatures ~= nil)
self.datas:prepareJson(simplercreatures, creatures) self.datas:prepareJson(simplercreatures, creatures, parent)
end end
return BeastFile return BeastFile

View file

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

View file

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

View file

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