Code quality: use new modlib functionality

master
Lars Mueller 2020-07-30 00:12:12 +02:00
parent dfba3c44df
commit d110632ee4
1 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,4 @@
voxelizer={}
modlib.mod.create_namespace()
minetest.mkdir(minetest.get_worldpath().."/media") -- Create media dir
local os_execute_base = os.execute or (minetest.request_insecure_environment() or
error("Please add voxelizer to the trusted mods in settings, or disable it. See the Readme for details.")).os.execute
@ -9,19 +9,20 @@ local function os_execute(command, ...)
end
return os_execute_base(command.." "..table.concat(args, " "))
end
modlib.mod.extend("voxelizer", "conf") -- Load JSON configuration stored in worldpath
modlib.mod.extend("voxelizer", "vector") -- Own vector lib, operating on lists
modlib.mod.extend("voxelizer", "closest_color") -- Closest color finder, uses linear search / k-d tree depending on number of colors
modlib.mod.extend("voxelizer", "texture_reader") -- Texture reader, reads textures, uses Java program
local extend = modlib.mod.extend
extend("conf") -- Load JSON configuration stored in worldpath
extend("vector") -- Own vector lib, operating on lists
extend("closest_color") -- Closest color finder, uses linear search / k-d tree depending on number of colors
extend("texture_reader") -- Texture reader, reads textures, uses Java program
voxelizer.set_os_execute(os_execute) -- Passing insecure os.execute while keeping it local
modlib.mod.extend("voxelizer", "dithering") -- Error diffusion dithering
modlib.mod.extend("voxelizer", "obj_reader") -- OBJ reader, reads simple OBJ models
modlib.mod.extend("voxelizer", "node_map_reader") -- Node map reader, reads minetestmapper-colors.txt like files
modlib.mod.extend("voxelizer", "main") -- Main : Actual API for placing of models using VoxelManip
modlib.mod.extend("voxelizer", "chatcommands") -- Chatcommands for making use of the API
extend("dithering") -- Error diffusion dithering
extend("obj_reader") -- OBJ reader, reads simple OBJ models
extend("node_map_reader") -- Node map reader, reads minetestmapper-colors.txt like files
extend("main") -- Main : Actual API for placing of models using VoxelManip
extend("chatcommands") -- Chatcommands for making use of the API
voxelizer.set_os_execute(os_execute) -- Passing insecure os.execute while keeping it local
-- Tests : Only uncomment if you actually want to test something !
-- Tests, not intended for production use
--[[minetest.register_on_mods_loaded(function()
modlib.mod.extend("voxelizer", "test")
extend("test")
end)]]