1
0
Fork 0

Fix bugs in flint and ssteel and ender eye

objects
Wuzzy 2017-08-17 04:12:34 +02:00
parent 29873b96c1
commit 817c52f92f
5 changed files with 35 additions and 53 deletions

View File

@ -1,8 +1,8 @@
-- Flint and Steel
minetest.register_tool("mcl_fire:flint_and_steel", {
description = "Flint and Steel",
_doc_items_longdesc = "Flint and steel is a tool to start fires and ignite blocks.",
_doc_items_usagehelp = "Rightclick the surface of a block to attempt to light a fire in front of it. On netherrack and magma blocks it will start an eternal fire. Using it on TNT will ignite it.",
_doc_items_longdesc = "Flint and steel is a tool to start fires, ignite blocks and open portals.",
_doc_items_usagehelp = "Rightclick the surface of a block to attempt to light a fire in front of it. On netherrack it will start an eternal fire. Using it on TNT will ignite it. To open a Nether portal, place an upright frame of obsidian with a length of 4 and a height of 5 blocks, leaving only air in the center. After placing this frame, use the flint and steel on inside of the frame.",
inventory_image = "mcl_fire_flint_and_steel.png",
liquids_pointable = false,
stack_max = 1,
@ -25,7 +25,7 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
if pointed_thing.type == "node" then
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
if nodedef and nodedef._on_ignite then
nodedef._on_ignite(pointed_thing.under, user)
nodedef._on_ignite(user, pointed_thing)
else
mcl_fire.set_fire(pointed_thing)
end

View File

@ -376,7 +376,8 @@ local eternal_override = {
minetest.remove_node(pos)
end
end,
_on_ignite = function(pos, player)
_on_ignite = function(player, pointed_thing)
local pos = pointed_thing.under
local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
if minetest.get_node(flame_pos).name == "air" then
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})

View File

@ -71,8 +71,8 @@ minetest.register_node("mcl_tnt:tnt", {
mesecons = {effector = {
action_on = tnt.ignite
}},
_on_ignite = function(pos, player)
tnt.ignite(pos)
_on_ignite = function(player, pointed_thing)
tnt.ignite(pointed_thing.under)
end,
sounds = sounds,
})

View File

@ -373,22 +373,29 @@ minetest.override_item("mcl_end:ender_eye", {
_doc_items_longdesc = "An eye of ander can be used to open a portal to the End.",
_doc_items_usagehelp = "To open an End portal, place an upright frame of quartz blocks with a length of 4 and a height of 5 blocks, leaving only air in the center. After placing this frame, use the eye of ender on the frame.",
on_place = function(itemstack, user, pointed_thing)
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name] --new
-- Use pointed node's on_rightclick function first, if present
local node = minetest.get_node(pointed_thing.under)
if user and not user:get_player_control().sneak then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
end
end
-- If used on frame, open portal
if pointed_thing.under and minetest.get_node(pointed_thing.under).name == portal_frame then
make_end_portal(pointed_thing.under)
-- If used on portal frame, open a portal
if pointed_thing.under and node.name == portal_frame then
local opened = make_end_portal(pointed_thing.under)
if opened then
if minetest.get_modpath("doc") then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal_end")
end
minetest.sound_play(
"fire_flint_and_steel",
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8}
)
if not minetest.setting_getbool("creative_mode") and used == true then
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 16})
if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() -- 1 use
end
end
end
return itemstack
end,

View File

@ -380,43 +380,17 @@ minetest.register_abm({
-- Frame material
minetest.override_item("mcl_core:obsidian", {
on_destruct = destroy_portal,
})
-- Portal opener
minetest.override_item("mcl_fire:flint_and_steel", {
_doc_items_longdesc = "Flint and steel is a tool to start fires, ignite blocks and open portals.",
_doc_items_usagehelp = "Rightclick the surface of a block to attempt to light a fire in front of it. On netherrack it will start an eternal fire. Using it on TNT will ignite it. To open a Nether portal, place an upright frame of obsidian with a length of 4 and a height of 5 blocks, leaving only air in the center. After placing this frame, use the flint and steel on inside of the frame.",
on_place = function(itemstack, user, pointed_thing)
local idef = itemstack:get_definition()
minetest.sound_play(
"fire_flint_and_steel",
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8}
)
local used = false
if pointed_thing.under and minetest.get_node(pointed_thing.under).name == "mcl_core:obsidian" then
make_portal(pointed_thing.under)
if minetest.get_modpath("doc") then
_on_ignite = function(user, pointed_thing)
local pos = pointed_thing.under
local portal_placed = make_portal(pos)
if portal_placed and minetest.get_modpath("doc") then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal")
end
else
if pointed_thing.type == "node" then
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
if nodedef._on_ignite then
nodedef._on_ignite(pointed_thing.under, user)
else
local node = minetest.get_node(pointed_thing.above)
if node.name ~= "mcl_portals:portal" then
mcl_fire.set_fire(pointed_thing)
end
used = true
end
end
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5})
end
if not minetest.setting_getbool("creative_mode") and used == true then
itemstack:add_wear(65535/65) -- 65 uses
end
return itemstack
end,
})