From f00034738091531348f73b34cddde5a21ba94a4e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 27 Jan 2017 18:15:36 +0100 Subject: [PATCH] Rename wallet mod to mcl_walls --- mods/{wallet => mcl_walls}/depends.txt | 0 mods/{wallet => mcl_walls}/init.lua | 31 ++++++++++++------ .../textures/mcl_walls_cobble.png} | Bin .../textures/mcl_walls_mossycobble.png} | Bin 4 files changed, 21 insertions(+), 10 deletions(-) rename mods/{wallet => mcl_walls}/depends.txt (100%) rename mods/{wallet => mcl_walls}/init.lua (84%) rename mods/{wallet/textures/cobblestone_wallet.png => mcl_walls/textures/mcl_walls_cobble.png} (100%) rename mods/{wallet/textures/cobblestonemossy_wallet.png => mcl_walls/textures/mcl_walls_mossycobble.png} (100%) diff --git a/mods/wallet/depends.txt b/mods/mcl_walls/depends.txt similarity index 100% rename from mods/wallet/depends.txt rename to mods/mcl_walls/depends.txt diff --git a/mods/wallet/init.lua b/mods/mcl_walls/init.lua similarity index 84% rename from mods/wallet/init.lua rename to mods/mcl_walls/init.lua index 4d2f6c75c..981b50a81 100644 --- a/mods/wallet/init.lua +++ b/mods/mcl_walls/init.lua @@ -13,19 +13,25 @@ local directions = { local function update_wall(pos) local thisnode = minetest.get_node(pos) - if thisnode.name:find("wallet:wall") ~= 1 and - thisnode.name:find("wallet:wallmossy") ~= 1 then - -- Not a wall + if minetest.get_item_group(thisnode.name, "wall") == 0 then return end -- Get the node's base name, including the underscore since we will need it - local basename = thisnode.name:find("_") - if basename == nil then -- New wall + local colonpos = thisnode.name:find(":") + local underscorepos + local itemname, basename + if colonpos ~= nil then + itemname = thisnode.name:sub(colonpos+1) + end + minetest.log("error", itemname) + underscorepos = itemname:find("_") + if underscorepos == nil then -- New wall basename = thisnode.name .. "_" else -- Already placed wall - basename = thisnode.name:sub(1, basename) + basename = "mcl_walls:" .. itemname:sub(1, underscorepos) end + minetest.log("error", basename) local sum = 0 @@ -74,6 +80,11 @@ local full_blocks = { {-3/16, -0.5, -0.5, 3/16, 5/16, 0.5} } +--[[ Adds a new wall type. +* nodename: Itemstring of base node. Must not contain an underscore +* name: Item name, visible to user +* texture: Wall texture +* invtex: Inventory image ]] local function register_wall(nodename, name, texture, invtex) for i = 0, 15 do local need = {} @@ -183,9 +194,9 @@ end -- Cobblestone wall -register_wall("wallet:wall", "Cobblestone Wall", "default_cobble.png", "cobblestone_wallet.png") +register_wall("mcl_walls:cobble", "Cobblestone Wall", "default_cobble.png", "mcl_walls_cobble.png") minetest.register_craft({ - output = 'wallet:wall 6', + output = 'mcl_walls:cobble 6', recipe = { {'default:cobble', 'default:cobble', 'default:cobble'}, {'default:cobble', 'default:cobble', 'default:cobble'} @@ -194,9 +205,9 @@ minetest.register_craft({ -- Mossy wall -register_wall("wallet:wallmossy", "Mossy Cobblestone Wall", "default_mossycobble.png", "cobblestonemossy_wallet.png") +register_wall("mcl_walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", "mcl_walls_mossycobble.png") minetest.register_craft({ - output = 'wallet:wallmossy 6', + output = 'mcl_walls:mossycobble 6', recipe = { {'default:mossycobble', 'default:mossycobble', 'default:mossycobble'}, {'default:mossycobble', 'default:mossycobble', 'default:mossycobble'} diff --git a/mods/wallet/textures/cobblestone_wallet.png b/mods/mcl_walls/textures/mcl_walls_cobble.png similarity index 100% rename from mods/wallet/textures/cobblestone_wallet.png rename to mods/mcl_walls/textures/mcl_walls_cobble.png diff --git a/mods/wallet/textures/cobblestonemossy_wallet.png b/mods/mcl_walls/textures/mcl_walls_mossycobble.png similarity index 100% rename from mods/wallet/textures/cobblestonemossy_wallet.png rename to mods/mcl_walls/textures/mcl_walls_mossycobble.png