From 58a17444ba877d3a65169081c38cbaab38dd3bb2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 8 Aug 2017 23:19:44 +0200 Subject: [PATCH] Add realm barrier node to separate realms --- mods/ITEMS/mcl_core/nodes_misc.lua | 37 +++++++++++++++++++++++++++++ mods/PLAYER/mcl_playerplus/init.lua | 17 +++++++++---- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_misc.lua b/mods/ITEMS/mcl_core/nodes_misc.lua index 8a82b20323..a86a30d296 100644 --- a/mods/ITEMS/mcl_core/nodes_misc.lua +++ b/mods/ITEMS/mcl_core/nodes_misc.lua @@ -140,6 +140,43 @@ minetest.register_node("mcl_core:barrier", { end, }) +-- Same as barrier, but non-pointable. This node is only to be used internally to separate realms. +-- It must NOT be used for anything else. +-- This node only exists because Minetest does not have support for “dimensions” yet and needs to +-- be removed when support for this is implemented. +minetest.register_node("mcl_core:realm_barrier", { + description = "Realm Barrier", + _doc_items_create_entry = false, + drawtype = "airlike", + paramtype = "light", + inventory_image = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX", + wield_image = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX", + tiles = { "blank.png" }, + stack_max = 64, + sunlight_propagates = true, + is_ground_content = false, + pointable = false, + groups = {not_in_creative_inventory = 1, not_solid = 1 }, + on_blast = function() end, + drop = "", + _mcl_blast_resistance = 18000003, + _mcl_hardness = -1, + after_place_node = function (pos, placer, itemstack, pointed_thing) + if placer == nil then + return + end + minetest.add_particle({ + pos = pos, + expirationtime = 1, + size = 8, + texture = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX", + playername = placer:get_player_name() + }) + end, +}) + + + -- The void below the bedrock. Void damage is handled in mcl_playerplus. -- The void does not exist as a block in Minecraft but we register it as a diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index fc67e64a23..88cae8319d 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -208,7 +208,8 @@ minetest.register_globalstep(function(dtime) end -- Show positions of barriers when player is wielding a barrier - if player:get_wielded_item():get_name() == "mcl_core:barrier" then + local wi = player:get_wielded_item():get_name() + if wi == "mcl_core:barrier" or wi == "mcl_core:realm_barrier" then local pos = vector.round(player:getpos()) local r = 8 local vm = minetest.get_voxel_manip() @@ -221,14 +222,20 @@ minetest.register_globalstep(function(dtime) for x=pos.x-r, pos.x+r do for y=pos.y-r, pos.y+r do for z=pos.z-r, pos.z+r do - local vi = area:indexp(pos) - local node = minetest.get_name_from_content_id(data[vi]) - if minetest.get_node({x=x,y=y,z=z}).name == "mcl_core:barrier" then + local vi = area:indexp({x=x, y=y, z=z}) + local nodename = minetest.get_name_from_content_id(data[vi]) + local tex + if nodename == "mcl_core:barrier" then + tex = "mcl_core_barrier.png" + elseif nodename == "mcl_core:realm_barrier" then + tex = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX" + end + if tex then minetest.add_particle({ pos = {x=x, y=y, z=z}, expirationtime = 1, size = 8, - texture = "mcl_core_barrier.png", + texture = tex, playername = name }) end