From 4f5e107101ee7c877837155ec8f3d4ead40df14d Mon Sep 17 00:00:00 2001 From: Calinou Date: Sat, 27 Dec 2014 20:31:31 +0100 Subject: [PATCH] Big cleanup. Fix intllib support. --- LICENSE.txt | 5 +- _README.txt => NODES.txt | 4 +- README.txt | 24 +- config.lua | 22 ++ craftitems.lua | 40 +++ default_nodes.lua | 78 +++--- init.lua | 548 ++------------------------------------- nodes.lua | 422 ++++++++++++++++++++++++++++++ tools.lua | 54 ++++ 9 files changed, 605 insertions(+), 592 deletions(-) rename _README.txt => NODES.txt (94%) create mode 100644 config.lua create mode 100644 craftitems.lua create mode 100644 nodes.lua create mode 100644 tools.lua diff --git a/LICENSE.txt b/LICENSE.txt index f42bd64..7d153bc 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,7 @@ -+---- zlib/libpng license ----+ +zlib license +============ -Copyright (c) 2013 Calinou +Copyright (c) 2012-2014 Calinou and contributors This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. diff --git a/_README.txt b/NODES.txt similarity index 94% rename from _README.txt rename to NODES.txt index cfbe0b2..5eb3462 100644 --- a/_README.txt +++ b/NODES.txt @@ -1,4 +1,4 @@ -*** Item names for spawning the items using /give or /giveme *** +** Item names for spawning the items using /give or /giveme ** Items: @@ -9,7 +9,7 @@ Purple pickaxe, infinite durability, mines everything including unbreakable bloc Fuel lasting for a (near)-infinite time. Don't worry about the "near" - it lasts for about 50 in-real-life years. - superapple -An apple which heals all 10 hearts. +An apple which heals by 20 HP. - copper_coin - silver_coin diff --git a/README.txt b/README.txt index 4c15581..cf64de9 100644 --- a/README.txt +++ b/README.txt @@ -1,22 +1,4 @@ -Calinou's Minetest Mods -===================== +Map Tools +========= -Calinou's Mods for Minetest [http://minetest.net], a free and opensource Minecraft-like game. - -This Git repository is mostly made for servers; it allows easy updating. - -To install, just clone this repository somewhere, then copy the "calinou_mods" folder in the "mods/minetest" folder of Minetest's installation folder. - - - -Misc stuff -===================== - -All these mods' source codes, except More Ores are under the zlib/libpng license. More Ores is under the GNU GPLv3; the mods' textures are under the CC BY-SA 3.0 Unported. - -Mods' forum threads: -More Blocks: http://minetest.net/forum/viewtopic.php?id=509 -More Ores: http://minetest.net/forum/viewtopic.php?id=549 -Map Tools: http://minetest.net/forum/viewtopic.php?id=1882 -Doors+: http://minetest.net/forum/viewtopic.php?id=2059 -Stairs+: http://minetest.net/forum/viewtopic.php?id=2092 +A mod which adds unbreakable nodes, an admin pickaxe (which digs instantly), infinite fuel, coins (for decoration) and other stuff like that. diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..626441e --- /dev/null +++ b/config.lua @@ -0,0 +1,22 @@ +maptools.config = {} + +local function getbool_default(setting, default) + local value = minetest.setting_getbool(setting) + if value == nil then + value = default + end + return value +end + +local function setting(settingtype, name, default) + if settingtype == "bool" then + maptools.config[name] = + getbool_default("maptools." .. name, default) + else + maptools.config[name] = + minetest.setting_get("maptools." .. name) or default + end +end + +-- Show Map Tools stuff in creative inventory (1 or 0): +setting("integer", "hide_from_creative_inventory", 1) diff --git a/craftitems.lua b/craftitems.lua new file mode 100644 index 0000000..444c0f0 --- /dev/null +++ b/craftitems.lua @@ -0,0 +1,40 @@ +local S = maptools.intllib + +maptools.creative = maptools.config["hide_from_creative_inventory"] + +minetest.register_craftitem("maptools:copper_coin", { + description = S("Copper Coin"), + inventory_image = "maptools_copper_coin.png", + wield_scale = {x = 0.5, y = 0.5, z = 0.25}, + stack_max = 10000, + groups = {not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_craftitem("maptools:silver_coin", { + description = S("Silver Coin"), + inventory_image = "maptools_silver_coin.png", + wield_scale = {x = 0.5, y = 0.5, z = 0.25}, + stack_max = 10000, + groups = {not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_craftitem("maptools:gold_coin", { + description = S("Gold Coin"), + inventory_image = "maptools_gold_coin.png", + wield_scale = {x = 0.5, y = 0.5, z = 0.25}, + stack_max = 10000, + groups = {not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_craftitem("maptools:infinitefuel", { + description = S("Infinite Fuel"), + inventory_image = "maptools_infinitefuel.png", + stack_max = 10000, + groups = {not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "maptools:infinitefuel", + burntime = 1000000000, +}) diff --git a/default_nodes.lua b/default_nodes.lua index d78a6b9..5f3a549 100644 --- a/default_nodes.lua +++ b/default_nodes.lua @@ -1,10 +1,6 @@ -local S -if (minetest.get_modpath("intllib")) then - dofile(minetest.get_modpath("intllib").."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) - else - S = function ( s ) return s end -end +local S = maptools.intllib + +maptools.creative = maptools.config["hide_from_creative_inventory"] minetest.register_node("maptools:stone", { description = S("Unbreakable Stone"), @@ -12,7 +8,7 @@ minetest.register_node("maptools:stone", { stack_max = 10000, tiles = {"default_stone.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -22,7 +18,7 @@ minetest.register_node("maptools:stonebrick", { stack_max = 10000, tiles = {"default_stone_brick.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -32,7 +28,7 @@ minetest.register_node("maptools:tree", { stack_max = 10000, tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node }) @@ -43,7 +39,7 @@ minetest.register_node("maptools:jungletree", { stack_max = 10000, tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node }) @@ -54,7 +50,7 @@ minetest.register_node("maptools:cactus", { stack_max = 10000, tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node }) @@ -75,7 +71,7 @@ minetest.register_node("maptools:papyrus", { type = "fixed", fixed = {-0.375, -0.5, -0.375, 0.375, 0.5, 0.375} }, - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_leaves_defaults(), }) @@ -85,7 +81,7 @@ minetest.register_node("maptools:dirt", { stack_max = 10000, tiles = {"default_dirt.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_dirt_defaults(), }) @@ -95,7 +91,7 @@ minetest.register_node("maptools:wood", { stack_max = 10000, tiles = {"default_wood.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_wood_defaults(), }) @@ -105,7 +101,7 @@ minetest.register_node("maptools:junglewood", { stack_max = 10000, tiles = {"default_junglewood.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_wood_defaults(), }) @@ -118,7 +114,7 @@ minetest.register_node("maptools:glass", { paramtype = "light", sunlight_propagates = true, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_glass_defaults(), }) @@ -130,7 +126,7 @@ minetest.register_node("maptools:leaves", { tiles = {"default_leaves.png"}, paramtype = "light", drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_leaves_defaults(), }) @@ -140,7 +136,7 @@ minetest.register_node("maptools:sand", { stack_max = 10000, tiles = {"default_sand.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_sand_defaults(), }) @@ -150,7 +146,7 @@ minetest.register_node("maptools:gravel", { stack_max = 10000, tiles = {"default_gravel.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_dirt_defaults({ footstep = {name="default_gravel_footstep", gain=0.35}, dug = {name="default_gravel_footstep", gain=0.6}, @@ -163,7 +159,7 @@ minetest.register_node("maptools:clay", { stack_max = 10000, tiles = {"default_clay.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_dirt_defaults(), }) @@ -173,7 +169,7 @@ minetest.register_node("maptools:desert_sand", { stack_max = 10000, tiles = {"default_desert_sand.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_sand_defaults(), }) @@ -183,7 +179,7 @@ minetest.register_node("maptools:sandstone", { stack_max = 10000, tiles = {"default_sandstone.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -193,7 +189,7 @@ minetest.register_node("maptools:sandstone_brick", { stack_max = 10000, tiles = {"default_sandstone_brick.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -203,7 +199,7 @@ minetest.register_node("maptools:desert_stone", { stack_max = 10000, tiles = {"default_desert_stone.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -213,7 +209,7 @@ minetest.register_node("maptools:desert_cobble", { stack_max = 10000, tiles = {"default_desert_cobble.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -223,7 +219,7 @@ minetest.register_node("maptools:desert_stonebrick", { stack_max = 10000, tiles = {"default_desert_stone_brick.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -234,7 +230,7 @@ minetest.register_node("maptools:grass", { tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, paramtype2 = "facedir", drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain = 0.4}, }), @@ -246,7 +242,7 @@ minetest.register_node("maptools:fullgrass", { stack_max = 10000, tiles = {"default_grass.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.4}, }), @@ -267,7 +263,7 @@ for slab_num = 1,3,1 do paramtype = "light", paramtype2 = "facedir", drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_dirt_defaults({footstep = {name="default_grass_footstep", gain = 0.4}}), }) end @@ -278,7 +274,7 @@ minetest.register_node("maptools:cobble", { stack_max = 10000, tiles = {"default_cobble.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -288,7 +284,7 @@ minetest.register_node("maptools:mossycobble", { stack_max = 10000, tiles = {"default_mossycobble.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -298,7 +294,7 @@ minetest.register_node("maptools:brick", { stack_max = 10000, tiles = {"default_brick.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -308,7 +304,7 @@ minetest.register_node("maptools:coalblock", { stack_max = 10000, tiles = {"default_coal_block.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -319,7 +315,7 @@ minetest.register_node("maptools:steelblock", { stack_max = 10000, tiles = {"default_steel_block.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -329,7 +325,7 @@ minetest.register_node("maptools:goldblock", { stack_max = 10000, tiles = {"default_gold_block.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -339,7 +335,7 @@ minetest.register_node("maptools:copperblock", { stack_max = 10000, tiles = {"default_copper_block.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -349,7 +345,7 @@ minetest.register_node("maptools:bronzeblock", { stack_max = 10000, tiles = {"default_bronze_block.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -359,7 +355,7 @@ minetest.register_node("maptools:diamondblock", { stack_max = 10000, tiles = {"default_steel_block.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, sounds = default.node_sound_stone_defaults(), }) @@ -371,7 +367,7 @@ minetest.register_node("maptools:soil_wet", { stack_max = 10000, tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"}, drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE, soil = 3, wet = 1, grassland = 1}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, soil = 3, wet = 1, grassland = 1}, sounds = default.node_sound_dirt_defaults(), }) @@ -381,6 +377,6 @@ minetest.register_node("maptools:desert_sand_soil_wet", { stack_max = 10000, drop = "", tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"}, - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE, soil = 3, wet = 1, desert = 1}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, soil = 3, wet = 1, desert = 1}, sounds = default.node_sound_sand_defaults(), }) diff --git a/init.lua b/init.lua index 39ee858..fde2d9d 100644 --- a/init.lua +++ b/init.lua @@ -1,536 +1,32 @@ -MAPTOOLS_CREATIVE = 1 -- Set this to 0 if you want Map Tools nodes and items to appear in the creative inventory. - --- Load translation library if intllib is installed - -local S -if (minetest.get_modpath("intllib")) then - dofile(minetest.get_modpath("intllib").."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) - else - S = function ( s ) return s end -end - -dofile(minetest.get_modpath("maptools").."/aliases.lua") -dofile(minetest.get_modpath("maptools").."/default_nodes.lua") - --[[ -Map Tools by Calinou -Licensed under the zlib license for code and CC BY-SA 3.0 for textures, see LICENSE.txt for info. +====================================================================== +** Map Tools ** +By Calinou. + +Copyright (c) 2012-2014 Calinou and contributors. +Licensed under the zlib license. See LICENSE.txt for more information. +====================================================================== --]] --- Redefine cloud so that the admin pickaxe can mine it. +maptools = {} -minetest.register_node(":default:cloud", { - description = S("Cloud"), - tiles = {"default_cloud.png"}, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - sounds = default.node_sound_defaults(), -}) - --- Items - -minetest.register_craft({ - type = "fuel", - recipe = "maptools:infinitefuel", - burntime = 1000000000, -}) - --- Nodes - -minetest.register_node("maptools:black", { - description = S("Black"), - range = 12, - stack_max = 10000, - tiles = {"black.png"}, - drop = "", - post_effect_color = {a=255, r=0, g=0, b=0}, - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("maptools:white", { - description = S("White"), - range = 12, - stack_max = 10000, - tiles = {"white.png"}, - drop = "", - post_effect_color = {a=255, r=128, g=128, b=128}, - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("maptools:playerclip", { - description = S("Player Clip"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_green.png", - drawtype = "airlike", - paramtype = "light", - pointable = false, - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:fake_walkable", { - description = S("Player Clip"), - drawtype = "nodebox", - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_green.png", - drawtype = "airlike", - paramtype = "light", - pointable = false, - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = { - {0, 0, 0, 0, 0, 0}, - }, - }, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:fullclip", { - description = S("Full Clip"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_blue.png", - drawtype = "airlike", - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:fake_walkable_pointable", { - description = S("Player Clip"), - drawtype = "nodebox", - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_green.png", - drawtype = "airlike", - paramtype = "light", - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = { - {0, 0, 0, 0, 0, 0}, - }, - }, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:ignore_like", { - description = S("Ignore-like"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_pink.png", - tiles = {"invisible.png"}, - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:ignore_like_no_clip", { - description = S("Ignore-like (no clip)"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_purple.png", - tiles = {"invisible.png"}, - paramtype = "light", - walkable = false, - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - - -minetest.register_node("maptools:ignore_like_no_point", { - description = S("Ignore-like (no point)"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_purple.png", - tiles = {"invisible.png"}, - paramtype = "light", - pointable = false, - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:ignore_like_no_clip_no_point", { - description = S("Ignore-like (no clip, no point)"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_pink.png", - tiles = {"invisible.png"}, - paramtype = "light", - walkable = false, - pointable = false, - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:fullclip_face", { - description = S("Full Clip Face"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_white.png", - drawtype = "nodebox", - tiles = {"invisible.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, - }, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE, fall_damage_add_percent=-100}, -}) - -minetest.register_node("maptools:playerclip_bottom", { - description = S("Player Clip Bottom Face"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_orange.png", - drawtype = "nodebox", - tiles = {"invisible.png"}, - pointable = false, - paramtype = "light", - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, - }, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE, fall_damage_add_percent=-100}, -}) - -minetest.register_node("maptools:playerclip_top", { - description = S("Player Clip Top Face"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_yellow.png", - drawtype = "nodebox", - tiles = {"invisible.png"}, - pointable = false, - paramtype = "light", - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = {-0.5, 0.4999, -0.5, 0.5, 0.5, 0.5}, - }, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE, fall_damage_add_percent=-100}, -}) - -for pusher_num=1,10,1 do -minetest.register_node("maptools:pusher_" .. pusher_num, { - description = S("Pusher (%s)"):format(pusher_num), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^default_apple.png", - drawtype = "nodebox", - tiles = {"invisible.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, - }, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE, fall_damage_add_percent=-100, bouncy=pusher_num*100}, -}) +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s) return s end end +maptools.intllib = S -minetest.register_node("maptools:lightbulb", { - description = S("Light Bulb"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^default_mese_crystal_fragment.png", - drawtype = "airlike", - walkable = false, - pointable = false, - light_source = 15, - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) +local modpath = minetest.get_modpath("maptools") -minetest.register_node("maptools:nobuild", { - description = S("Build Prevention"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^bones_bones.png", - drawtype = "airlike", - walkable = false, - pointable = false, - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:nointeract", { - description = S("Interact Prevention"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^default_scorched_stuff.png", - drawtype = "airlike", - walkable = false, - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:climb", { - description = S("Climb Block"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^default_ladder.png", - drawtype = "airlike", - walkable = false, - climbable = true, - pointable = false, - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -for damage_num=1,5,1 do -minetest.register_node("maptools:damage_" .. damage_num, { - description = S("Damaging Block (%s)"):format(damage_num), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^farming_cotton_" .. damage_num .. ".png", - drawtype = "airlike", - walkable = false, - pointable = false, - damage_per_second = damage_num, - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) -end - -minetest.register_node("maptools:kill", { - description = S("Kill Block"), - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^dye_black.png", - drawtype = "airlike", - walkable = false, - pointable = false, - damage_per_second = 20, - paramtype = "light", - sunlight_propagates = true, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_node("maptools:smoke", { - description = S("Smoke Block"), - range = 12, - stack_max = 10000, - tiles = {"maptools_smoke.png"}, - drawtype = "allfaces_optional", - walkable = false, - paramtype = "light", - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - post_effect_color = {a=192, r=96, g=96, b=96}, -}) - -minetest.register_node("maptools:ladder", { - description = S("Fake Ladder"), - range = 12, - stack_max = 10000, - drawtype = "signlike", - tiles = {"default_ladder.png"}, - inventory_image = "default_ladder.png", - wield_image = "default_ladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - }, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - sounds = default.node_sound_wood_defaults(), -}) - -minetest.register_node("maptools:permanent_fire", { - description = S("Permanent Fire"), - range = 12, - stack_max = 10000, - drawtype = "plantlike", - paramtype = "light", - tiles = {{ - name="fire_basic_flame_animated.png", - animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}, - }}, - inventory_image = "fire_basic_flame.png", - light_source = 14, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - sunlight_propagates = true, - walkable = false, - damage_per_second = 4, -}) - -minetest.register_node("maptools:fake_fire", { - description = S("Fake Fire"), - range = 12, - stack_max = 10000, - drawtype = "plantlike", - paramtype = "light", - tiles = {{ - name="fire_basic_flame_animated.png", - animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}, - }}, - inventory_image = "fire_basic_flame.png", - light_source = 14, - drop = "", - groups = {unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - sunlight_propagates = true, - walkable = false, -}) - -minetest.register_node("maptools:igniter", { - drawtype = "airlike", - range = 12, - stack_max = 10000, - inventory_image = "default_steel_block.png^crosshair.png", - description = S("Igniter"), - paramtype = "light", - inventory_image = "fire_basic_flame.png", - drop = "", - groups = {igniter=2, unbreakable = 1, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - sunlight_propagates = true, - pointable = false, - walkable = false, -}) - -minetest.register_node("maptools:superapple", { - description = S("Super Apple"), - range = 12, - stack_max = 10000, - drawtype = "plantlike", - visual_scale = 1.0, - tiles = {"maptools_superapple.png"}, - inventory_image = "maptools_superapple.png", - paramtype = "light", - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} - }, - walkable = false, - groups = {fleshy=3, dig_immediate=3, not_in_creative_inventory = MAPTOOLS_CREATIVE}, - on_use = minetest.item_eat(20), - sounds = default.node_sound_defaults(), -}) - --- Items - -minetest.register_craftitem("maptools:copper_coin", { - description = S("Copper Coin"), - inventory_image = "maptools_copper_coin.png", - wield_scale = {x = 0.5, y = 0.5, z = 0.25}, - stack_max = 10000, - groups = {not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_craftitem("maptools:silver_coin", { - description = S("Silver Coin"), - inventory_image = "maptools_silver_coin.png", - wield_scale = {x = 0.5, y = 0.5, z = 0.25}, - stack_max = 10000, - groups = {not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_craftitem("maptools:gold_coin", { - description = S("Gold Coin"), - inventory_image = "maptools_gold_coin.png", - wield_scale = {x = 0.5, y = 0.5, z = 0.25}, - stack_max = 10000, - groups = {not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - -minetest.register_craftitem("maptools:infinitefuel", { - description = S("Infinite Fuel"), - inventory_image = "maptools_infinitefuel.png", - stack_max = 10000, - groups = {not_in_creative_inventory = MAPTOOLS_CREATIVE}, -}) - --- Tools - -minetest.register_tool("maptools:pick_admin", { - description = S("Admin Pickaxe"), - range = 12, - inventory_image = "maptools_adminpick.png", - groups = {not_in_creative_inventory = MAPTOOLS_CREATIVE}, - tool_capabilities = { - full_punch_interval = 0.1, - max_drop_level = 3, - groupcaps= { - unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - }, - damage_groups = {fleshy = 1000}, - }, -}) - -minetest.register_tool("maptools:pick_admin_with_drops", { - description = S("Admin Pickaxe with Drops"), - range = 12, - inventory_image = "maptools_adminpick_with_drops.png", - groups = {not_in_creative_inventory = MAPTOOLS_CREATIVE}, - tool_capabilities = { - full_punch_interval = 0.35, - max_drop_level = 3, - groupcaps = { - unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, - }, - damage_groups = {fleshy = 1000}, - }, -}) - -minetest.register_on_punchnode(function(pos, node, puncher) - if puncher:get_wielded_item():get_name() == "maptools:pick_admin" - and minetest.get_node(pos).name ~= "air" then - minetest.log("action", puncher:get_player_name() .. " digs " .. minetest.get_node(pos).name .. " at " .. minetest.pos_to_string(pos) .. " using an Admin Pickaxe.") - minetest.remove_node(pos) -- The node is removed directly, which means it even works on non-empty containers and group-less nodes. - nodeupdate(pos) -- Run node update actions like falling nodes. - end -end) +dofile(modpath .. "/config.lua") +dofile(modpath .. "/aliases.lua") +dofile(modpath .. "/craftitems.lua") +dofile(modpath .. "/default_nodes.lua") +dofile(modpath .. "/nodes.lua") +dofile(modpath .. "/tools.lua") if minetest.setting_getbool("log_mods") then - minetest.log("action", "Carbone: [maptools] loaded.") + minetest.log("action", S("[maptools] loaded.")) end diff --git a/nodes.lua b/nodes.lua new file mode 100644 index 0000000..dbd3995 --- /dev/null +++ b/nodes.lua @@ -0,0 +1,422 @@ +local S = maptools.intllib + +maptools.creative = maptools.config["hide_from_creative_inventory"] + +-- Redefine cloud so that the admin pickaxe can mine it: +minetest.register_node(":default:cloud", { + description = S("Cloud"), + tiles = {"default_cloud.png"}, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, + sounds = default.node_sound_defaults(), +}) + +-- Nodes +-- ===== + +minetest.register_node("maptools:black", { + description = S("Black"), + range = 12, + stack_max = 10000, + tiles = {"black.png"}, + drop = "", + post_effect_color = {a=255, r=0, g=0, b=0}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("maptools:white", { + description = S("White"), + range = 12, + stack_max = 10000, + tiles = {"white.png"}, + drop = "", + post_effect_color = {a=255, r=128, g=128, b=128}, + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("maptools:playerclip", { + description = S("Player Clip"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_green.png", + drawtype = "airlike", + paramtype = "light", + pointable = false, + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:fake_walkable", { + description = S("Player Clip"), + drawtype = "nodebox", + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_green.png", + drawtype = "airlike", + paramtype = "light", + pointable = false, + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0}, + }, + }, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:fullclip", { + description = S("Full Clip"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_blue.png", + drawtype = "airlike", + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:fake_walkable_pointable", { + description = S("Player Clip"), + drawtype = "nodebox", + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_green.png", + drawtype = "airlike", + paramtype = "light", + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0}, + }, + }, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:ignore_like", { + description = S("Ignore-like"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_pink.png", + tiles = {"invisible.png"}, + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:ignore_like_no_clip", { + description = S("Ignore-like (no clip)"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_purple.png", + tiles = {"invisible.png"}, + paramtype = "light", + walkable = false, + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + + +minetest.register_node("maptools:ignore_like_no_point", { + description = S("Ignore-like (no point)"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_purple.png", + tiles = {"invisible.png"}, + paramtype = "light", + pointable = false, + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:ignore_like_no_clip_no_point", { + description = S("Ignore-like (no clip, no point)"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_pink.png", + tiles = {"invisible.png"}, + paramtype = "light", + walkable = false, + pointable = false, + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:fullclip_face", { + description = S("Full Clip Face"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_white.png", + drawtype = "nodebox", + tiles = {"invisible.png"}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, + }, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100}, +}) + +minetest.register_node("maptools:playerclip_bottom", { + description = S("Player Clip Bottom Face"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_orange.png", + drawtype = "nodebox", + tiles = {"invisible.png"}, + pointable = false, + paramtype = "light", + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, + }, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100}, +}) + +minetest.register_node("maptools:playerclip_top", { + description = S("Player Clip Top Face"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_yellow.png", + drawtype = "nodebox", + tiles = {"invisible.png"}, + pointable = false, + paramtype = "light", + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = {-0.5, 0.4999, -0.5, 0.5, 0.5, 0.5}, + }, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100}, +}) + +for pusher_num=1,10,1 do +minetest.register_node("maptools:pusher_" .. pusher_num, { + description = S("Pusher (%s)"):format(pusher_num), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^default_apple.png", + drawtype = "nodebox", + tiles = {"invisible.png"}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.4999, 0.5}, + }, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative, fall_damage_add_percent=-100, bouncy=pusher_num*100}, +}) +end + +minetest.register_node("maptools:lightbulb", { + description = S("Light Bulb"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^default_mese_crystal_fragment.png", + drawtype = "airlike", + walkable = false, + pointable = false, + light_source = 15, + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:nobuild", { + description = S("Build Prevention"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^bones_bones.png", + drawtype = "airlike", + walkable = false, + pointable = false, + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:nointeract", { + description = S("Interact Prevention"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^default_scorched_stuff.png", + drawtype = "airlike", + walkable = false, + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:climb", { + description = S("Climb Block"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^default_ladder.png", + drawtype = "airlike", + walkable = false, + climbable = true, + pointable = false, + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +for damage_num=1,5,1 do +minetest.register_node("maptools:damage_" .. damage_num, { + description = S("Damaging Block (%s)"):format(damage_num), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^farming_cotton_" .. damage_num .. ".png", + drawtype = "airlike", + walkable = false, + pointable = false, + damage_per_second = damage_num, + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) +end + +minetest.register_node("maptools:kill", { + description = S("Kill Block"), + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^dye_black.png", + drawtype = "airlike", + walkable = false, + pointable = false, + damage_per_second = 20, + paramtype = "light", + sunlight_propagates = true, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, +}) + +minetest.register_node("maptools:smoke", { + description = S("Smoke Block"), + range = 12, + stack_max = 10000, + tiles = {"maptools_smoke.png"}, + drawtype = "allfaces_optional", + walkable = false, + paramtype = "light", + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, + post_effect_color = {a=192, r=96, g=96, b=96}, +}) + +minetest.register_node("maptools:ladder", { + description = S("Fake Ladder"), + range = 12, + stack_max = 10000, + drawtype = "signlike", + tiles = {"default_ladder.png"}, + inventory_image = "default_ladder.png", + wield_image = "default_ladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + }, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("maptools:permanent_fire", { + description = S("Permanent Fire"), + range = 12, + stack_max = 10000, + drawtype = "plantlike", + paramtype = "light", + tiles = {{ + name="fire_basic_flame_animated.png", + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}, + }}, + inventory_image = "fire_basic_flame.png", + light_source = 14, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, + sunlight_propagates = true, + walkable = false, + damage_per_second = 4, +}) + +minetest.register_node("maptools:fake_fire", { + description = S("Fake Fire"), + range = 12, + stack_max = 10000, + drawtype = "plantlike", + paramtype = "light", + tiles = {{ + name="fire_basic_flame_animated.png", + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}, + }}, + inventory_image = "fire_basic_flame.png", + light_source = 14, + drop = "", + groups = {unbreakable = 1, not_in_creative_inventory = maptools.creative}, + sunlight_propagates = true, + walkable = false, +}) + +minetest.register_node("maptools:igniter", { + drawtype = "airlike", + range = 12, + stack_max = 10000, + inventory_image = "default_steel_block.png^crosshair.png", + description = S("Igniter"), + paramtype = "light", + inventory_image = "fire_basic_flame.png", + drop = "", + groups = {igniter=2, unbreakable = 1, not_in_creative_inventory = maptools.creative}, + sunlight_propagates = true, + pointable = false, + walkable = false, +}) + +minetest.register_node("maptools:superapple", { + description = S("Super Apple"), + range = 12, + stack_max = 10000, + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"maptools_superapple.png"}, + inventory_image = "maptools_superapple.png", + paramtype = "light", + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} + }, + walkable = false, + groups = {fleshy=3, dig_immediate=3, not_in_creative_inventory = maptools.creative}, + on_use = minetest.item_eat(20), + sounds = default.node_sound_defaults(), +}) diff --git a/tools.lua b/tools.lua new file mode 100644 index 0000000..f3a8973 --- /dev/null +++ b/tools.lua @@ -0,0 +1,54 @@ +local S = maptools.intllib + +maptools.creative = maptools.config["hide_from_creative_inventory"] + +minetest.register_tool("maptools:pick_admin", { + description = S("Admin Pickaxe"), + range = 12, + inventory_image = "maptools_adminpick.png", + groups = {not_in_creative_inventory = maptools.creative}, + tool_capabilities = { + full_punch_interval = 0.1, + max_drop_level = 3, + groupcaps= { + unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + }, + damage_groups = {fleshy = 1000}, + }, +}) + +minetest.register_tool("maptools:pick_admin_with_drops", { + description = S("Admin Pickaxe with Drops"), + range = 12, + inventory_image = "maptools_adminpick_with_drops.png", + groups = {not_in_creative_inventory = maptools.creative}, + tool_capabilities = { + full_punch_interval = 0.35, + max_drop_level = 3, + groupcaps = { + unbreakable = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + fleshy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + choppy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + bendy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + cracky = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + crumbly = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + snappy = {times={[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3}, + }, + damage_groups = {fleshy = 1000}, + }, +}) + +minetest.register_on_punchnode(function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "maptools:pick_admin" + and minetest.get_node(pos).name ~= "air" then + minetest.log("action", puncher:get_player_name() .. " digs " .. minetest.get_node(pos).name .. " at " .. minetest.pos_to_string(pos) .. " using an Admin Pickaxe.") + minetest.remove_node(pos) -- The node is removed directly, which means it even works on non-empty containers and group-less nodes. + nodeupdate(pos) -- Run node update actions like falling nodes. + end +end)