From d7e721f49ac8943f0e9706a8646eca3e65b78651 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 2 Aug 2024 11:43:34 +0200 Subject: [PATCH] feat: ajoute parent --- classes/beastfile.lua | 4 ++-- classes/dataholders/simpleholder.lua | 1 - classes/datalist.lua | 4 +++- classes/folderloader.lua | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/classes/beastfile.lua b/classes/beastfile.lua index 5c4a8c8..6fd77cb 100644 --- a/classes/beastfile.lua +++ b/classes/beastfile.lua @@ -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 \ No newline at end of file diff --git a/classes/dataholders/simpleholder.lua b/classes/dataholders/simpleholder.lua index af7371a..12beb12 100644 --- a/classes/dataholders/simpleholder.lua +++ b/classes/dataholders/simpleholder.lua @@ -7,7 +7,6 @@ function SimpleHolder:new(key, datas) end function SimpleHolder:applyCommand(command, args) - print(self.key, command, args) self.value = args end diff --git a/classes/datalist.lua b/classes/datalist.lua index 1174261..cdaf20d 100644 --- a/classes/datalist.lua +++ b/classes/datalist.lua @@ -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 diff --git a/classes/folderloader.lua b/classes/folderloader.lua index 47da205..82a5f5d 100644 --- a/classes/folderloader.lua +++ b/classes/folderloader.lua @@ -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