From bb8456b71119ca6303b9e9706829a84dc7f81ab3 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Wed, 29 Oct 2014 22:47:08 -0400 Subject: Cleanup and fixup Non-stylistic changes: * Add LuaDoc/LDoc support. * Fix `clear_objects` area size calculation. * Fix `clear_objects` removing player objects. * Fix shadowing of marker entity name with player name. * Make visualization functions use `swap_node`. * Make hidden nodes unwalkable. * Prevent `hide` from hiding air. * Make deprecated functions log to deprecated stream when called. * Fixed `replaceinverse` not using normalized node names. * Added .gitignore. * Bump version to 1.1. Stylistic changes: * Change `x = function` to `function x`. * Change comment format. * Make missing VoxelManip error less obnoxious. * Move `sort_pos` into `common.lua`, which is a required module. * Remove local copies of `minetest`. * Remove `worldedit = worldedit or {}` from modules. * Replace replaceinverse with an inverse argument to `replace`. * Added `error()`s on on invalid axes. * Change `wip` to `TODO`. * Rename `clearobjects` to `clear_objects`. * Remove `hollow_{sphere,dome,cylinder}` and replace them with a hollow parameter to each function. * Add helpers to reduce code duplication. * Renamed `Chat Commands.md` to `ChatCommands.md`. --- worldedit/init.lua | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'worldedit/init.lua') diff --git a/worldedit/init.lua b/worldedit/init.lua index a6361b5..34c9820 100644 --- a/worldedit/init.lua +++ b/worldedit/init.lua @@ -1,25 +1,44 @@ -worldedit = worldedit or {} -worldedit.version = {major=1, minor=0} -worldedit.version_string = "1.0" +--- Worldedit. +-- @module worldedit +-- @release 1.1 +-- @copyright 2013 sfan5, Anthony Zhang (Uberi/Temperest), and Brett O'Donnell (cornernote). +-- @license GNU Affero General Public License version 3 (AGPLv3) +-- @author sfan5 +-- @author Anthony Zang (Uberi/Temperest) +-- @author Bret O'Donnel (cornernote) +-- @author ShadowNinja -assert(minetest.get_voxel_manip, string.rep(">", 300) .. "HEY YOU! YES, YOU OVER THERE. THIS VERSION OF WORLDEDIT REQUIRES MINETEST 0.4.8 OR LATER! YOU HAVE AN OLD VERSION." .. string.rep("<", 300)) +worldedit = {} +worldedit.version = {1, 1, major=1, minor=1} +worldedit.version_string = table.concat(worldedit.version, ".") + +if not minetest.get_voxel_manip then + local err_msg = "This version of WorldEdit requires Minetest 0.4.8 or later! You have an old version." + minetest.log("error", string.rep("#", 128)) + minetest.log("error", err_msg) + minetest.log("error", string.rep("#", 128)) + error(err_msg) +end local path = minetest.get_modpath(minetest.get_current_modname()) -local loadmodule = function(path) +local function load_module(path) local file = io.open(path) - if not file then - return - end + if not file then return end file:close() return dofile(path) end -loadmodule(path .. "/manipulations.lua") -loadmodule(path .. "/primitives.lua") -loadmodule(path .. "/visualization.lua") -loadmodule(path .. "/serialization.lua") -loadmodule(path .. "/code.lua") -loadmodule(path .. "/compatibility.lua") +dofile(path .. "/common.lua") +load_module(path .. "/manipulations.lua") +load_module(path .. "/primitives.lua") +load_module(path .. "/visualization.lua") +load_module(path .. "/serialization.lua") +load_module(path .. "/code.lua") +load_module(path .. "/compatibility.lua") + + +if minetest.setting_getbool("log_mods") then + print("[WorldEdit] Loaded!") +end -print("[MOD] WorldEdit loaded!") -- cgit v1.2.3