1
0
Fork 0

Add realm barrier node to separate realms

This commit is contained in:
Wuzzy 2017-08-08 23:19:44 +02:00
parent 40d3f5c0e6
commit 58a17444ba
2 changed files with 49 additions and 5 deletions

View File

@ -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

View File

@ -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