diff --git a/sonic-radiance.love/game/utils/datas.lua b/sonic-radiance.love/birb/utils/datas.lua similarity index 100% rename from sonic-radiance.love/game/utils/datas.lua rename to sonic-radiance.love/birb/utils/datas.lua diff --git a/sonic-radiance.love/birb/utils/init.lua b/sonic-radiance.love/birb/utils/init.lua index 0235851..d0f1c5c 100644 --- a/sonic-radiance.love/birb/utils/init.lua +++ b/sonic-radiance.love/birb/utils/init.lua @@ -31,4 +31,5 @@ return { table = require(cwd .. "table"), string = require(cwd .. "string"), time = require(cwd .. "time"), + datas = require(cwd .. "datas") } diff --git a/sonic-radiance.love/game/utils/battle/init.lua b/sonic-radiance.love/game/utils/battle/init.lua index 2a62ffc..e093539 100644 --- a/sonic-radiance.love/game/utils/battle/init.lua +++ b/sonic-radiance.love/game/utils/battle/init.lua @@ -1,11 +1,9 @@ local BattleUtils = {} -local datasutils = require "game.utils.datas" - local DIR = "battles" function BattleUtils.getBaseDirectory(lua) - return datasutils.concatDataFolder(DIR, lua) + return utils.datas.concatDataFolder(DIR, lua) end function BattleUtils.listCategories() @@ -14,7 +12,7 @@ end function BattleUtils.getCategoryDirectory(directory, lua) local baseDir = BattleUtils.getBaseDirectory(lua) - return datasutils.concatFolder(baseDir, directory, lua) + return utils.datas.concatFolder(baseDir, directory, lua) end function BattleUtils.getDirectoryLuaStyle(directory) @@ -23,12 +21,12 @@ end function BattleUtils.getBattleFromCategory(directory) local folder = BattleUtils.getCategoryDirectory(directory, false) - return datasutils.luaFileListToModuleList(love.filesystem.getDirectoryItems(folder)) + return utils.datas.luaFileListToModuleList(love.filesystem.getDirectoryItems(folder)) end function BattleUtils.getBattleData(directory, battlename) local categoryDir = BattleUtils.getCategoryDirectory(directory, true) - return datasutils.require(categoryDir, battlename) + return utils.datas.require(categoryDir, battlename) end -- ENNEMY FUNCTIONS diff --git a/sonic-radiance.love/game/utils/characters.lua b/sonic-radiance.love/game/utils/characters.lua index 37fb34b..4ea7929 100644 --- a/sonic-radiance.love/game/utils/characters.lua +++ b/sonic-radiance.love/game/utils/characters.lua @@ -1,7 +1,5 @@ local CharUtils = {} -local datasutils = require "game.utils.datas" - local CONST = {} CONST.EXP_MULTIPLICATOR = 4 CONST.EXP_RATIO = 5 @@ -18,12 +16,12 @@ CONST.MULT_MP = 1.5 local DIR = "characters" function CharUtils.getBaseDirectory(lua) - return datasutils.concatDataFolder(DIR, lua) + return utils.datas.concatDataFolder(DIR, lua) end function CharUtils.getCharacterDirectory(name, lua) local baseDirectory = CharUtils.getBaseDirectory(lua) - return datasutils.concatFolder(baseDirectory, name, lua) + return utils.datas.concatFolder(baseDirectory, name, lua) end @@ -64,10 +62,10 @@ end function CharUtils.getCharacterData(charname) -- va eprmettre de récupérer les données d'un personnage local charfolder = CharUtils.getCharacterDirectory(charname, true) - local character = datasutils.copy(charfolder) - character.stats = datasutils.copyDataset(charfolder, "stats") - character.inventory = datasutils.copyDataset(charfolder, "inventory") - character.skills = datasutils.copyDataset(charfolder, "skills") + local character = utils.datas.copy(charfolder) + character.stats = utils.datas.copyDataset(charfolder, "stats") + character.inventory = utils.datas.copyDataset(charfolder, "inventory") + character.skills = utils.datas.copyDataset(charfolder, "skills") return character end diff --git a/sonic-radiance.love/game/utils/ennemies.lua b/sonic-radiance.love/game/utils/ennemies.lua index 11a6c83..bc5dd12 100644 --- a/sonic-radiance.love/game/utils/ennemies.lua +++ b/sonic-radiance.love/game/utils/ennemies.lua @@ -1,11 +1,9 @@ local EnnemyUtils = {} -local datasutils = require "game.utils.datas" - local DIR = "ennemies" function EnnemyUtils.getBaseDirectory(lua) - return datasutils.concatDataFolder(DIR, lua) + return utils.datas.concatDataFolder(DIR, lua) end function EnnemyUtils.listCategories() @@ -13,12 +11,12 @@ function EnnemyUtils.listCategories() end function EnnemyUtils.getCategoryDirectory(directory, lua) - return datasutils.concatFolder(EnnemyUtils.getBaseDirectory(lua), directory, lua) + return utils.datas.concatFolder(EnnemyUtils.getBaseDirectory(lua), directory, lua) end function EnnemyUtils.getEnnemyFolder(directory, ennemy, lua) local categoryDirectory = EnnemyUtils.getCategoryDirectory(directory, lua) - return datasutils.concatFolder(categoryDirectory, ennemy, lua) + return utils.datas.concatFolder(categoryDirectory, ennemy, lua) end function EnnemyUtils.getEnnemiesFromCategory(directory) @@ -27,7 +25,7 @@ function EnnemyUtils.getEnnemiesFromCategory(directory) end function EnnemyUtils.dataExists(directory, name) - local dir = datasutils.concatFolder(EnnemyUtils.getEnnemyFolder(directory, name, false), "init.lua", false) + local dir = utils.datas.concatFolder(EnnemyUtils.getEnnemyFolder(directory, name, false), "init.lua", false) local fileinfo = love.filesystem.getInfo(dir) return (fileinfo ~= nil) end @@ -35,9 +33,9 @@ end function EnnemyUtils.getData(directory, name) -- va eprmettre de récupérer les données d'un personnage local folder = EnnemyUtils.getEnnemyFolder(directory, name, true) - local ennemy = datasutils.copy(folder) - ennemy.stats = datasutils.copyDataset(folder, "stats") - ennemy.skills = datasutils.copyDataset(folder, "skills") + local ennemy = utils.datas.copy(folder) + ennemy.stats = utils.datas.copyDataset(folder, "stats") + ennemy.skills = utils.datas.copyDataset(folder, "skills") return ennemy end diff --git a/sonic-radiance.love/game/utils/items/init.lua b/sonic-radiance.love/game/utils/items/init.lua index 41edd6d..2d1318f 100644 --- a/sonic-radiance.love/game/utils/items/init.lua +++ b/sonic-radiance.love/game/utils/items/init.lua @@ -1,11 +1,9 @@ local ItemUtils = {} -local datasutils = require "game.utils.datas" - local DIR = "items" function ItemUtils.getBaseDirectory(lua) - return datasutils.concatDataFolder(DIR, lua) + return utils.datas.concatDataFolder(DIR, lua) end function ItemUtils.listCategories() @@ -13,18 +11,18 @@ function ItemUtils.listCategories() end function ItemUtils.getCategoryDirectory(directory, lua) - return datasutils.concatFolder(ItemUtils.getBaseDirectory(lua), directory, lua) + return utils.datas.concatFolder(ItemUtils.getBaseDirectory(lua), directory, lua) end function ItemUtils.getItemsFromCategory(directory) local folder = ItemUtils.getCategoryDirectory(directory, false) local baseTable = love.filesystem.getDirectoryItems(folder) - return datasutils.luaFileListToModuleList(baseTable) + return utils.datas.luaFileListToModuleList(baseTable) end function ItemUtils.getItemFile(category, item, lua) local dir = ItemUtils.getCategoryDirectory(category, lua) - local path = datasutils.concatFolder(dir, item, lua) + local path = utils.datas.concatFolder(dir, item, lua) if (not lua) then path = path .. ".lua" end @@ -39,7 +37,7 @@ end function ItemUtils.getItemData(category, item) local path = ItemUtils.getItemFile(category, item, true) - return datasutils.copy(path) + return utils.datas.copy(path) end -- VALIDATION FUNCTIONS