mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-30 02:43:00 +00:00
104 lines
4.3 KiB
Lua
104 lines
4.3 KiB
Lua
--- WorldEditAdditions core engine
|
|
-- This namespace contains the core command processing engine used by WorldEditAdditions and associated parsing, formatting, and utility functions. It does not contain any of the commands themselves - see the namespace/'mod' simply called 'worldeditadditions' for that.
|
|
-- @namespace worldeditadditions_core
|
|
-- @release 1.14.5
|
|
-- @copyright 2021 Starbeamrainbowlabs and VorTechnix
|
|
-- @license Mozilla Public License, 2.0
|
|
-- @author Starbeamrainbowlabs and VorTechnix
|
|
|
|
|
|
local modpath = minetest.get_modpath("worldeditadditions_core")
|
|
|
|
local EventEmitter = dofile(modpath .. "/utils/EventEmitter.lua")
|
|
|
|
local directory_separator = "/"
|
|
if package and package.config then
|
|
directory_separator = package.config:sub(1,1)
|
|
end
|
|
|
|
worldeditadditions_core = EventEmitter.new({
|
|
version = "1.15-dev",
|
|
--- The directory separator on the current host system
|
|
-- @value string
|
|
dirsep = directory_separator,
|
|
--- The full absolute filepath to the mod worldeditadditions_core
|
|
-- @value
|
|
modpath = modpath,
|
|
--- The full absolute filepath to the data directory WorldEditAdditions can store miscellaneous data in.
|
|
-- @value
|
|
datapath = minetest.get_worldpath() .. directory_separator .."worldeditadditions",
|
|
--- A table containing the definitions for all commands registered in WorldEditAdditions.
|
|
-- Keys are the command name SANS any forward slashes! So //replacemix would be registered as simply replacemix.
|
|
-- @value table<string, table>
|
|
registered_commands = {},
|
|
--- Storage for per-player node limits before safe_region kicks in.
|
|
-- TODO: Persist these to disk.
|
|
-- @value table<string, number>
|
|
safe_region_limits = {},
|
|
--- The default limit for new players on the number of potential nodes changed before safe_region kicks in.
|
|
-- TODO make this configurable
|
|
-- @value number
|
|
safe_region_limit_default = 100000,
|
|
})
|
|
local wea_c = worldeditadditions_core
|
|
wea_c.EventEmitter = EventEmitter
|
|
|
|
wea_c.notify = dofile(wea_c.modpath.."/utils/notify/notify.lua") -- BEFORE anything that could use this
|
|
|
|
wea_c.Set = dofile(wea_c.modpath.."/utils/set.lua")
|
|
|
|
wea_c.Vector3 = dofile(wea_c.modpath.."/utils/vector3.lua")
|
|
wea_c.Mesh, wea_c.Face = dofile(wea_c.modpath.."/utils/mesh.lua")
|
|
wea_c.rotation = dofile(wea_c.modpath .. "/utils/rotation.lua")
|
|
wea_c.orientation = dofile(wea_c.modpath .. "/utils/orientation.lua")
|
|
wea_c.param2 = dofile(wea_c.modpath .. "/utils/param2.lua")
|
|
|
|
wea_c.Queue = dofile(wea_c.modpath.."/utils/queue.lua")
|
|
wea_c.LRU = dofile(wea_c.modpath.."/utils/lru.lua")
|
|
wea_c.NodeListMatcher = dofile(wea_c.modpath.."/utils/NodeListMatcher.lua")
|
|
wea_c.inspect = dofile(wea_c.modpath.."/utils/inspect.lua")
|
|
|
|
-- I/O compatibility layer
|
|
wea_c.io = dofile(wea_c.modpath.."/utils/io/init.lua")
|
|
|
|
wea_c.bit = dofile(wea_c.modpath.."/utils/bit.lua")
|
|
|
|
wea_c.terrain = dofile(wea_c.modpath.."/utils/terrain/init.lua")
|
|
|
|
local chaikin = dofile(wea_c.modpath.."/utils/chaikin.lua")
|
|
wea_c.chaikin = chaikin.chaikin
|
|
wea_c.lerp = chaikin.linear_interpolate
|
|
|
|
dofile(wea_c.modpath.."/utils/strings/init.lua")
|
|
dofile(wea_c.modpath.."/utils/format/init.lua")
|
|
dofile(wea_c.modpath.."/utils/parse/init.lua")
|
|
dofile(wea_c.modpath.."/utils/table/init.lua")
|
|
|
|
|
|
dofile(wea_c.modpath.."/utils/numbers.lua")
|
|
dofile(wea_c.modpath.."/utils/nodes.lua")
|
|
dofile(wea_c.modpath.."/utils/node_identification.lua")
|
|
|
|
dofile(wea_c.modpath.."/utils/raycast_adv.lua") -- For the farwand
|
|
dofile(wea_c.modpath.."/utils/player.lua") -- Player info functions
|
|
|
|
|
|
|
|
wea_c.setting_handler = dofile(wea_c.modpath.."/utils/setting_handler.lua") -- AFTER parser
|
|
|
|
wea_c.pos = dofile(modpath.."/core/pos.lua") -- AFTER EventEmitter
|
|
wea_c.safe_function = dofile(modpath.."/core/safe_function.lua")
|
|
wea_c.register_command = dofile(modpath.."/core/register_command.lua")
|
|
wea_c.command_exists = dofile(modpath.."/core/command_exists.lua")
|
|
wea_c.fetch_command_def = dofile(modpath.."/core/fetch_command_def.lua")
|
|
wea_c.register_alias = dofile(modpath.."/core/register_alias.lua")
|
|
wea_c.entities = dofile(modpath.."/core/entities/init.lua") -- AFTER pos
|
|
dofile(modpath.."/core/pos_marker_manage.lua") -- AFTER pos, entities
|
|
dofile(modpath.."/core/pos_marker_wall_manage.lua") -- AFTER pos, entities
|
|
|
|
-- Initialise WorldEdit stuff if the WorldEdit mod is not present
|
|
if minetest.global_exists("worldedit") then
|
|
dofile(wea_c.modpath.."/core/integrations/worldedit.lua")
|
|
else
|
|
dofile(wea_c.modpath.."/core/integrations/noworldedit.lua")
|
|
end
|