Allow portals to break only in creative and to be pointed.

This commit is contained in:
iliekprogrammar 2021-03-14 20:10:12 +08:00
parent 53bfda827a
commit 7ce6485717

@ -64,7 +64,7 @@ local function destroy_nether_portal(pos)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
local nn, orientation = node.name, node.param2
local obsidian = nn == "mcl_core:obsidian"
local obsidian = nn == "mcl_core:obsidian"
local has_meta = minetest.string_to_pos(meta:get_string("portal_frame1"))
if has_meta then
@ -138,8 +138,6 @@ minetest.register_node("mcl_portals:portal", {
sunlight_propagates = true,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true,
walkable = false,
diggable = false,
pointable = false,
buildable_to = false,
is_ground_content = false,
drop = "",
@ -152,7 +150,7 @@ minetest.register_node("mcl_portals:portal", {
{-0.5, -0.5, -0.1, 0.5, 0.5, 0.1},
},
},
groups = {portal=1, not_in_creative_inventory = 1},
groups = { creative_breakable = 1, portal = 1, not_in_creative_inventory = 1 },
on_destruct = destroy_nether_portal,
_mcl_hardness = -1,
@ -583,7 +581,7 @@ local function check_and_light_shape(pos, orientation)
meta:set_string("portal_time", tostring(0))
meta:set_string("portal_target", "")
end
return true
return true
end
-- Attempts to light a Nether portal at pos
@ -842,7 +840,7 @@ minetest.override_item("mcl_core:obsidian", {
_on_ignite = function(user, pointed_thing)
local x, y, z = pointed_thing.under.x, pointed_thing.under.y, pointed_thing.under.z
-- Check empty spaces around obsidian and light all frames found:
local portals_placed =
local portals_placed =
mcl_portals.light_nether_portal({x = x - 1, y = y, z = z}) or mcl_portals.light_nether_portal({x = x + 1, y = y, z = z}) or
mcl_portals.light_nether_portal({x = x, y = y - 1, z = z}) or mcl_portals.light_nether_portal({x = x, y = y + 1, z = z}) or
mcl_portals.light_nether_portal({x = x, y = y, z = z - 1}) or mcl_portals.light_nether_portal({x = x, y = y, z = z + 1})
@ -863,4 +861,3 @@ minetest.override_item("mcl_core:obsidian", {
end
end,
})