mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 00:19:32 +01:00
Allow to light Nether portal with any fire
This commit is contained in:
parent
3857ff43ef
commit
70198eb50b
8 changed files with 40 additions and 13 deletions
|
@ -2,3 +2,4 @@ mcl_core
|
||||||
mcl_util
|
mcl_util
|
||||||
mcl_sounds
|
mcl_sounds
|
||||||
mcl_nether?
|
mcl_nether?
|
||||||
|
mcl_portals?
|
||||||
|
|
|
@ -19,7 +19,10 @@ minetest.register_craftitem("mcl_fire:fire_charge", {
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
local nodedef = minetest.registered_nodes[node.name]
|
local nodedef = minetest.registered_nodes[node.name]
|
||||||
if nodedef and nodedef._on_ignite then
|
if nodedef and nodedef._on_ignite then
|
||||||
nodedef._on_ignite(user, pointed_thing)
|
local overwrite = nodedef._on_ignite(user, pointed_thing)
|
||||||
|
if not overwrite then
|
||||||
|
mcl_fire.set_fire(pointed_thing)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
mcl_fire.set_fire(pointed_thing)
|
mcl_fire.set_fire(pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,10 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||||
if nodedef and nodedef._on_ignite then
|
if nodedef and nodedef._on_ignite then
|
||||||
nodedef._on_ignite(user, pointed_thing)
|
local overwrite = nodedef._on_ignite(user, pointed_thing)
|
||||||
|
if not overwrite then
|
||||||
|
mcl_fire.set_fire(pointed_thing)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
mcl_fire.set_fire(pointed_thing)
|
mcl_fire.set_fire(pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,11 +72,18 @@ minetest.register_node("mcl_fire:fire", {
|
||||||
end,
|
end,
|
||||||
drop = "",
|
drop = "",
|
||||||
sounds = {},
|
sounds = {},
|
||||||
|
-- Turn into eternal fire on special blocks, light Nether portal (if possible), start burning timer
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local under = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
local under = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||||
|
|
||||||
if under == "mcl_nether:magma" or under == "mcl_nether:netherrack" then
|
if under == "mcl_nether:magma" or under == "mcl_nether:netherrack" then
|
||||||
minetest.swap_node(pos, {name = "mcl_fire:eternal_fire"})
|
minetest.swap_node(pos, {name = "mcl_fire:eternal_fire"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("mcl_portals") then
|
||||||
|
mcl_portals.light_nether_portal(pos)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.get_node_timer(pos):start(math.random(3, 7))
|
minetest.get_node_timer(pos):start(math.random(3, 7))
|
||||||
end,
|
end,
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
|
@ -126,8 +133,13 @@ minetest.register_node("mcl_fire:eternal_fire", {
|
||||||
-- Restart timer
|
-- Restart timer
|
||||||
minetest.get_node_timer(pos):start(math.random(3, 7))
|
minetest.get_node_timer(pos):start(math.random(3, 7))
|
||||||
end,
|
end,
|
||||||
|
-- Start burning timer and light Nether portal (if possible)
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(3, 7))
|
minetest.get_node_timer(pos):start(math.random(3, 7))
|
||||||
|
|
||||||
|
if minetest.get_modpath("mcl_portals") then
|
||||||
|
mcl_portals.light_nether_portal(pos)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
sounds = {},
|
sounds = {},
|
||||||
drop = "",
|
drop = "",
|
||||||
|
@ -395,8 +407,9 @@ local eternal_override = {
|
||||||
local fn = minetest.get_node(flame_pos)
|
local fn = minetest.get_node(flame_pos)
|
||||||
if fn.name == "air" and not minetest.is_protected(flame_pos, "fire") and pointed_thing.under.y < pointed_thing.above.y then
|
if fn.name == "air" and not minetest.is_protected(flame_pos, "fire") and pointed_thing.under.y < pointed_thing.above.y then
|
||||||
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})
|
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})
|
||||||
|
return true
|
||||||
else
|
else
|
||||||
mcl_fire.set_fire(pointed_thing)
|
return false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
@ -409,8 +422,9 @@ local eternal_override_end = {
|
||||||
local fn = minetest.get_node(flame_pos)
|
local fn = minetest.get_node(flame_pos)
|
||||||
if dim == "end" and fn.name == "air" and not minetest.is_protected(flame_pos, "fire") and pointed_thing.under.y < pointed_thing.above.y then
|
if dim == "end" and fn.name == "air" and not minetest.is_protected(flame_pos, "fire") and pointed_thing.under.y < pointed_thing.above.y then
|
||||||
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})
|
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})
|
||||||
|
return true
|
||||||
else
|
else
|
||||||
mcl_fire.set_fire(pointed_thing)
|
return false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
mcl_init
|
mcl_init
|
||||||
mcl_util
|
mcl_util
|
||||||
mcl_core
|
mcl_core
|
||||||
mcl_fire
|
|
||||||
mcl_nether
|
mcl_nether
|
||||||
mcl_end
|
mcl_end
|
||||||
mcl_particles
|
mcl_particles
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
-- Load files
|
-- Load files
|
||||||
|
|
||||||
|
mcl_portals = {}
|
||||||
|
|
||||||
-- Nether portal:
|
-- Nether portal:
|
||||||
-- Obsidian frame, activated by flint and steel
|
-- Obsidian frame, activated by flint and steel
|
||||||
dofile(minetest.get_modpath("mcl_portals").."/portal_nether.lua")
|
dofile(minetest.get_modpath("mcl_portals").."/portal_nether.lua")
|
||||||
|
|
|
@ -281,8 +281,13 @@ local function is_portal(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Light Nether portal and create target portal
|
-- Attempts to light a Nether portal at pos and
|
||||||
local function make_portal(pos)
|
-- select target position.
|
||||||
|
-- Pos can be any of the obsidian frame blocks or the inner part.
|
||||||
|
-- The frame MUST be filled only with air or any fire, which will be replaced with Nether portal blocks.
|
||||||
|
-- If no Nether portal can be lit, nothing happens.
|
||||||
|
-- Returns true on success and false on failure.
|
||||||
|
function mcl_portals.light_nether_portal(pos)
|
||||||
-- Create Nether portal nodes
|
-- Create Nether portal nodes
|
||||||
local p1, p2 = is_portal(pos)
|
local p1, p2 = is_portal(pos)
|
||||||
if not p1 or not p2 then
|
if not p1 or not p2 then
|
||||||
|
@ -297,7 +302,8 @@ local function make_portal(pos)
|
||||||
else
|
else
|
||||||
p = {x = p1.x, y = y, z = p1.z + d}
|
p = {x = p1.x, y = y, z = p1.z + d}
|
||||||
end
|
end
|
||||||
if minetest.get_node(p).name ~= "air" then
|
local nn = minetest.get_node(p).name
|
||||||
|
if nn ~= "air" and minetest.get_item_group(nn, "fire") ~= 1 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -451,7 +457,7 @@ minetest.override_item("mcl_core:obsidian", {
|
||||||
on_destruct = destroy_portal,
|
on_destruct = destroy_portal,
|
||||||
_on_ignite = function(user, pointed_thing)
|
_on_ignite = function(user, pointed_thing)
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
local portal_placed = make_portal(pos)
|
local portal_placed = mcl_portals.light_nether_portal(pos)
|
||||||
if portal_placed and minetest.get_modpath("doc") then
|
if portal_placed and minetest.get_modpath("doc") then
|
||||||
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal")
|
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal")
|
||||||
|
|
||||||
|
@ -460,11 +466,9 @@ minetest.override_item("mcl_core:obsidian", {
|
||||||
if minetest.get_modpath("awards") and dim ~= "nether" and user:is_player() then
|
if minetest.get_modpath("awards") and dim ~= "nether" and user:is_player() then
|
||||||
awards.unlock(user:get_player_name(), "mcl:buildNetherPortal")
|
awards.unlock(user:get_player_name(), "mcl:buildNetherPortal")
|
||||||
end
|
end
|
||||||
|
return true
|
||||||
else
|
else
|
||||||
local node = minetest.get_node(pointed_thing.above)
|
return false
|
||||||
if node.name ~= "mcl_portals:portal" then
|
|
||||||
mcl_fire.set_fire(pointed_thing)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
@ -74,6 +74,7 @@ minetest.register_node("mcl_tnt:tnt", {
|
||||||
}},
|
}},
|
||||||
_on_ignite = function(player, pointed_thing)
|
_on_ignite = function(player, pointed_thing)
|
||||||
tnt.ignite(pointed_thing.under)
|
tnt.ignite(pointed_thing.under)
|
||||||
|
return true
|
||||||
end,
|
end,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue