Mapgen: write SuperUltraSigmaMapgen part 7.1

This commit is contained in:
Van
2025-11-23 21:09:20 +03:00
parent 1e430aaeb0
commit 3c482d6f04
4 changed files with 37 additions and 9 deletions

View File

@@ -678,12 +678,17 @@ end
---Run world generation through this mapgen object
---
---Note: only one instance of a `MapGen` class can be running.
---
---**FOR MAPGEN ENVIRONMENT ONLY**
function MapGen:run()
if MapGen.isRunning then
error('Only one instance of a `MapGen` class can be running.')
end
core.register_on_generated(function(...)
-- TODO: удалить отключение проверки после исправления issue:
-- https://github.com/Voxrame/luanti-ide-helper/issues/6
---@diagnostic disable-next-line: param-type-not-match
self:onMapGenerated(...)
end)

View File

@@ -66,9 +66,9 @@ function Peak:new(peakPos, multinoiseParams, groups)
end
function instance:initMultinoise()
--if not table.is_empty(_multinoise) then
-- minetest.log('warning', 'Multinoise has already been initialized. Re-initialization is not recommended.')
--end
if not table.is_empty(_multinoise) then
minetest.log('warning', 'Multinoise has already been initialized. Re-initialization is not recommended.')
end
_multinoise = multinoiseParamsToMultinoise(_multinoiseParams)
end

View File

@@ -1,13 +1,33 @@
-- MAPGEN ENVIROMENT ONLY
-- https://api.luanti.org/core-namespace-reference/#mapgen-environment
-- This environment is isolated from the main environment,
-- so global tables need to be preloaded manually.
-- --- Global APIs load --
-- Ensure
dofile(core.get_modpath('smc__api__ensure')..'/init.lua')
-- Math
dofile(core.get_modpath('smc__api__math')..'/init.lua')
-- Require
dofile(core.get_modpath('smc__api__require')..'/init.lua')
-- Mod
dofile(core.get_modpath('smc__api__mod')..'/init.lua')
-- String
dofile(core.get_modpath('smc__api__string')..'/init.lua')
-- Table
dofile(core.get_modpath('smc__api__table')..'/init.lua')
-- --- MapGen definiton ---
local id = core.get_content_id
Require = dofile(core.get_modpath('smc__api__require')..'/init.lua')
---@type Mod
Mod = dofile(core.get_modpath('smc__api__mod')..'/init.lua')
print(core.get_modpath('smc__api__mod')..'/init.lua')
local mapGenRequire = Mod.getInfo('smc__core__map_gen').require
---@type MapGen

View File

@@ -1 +1,4 @@
-- World generation runs in the mapgen environment (separate thread)
-- The Mapgen environment is isolated from the main enviroment.
core.register_mapgen_script(core.get_modpath(core.get_current_modname())..'/MapGenerator.lua')