forked from Apancore.Studio/simple-makes-complex
Some changes regarding MapGen and other modes
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
"core",
|
||||
"table",
|
||||
"VoxelArea",
|
||||
"VoxelManip",
|
||||
"VoxelManip",
|
||||
"vector",
|
||||
"Ensure",
|
||||
"string",
|
||||
"string_utf8"
|
||||
|
||||
@@ -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,
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__enum
|
||||
depends = smc__api__system
|
||||
depends = smc__api__api_loader
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__factory
|
||||
depends = smc__api__system
|
||||
depends = smc__api__api_loader
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,4 +27,4 @@ mapGenerator:RegisterRegion("world",
|
||||
},
|
||||
true)
|
||||
|
||||
mapGenerator:enable()
|
||||
mapGenerator:run()
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__map_gen
|
||||
depends = smc__api__system
|
||||
depends = smc__api__api_loader
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name = smc__core__tilesheet
|
||||
depends = smc__api__system
|
||||
depends = smc__api__api_loader
|
||||
|
||||
3
mods/GAME/ITEMS/ItemsLoader/mod.conf
Normal file
3
mods/GAME/ITEMS/ItemsLoader/mod.conf
Normal file
@@ -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,
|
||||
1
mods/GAME/ITEMS/Log/init.lua
Normal file
1
mods/GAME/ITEMS/Log/init.lua
Normal file
@@ -0,0 +1 @@
|
||||
print(":)")
|
||||
@@ -0,0 +1,2 @@
|
||||
name = smc__game__items__log
|
||||
depends = smc__core__node
|
||||
Reference in New Issue
Block a user