Write Class lib
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
name = smc__api__api_loader
|
name = smc__api__api_loader
|
||||||
description = Include this mod in your `depends` to ensure all necessary APIs are loaded for your mod
|
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,
|
depends = smc__api__ensure, smc__api__math, smc__api__mod, smc__api__require, smc__api__table, smc__api__string, smc__api__utf8, smc__api__class
|
||||||
|
|||||||
9
mods/API/Class/init.lua
Normal file
9
mods/API/Class/init.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---@class Class
|
||||||
|
Class = {}
|
||||||
|
|
||||||
|
---Returns a child class with inherited parameters from the parent class.
|
||||||
|
---@param parent table
|
||||||
|
---@param child table
|
||||||
|
function Class.extend(parent ,child)
|
||||||
|
return setmetatable(child or {}, { __index = parent })
|
||||||
|
end
|
||||||
1
mods/API/Class/mod.conf
Normal file
1
mods/API/Class/mod.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name = smc__api__class
|
||||||
@@ -5,6 +5,12 @@
|
|||||||
-- so global tables need to be preloaded manually.
|
-- so global tables need to be preloaded manually.
|
||||||
|
|
||||||
-- --- Global APIs load --
|
-- --- Global APIs load --
|
||||||
|
-- Api loader
|
||||||
|
dofile(core.get_modpath('smc__api__api_loader')..'/init.lua')
|
||||||
|
|
||||||
|
-- Class
|
||||||
|
dofile(core.get_modpath('smc__api__class')..'/init.lua')
|
||||||
|
|
||||||
-- Ensure
|
-- Ensure
|
||||||
dofile(core.get_modpath('smc__api__ensure')..'/init.lua')
|
dofile(core.get_modpath('smc__api__ensure')..'/init.lua')
|
||||||
|
|
||||||
@@ -170,8 +176,8 @@ mapGenerator:register2DPeaks("world",
|
|||||||
})
|
})
|
||||||
|
|
||||||
mapGenerator:registerCavern('world', 'cavern1', {
|
mapGenerator:registerCavern('world', 'cavern1', {
|
||||||
minY = -100,
|
minY = -48,
|
||||||
maxY = -10,
|
maxY = 0,
|
||||||
smoothDistance = 20,
|
smoothDistance = 20,
|
||||||
threshold = 0.3,
|
threshold = 0.3,
|
||||||
noiseParams ={
|
noiseParams ={
|
||||||
|
|||||||
Reference in New Issue
Block a user