diff --git a/.emmyrc.json b/.emmyrc.json index 27cd102..9a7189c 100644 --- a/.emmyrc.json +++ b/.emmyrc.json @@ -17,7 +17,8 @@ "core", "table", "VoxelArea", - "VoxelManip", + "VoxelManip", + "vector", "Ensure", "string", "string_utf8" diff --git a/mods/API/System/init.lua b/mods/API/ApiLoader/init.lua similarity index 100% rename from mods/API/System/init.lua rename to mods/API/ApiLoader/init.lua diff --git a/mods/API/System/mod.conf b/mods/API/ApiLoader/mod.conf similarity index 89% rename from mods/API/System/mod.conf rename to mods/API/ApiLoader/mod.conf index 89f8ec8..9558764 100644 --- a/mods/API/System/mod.conf +++ b/mods/API/ApiLoader/mod.conf @@ -1,3 +1,3 @@ -name = smc__api__system +name = smc__api__api_loader description = Include this mod in your `depends` to ensure all necessary APIs are loaded for your mod depends = smc__api__ensure, smc__api__math, smc__api__mod, smc__api__require, smc__api__table, smc__api__string, smc__api__utf8, diff --git a/mods/CORE/Enum/mod.conf b/mods/CORE/Enum/mod.conf index 80c2c39..27baa72 100644 --- a/mods/CORE/Enum/mod.conf +++ b/mods/CORE/Enum/mod.conf @@ -1,2 +1,2 @@ name = smc__core__enum -depends = smc__api__system +depends = smc__api__api_loader diff --git a/mods/CORE/Factory/mod.conf b/mods/CORE/Factory/mod.conf index fd30277..dc6daad 100644 --- a/mods/CORE/Factory/mod.conf +++ b/mods/CORE/Factory/mod.conf @@ -1,2 +1,2 @@ name = smc__core__factory -depends = smc__api__system +depends = smc__api__api_loader diff --git a/mods/CORE/Item/mod.conf b/mods/CORE/Item/mod.conf index 4411d6b..ca47080 100644 --- a/mods/CORE/Item/mod.conf +++ b/mods/CORE/Item/mod.conf @@ -1,2 +1,2 @@ name = smc__core__item -depends = smc__api__system, smc__core__enum, smc__core__factory +depends = smc__api__api_loader, smc__core__enum, smc__core__factory diff --git a/mods/CORE/Item/src/Item.lua b/mods/CORE/Item/src/Item.lua index 4d512ea..834cea0 100644 --- a/mods/CORE/Item/src/Item.lua +++ b/mods/CORE/Item/src/Item.lua @@ -21,6 +21,7 @@ local Item = { ---@param itemDef Item.ItemDefinition local function itemDefToLuantiDef(itemDef) + ---@diagnostic disable-next-line: undefined-field itemDef = table.copy(itemDef) local s = itemDef.settings local c = itemDef.callbacks diff --git a/mods/CORE/MapGen/init.lua b/mods/CORE/MapGen/init.lua index 3565958..0098629 100644 --- a/mods/CORE/MapGen/init.lua +++ b/mods/CORE/MapGen/init.lua @@ -27,4 +27,4 @@ mapGenerator:RegisterRegion("world", }, true) -mapGenerator:enable() \ No newline at end of file +mapGenerator:run() \ No newline at end of file diff --git a/mods/CORE/MapGen/mod.conf b/mods/CORE/MapGen/mod.conf index 5eb2dcb..b54774d 100644 --- a/mods/CORE/MapGen/mod.conf +++ b/mods/CORE/MapGen/mod.conf @@ -1,2 +1,2 @@ name = smc__core__map_gen -depends = smc__api__system \ No newline at end of file +depends = smc__api__api_loader \ No newline at end of file diff --git a/mods/CORE/MapGen/src/MapGen.lua b/mods/CORE/MapGen/src/MapGen.lua index b298483..9b1b6d5 100644 --- a/mods/CORE/MapGen/src/MapGen.lua +++ b/mods/CORE/MapGen/src/MapGen.lua @@ -14,21 +14,18 @@ local id_air = id("air") local modInfo = Mod.getInfo() local require = modInfo.require --- -@type MapGen.Utils ----local MapGenUtils = require("MapGen.Utils") - ---@type MapGen.Layer -local Layer = require("MapGen.Layer") +local Layer = require("MapGen.Layer") ---@type MapGen.Region -local Region= require("MapGen.Region") +local Region = require("MapGen.Region") ---@class MapGen ---@field layersByName table ---@field layersList table ----@field isEnable boolean A static field that guarantees that only one instance of the `MapGen` class will work. +---@field isRunning boolean A static field that guarantees that only one instance of the `MapGen` class will work. local MapGen = { - isEnable = false, + isRunning = false, } ---@return MapGen @@ -195,8 +192,8 @@ function MapGen:onMapGenerated(minPos, maxPos, blockseed) voxelManip:write_to_map() end -function MapGen:enable() - if MapGen.isEnable then +function MapGen:run() + if MapGen.isRunning then error('Only one instance of a `MapGen` class can be used.') end @@ -204,7 +201,7 @@ function MapGen:enable() self:onMapGenerated(...) end) - MapGen.isEnable = true + MapGen.isRunning = true end return MapGen \ No newline at end of file diff --git a/mods/CORE/MapGen/src/MapGen/Region.lua b/mods/CORE/MapGen/src/MapGen/Region.lua index c4e6567..77aea6f 100644 --- a/mods/CORE/MapGen/src/MapGen/Region.lua +++ b/mods/CORE/MapGen/src/MapGen/Region.lua @@ -1,10 +1,22 @@ +--============================================================ +--=======================WARNING!!!=========================== +--============================================================ +--======================THIS=FILE=IS========================== +--=======================STILL==WIP=========================== +--=========================BY==ME============================= +--============================================================ +--===================================Doloment================= +--============================================================ + +-- TODO: replace `table` with `vector` for minPos and maxPos ---@class MapGen.Region ---@field minPos table ---@field maxPos table ---@field noises MapGen.Region.Noises +---@field noisesParams MapGen.Region.Noises -- ??? TODO: should be it's own class in EmmyLua local Region = {} ----@param noisesParams MapGen.Region.Noises +---@param noisesParams MapGen.Region.Noises -- ??? TODO: should be it's own class in EmmyLua ---@return MapGen.Region.Noises local function paramsToNoises(noisesParams) ---@type MapGen.Region.Noises @@ -17,17 +29,28 @@ local function paramsToNoises(noisesParams) return noises end ----@param minPos table ----@param maxPos table ----@param noisesParams MapGen.Region.Noises +---@param minPos table +---@param maxPos table +---@param noisesParams MapGen.Region.Noises ---@return MapGen.Region function Region:new(minPos, maxPos, noisesParams) - ---@type MapGen.Region - local instance = setmetatable({ - minPos = minPos, - maxPos = maxPos, - noises = noisesParams --paramsToNoises(noisesParams) - }, {__index = self}) + + local _minPos = minPos + local _maxPos = maxPos + local _noisesParams = noisesParams + + local _noises = {} + + local instance = setmetatable({}, {__index = self}) + + function instance:getMinPos() return _minPos end + function instance:getMaxPos() return _maxPos end + function instance:getNoisesParams() return _noisesParams end + function instance:getNoises() return _noises end + + function instance:initNoises() + _noises = paramsToNoises(_noisesParams) + end return instance end diff --git a/mods/CORE/TileSheet/mod.conf b/mods/CORE/TileSheet/mod.conf index 57fc01a..59bc1ed 100644 --- a/mods/CORE/TileSheet/mod.conf +++ b/mods/CORE/TileSheet/mod.conf @@ -1,2 +1,2 @@ name = smc__core__tilesheet -depends = smc__api__system +depends = smc__api__api_loader diff --git a/mods/GAME/ITEMS/ItemsLoader/mod.conf b/mods/GAME/ITEMS/ItemsLoader/mod.conf new file mode 100644 index 0000000..0b66164 --- /dev/null +++ b/mods/GAME/ITEMS/ItemsLoader/mod.conf @@ -0,0 +1,3 @@ +name = smc__game__items__items_loader +description = Include this mod in your `depends` to ensure all items are registered +depends = smc__game__items__rocks, smc__game__items__log, diff --git a/mods/GAME/ITEMS/Log/init.lua b/mods/GAME/ITEMS/Log/init.lua new file mode 100644 index 0000000..6b83d14 --- /dev/null +++ b/mods/GAME/ITEMS/Log/init.lua @@ -0,0 +1 @@ +print(":)") \ No newline at end of file diff --git a/mods/GAME/ITEMS/Log/mod.conf b/mods/GAME/ITEMS/Log/mod.conf index e69de29..4baf7b5 100644 --- a/mods/GAME/ITEMS/Log/mod.conf +++ b/mods/GAME/ITEMS/Log/mod.conf @@ -0,0 +1,2 @@ +name = smc__game__items__log +depends = smc__core__node \ No newline at end of file