2024-09-13 01:52:35 +00:00
--- 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.
2023-07-04 21:45:02 +00:00
-- @namespace worldeditadditions_core
2023-07-31 23:34:35 +00:00
-- @release 1.14.5
2021-06-30 01:53:14 +00:00
-- @copyright 2021 Starbeamrainbowlabs and VorTechnix
-- @license Mozilla Public License, 2.0
-- @author Starbeamrainbowlabs and VorTechnix
2022-05-16 22:32:40 +00:00
local modpath = minetest.get_modpath ( " worldeditadditions_core " )
2024-09-13 01:52:35 +00:00
local EventEmitter = dofile ( modpath .. " /utils/EventEmitter.lua " )
2024-10-12 00:04:27 +00:00
local directory_separator = " / "
if package and package.config then
directory_separator = package.config : sub ( 1 , 1 )
end
2024-09-13 01:52:35 +00:00
worldeditadditions_core = EventEmitter.new ( {
2023-09-24 01:07:08 +00:00
version = " 1.15-dev " ,
2024-10-25 16:06:15 +00:00
--- The directory separator on the current host system [[ DEPRECATED ]]
--- Use worldeditadditions_core.path.sep instead
2024-10-12 00:04:27 +00:00
-- @value string
dirsep = directory_separator ,
--- The full absolute filepath to the mod worldeditadditions_core
-- @value
2022-05-16 22:32:40 +00:00
modpath = modpath ,
2024-10-12 00:04:27 +00:00
--- 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>
2022-05-16 22:32:40 +00:00
registered_commands = { } ,
2024-10-12 00:04:27 +00:00
--- Storage for per-player node limits before safe_region kicks in.
2022-05-17 00:03:58 +00:00
-- TODO: Persist these to disk.
2024-10-12 00:04:27 +00:00
-- @value table<string, number>
2022-05-17 00:03:58 +00:00
safe_region_limits = { } ,
2024-10-12 00:04:27 +00:00
--- The default limit for new players on the number of potential nodes changed before safe_region kicks in.
-- TODO make this configurable
-- @value number
2022-05-17 00:03:58 +00:00
safe_region_limit_default = 100000 ,
2024-09-13 01:52:35 +00:00
} )
2022-05-19 01:31:01 +00:00
local wea_c = worldeditadditions_core
2024-09-13 01:52:35 +00:00
wea_c.EventEmitter = EventEmitter
2022-09-18 15:45:08 +00:00
2024-10-14 22:41:43 +00:00
wea_c.notify = dofile ( wea_c.modpath .. " /utils/notify/notify.lua " ) -- BEFORE anything that could use this
2022-09-18 15:45:08 +00:00
2024-10-25 16:06:15 +00:00
wea_c.Path = dofile ( wea_c.modpath .. " /utils/path.lua " ) -- BEFORE anything that could use this
2022-09-18 15:45:08 +00:00
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 " )
2023-12-16 00:35:52 +00:00
wea_c.rotation = dofile ( wea_c.modpath .. " /utils/rotation.lua " )
2024-09-17 22:18:37 +00:00
wea_c.orientation = dofile ( wea_c.modpath .. " /utils/orientation.lua " )
2024-06-04 21:49:41 +00:00
wea_c.param2 = dofile ( wea_c.modpath .. " /utils/param2.lua " )
2022-09-18 15:45:08 +00:00
wea_c.Queue = dofile ( wea_c.modpath .. " /utils/queue.lua " )
wea_c.LRU = dofile ( wea_c.modpath .. " /utils/lru.lua " )
2023-11-27 22:27:20 +00:00
wea_c.NodeListMatcher = dofile ( wea_c.modpath .. " /utils/NodeListMatcher.lua " )
2022-09-18 15:45:08 +00:00
wea_c.inspect = dofile ( wea_c.modpath .. " /utils/inspect.lua " )
-- I/O compatibility layer
2023-08-08 17:46:41 +00:00
wea_c.io = dofile ( wea_c.modpath .. " /utils/io/init.lua " )
2022-09-18 15:45:08 +00:00
wea_c.bit = dofile ( wea_c.modpath .. " /utils/bit.lua " )
wea_c.terrain = dofile ( wea_c.modpath .. " /utils/terrain/init.lua " )
2022-09-25 00:18:40 +00:00
local chaikin = dofile ( wea_c.modpath .. " /utils/chaikin.lua " )
wea_c.chaikin = chaikin.chaikin
wea_c.lerp = chaikin.linear_interpolate
2022-09-18 15:45:08 +00:00
dofile ( wea_c.modpath .. " /utils/strings/init.lua " )
dofile ( wea_c.modpath .. " /utils/format/init.lua " )
dofile ( wea_c.modpath .. " /utils/parse/init.lua " )
2022-09-24 12:41:44 +00:00
dofile ( wea_c.modpath .. " /utils/table/init.lua " )
2022-09-18 15:06:23 +00:00
2023-12-16 00:35:52 +00:00
2022-09-18 15:45:08 +00:00
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
2024-10-25 16:06:15 +00:00
wea_c.settings = dofile ( wea_c.modpath .. " /utils/setting_handler.lua " ) -- AFTER parser
2022-09-18 15:45:08 +00:00
2022-09-19 22:18:49 +00:00
wea_c.pos = dofile ( modpath .. " /core/pos.lua " ) -- AFTER EventEmitter
2024-10-14 18:25:53 +00:00
wea_c.safe_function = dofile ( modpath .. " /core/safe_function.lua " )
2022-05-19 01:31:01 +00:00
wea_c.register_command = dofile ( modpath .. " /core/register_command.lua " )
2023-12-13 22:15:27 +00:00
wea_c.command_exists = dofile ( modpath .. " /core/command_exists.lua " )
2022-05-19 01:31:01 +00:00
wea_c.fetch_command_def = dofile ( modpath .. " /core/fetch_command_def.lua " )
2022-05-19 21:50:53 +00:00
wea_c.register_alias = dofile ( modpath .. " /core/register_alias.lua " )
2022-09-19 22:18:49 +00:00
wea_c.entities = dofile ( modpath .. " /core/entities/init.lua " ) -- AFTER pos
dofile ( modpath .. " /core/pos_marker_manage.lua " ) -- AFTER pos, entities
2023-06-28 23:39:55 +00:00
dofile ( modpath .. " /core/pos_marker_wall_manage.lua " ) -- AFTER pos, entities
2022-05-16 22:32:40 +00:00
-- Initialise WorldEdit stuff if the WorldEdit mod is not present
2022-05-17 00:04:51 +00:00
if minetest.global_exists ( " worldedit " ) then
2022-05-19 01:31:01 +00:00
dofile ( wea_c.modpath .. " /core/integrations/worldedit.lua " )
2022-05-16 22:32:40 +00:00
else
2022-05-19 01:31:01 +00:00
dofile ( wea_c.modpath .. " /core/integrations/noworldedit.lua " )
2022-05-17 00:04:38 +00:00
end