2014-11-20 17:23:43 +01:00
|
|
|
local cp = nil
|
|
|
|
|
2015-01-23 00:27:14 +01:00
|
|
|
local function register_fake_fire(name, def)
|
|
|
|
assert(name, "local registration called without name")
|
|
|
|
assert(def, "local registration called without node definition")
|
2014-07-27 18:03:52 +02:00
|
|
|
|
2015-01-23 00:27:14 +01:00
|
|
|
def.is_ground_content = true
|
2015-03-05 23:10:27 +01:00
|
|
|
def.inventory_image = def.inventory_image or name..".png"
|
2015-01-23 00:27:14 +01:00
|
|
|
def.drawtype = "plantlike"
|
2015-03-05 23:10:27 +01:00
|
|
|
def.waving = 1
|
2015-01-23 00:27:14 +01:00
|
|
|
def.light_source = def.lightsource or 14
|
|
|
|
def.sunlight_propagates = true
|
|
|
|
def.groups = def.groups or {
|
|
|
|
oddly_breakable_by_hand=3, dig_immediate=2,
|
|
|
|
attached_node=1, not_in_creative_inventory=1
|
|
|
|
}
|
|
|
|
def.paramtype = "light"
|
|
|
|
def.walkable = false
|
2015-03-05 23:10:27 +01:00
|
|
|
def.drop = ""
|
2015-01-23 00:27:14 +01:00
|
|
|
def.sounds = def.sounds or minetest.sound_play("fire_small", {pos=cp, loop=true})
|
|
|
|
def.buildable_to = true
|
|
|
|
|
|
|
|
local swap_on_punch = def.swap_on_punch
|
|
|
|
def.on_punch = def.on_punch or function (pos, node, puncher)
|
|
|
|
minetest.sound_play("fire_extinguish", {pos = pos, gain = 1.0, max_hear_distance = 5,})
|
|
|
|
if swap_on_punch then
|
|
|
|
minetest.set_node(pos, {name = swap_on_punch})
|
|
|
|
end
|
2014-07-27 18:03:52 +02:00
|
|
|
end
|
|
|
|
|
2015-01-23 00:27:14 +01:00
|
|
|
def.swap_on_punch = nil
|
|
|
|
def.smoking = nil
|
2015-03-05 23:10:27 +01:00
|
|
|
minetest.register_node("fake_fire:"..name, def)
|
2015-01-23 00:27:14 +01:00
|
|
|
end
|
2014-07-27 18:03:52 +02:00
|
|
|
|
2015-03-05 23:10:27 +01:00
|
|
|
|
2015-01-23 00:27:14 +01:00
|
|
|
-- FLAME TYPES
|
|
|
|
register_fake_fire("fake_fire", {
|
|
|
|
description = "Smokey, Fake Fire",
|
2014-07-27 18:03:52 +02:00
|
|
|
tiles = {
|
2015-03-05 23:10:27 +01:00
|
|
|
{name="fake_fire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}},
|
2015-01-23 00:27:14 +01:00
|
|
|
},
|
|
|
|
swap_on_punch = "fake_fire:smokeless_fire",
|
|
|
|
})
|
|
|
|
|
|
|
|
register_fake_fire("smokeless_fire", {
|
|
|
|
description = "Smokeless, Fake Fire",
|
|
|
|
tiles = {
|
2015-03-05 23:10:27 +01:00
|
|
|
{name="fake_fire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}},
|
2015-01-23 00:27:14 +01:00
|
|
|
},
|
|
|
|
inventory_image = 'fake_fire.png',
|
|
|
|
swap_on_punch = "fake_fire:fake_fire",
|
2014-07-27 18:03:52 +02:00
|
|
|
})
|
|
|
|
|
2015-01-23 00:27:14 +01:00
|
|
|
register_fake_fire("ice_fire", {
|
|
|
|
description = "Smoky, Fake, Ice Fire",
|
2014-07-27 18:03:52 +02:00
|
|
|
tiles = {
|
2015-03-05 23:10:27 +01:00
|
|
|
{name="ice_fire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}},
|
2015-01-23 00:27:14 +01:00
|
|
|
},
|
|
|
|
swap_on_punch = "fake_fire:smokeless_ice_fire",
|
2014-07-27 18:03:52 +02:00
|
|
|
})
|
|
|
|
|
2015-01-23 00:27:14 +01:00
|
|
|
register_fake_fire("smokeless_ice_fire", {
|
|
|
|
description = "Smokeless, Fake, Ice Fire",
|
2014-07-27 18:03:52 +02:00
|
|
|
tiles = {
|
2015-03-05 23:10:27 +01:00
|
|
|
{name="ice_fire_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1.5}},
|
2015-01-23 00:27:14 +01:00
|
|
|
},
|
2014-07-27 18:03:52 +02:00
|
|
|
inventory_image = 'ice_fire.png',
|
2015-01-23 00:27:14 +01:00
|
|
|
swap_on_punch = "fake_fire:ice_fire",
|
2014-07-27 18:03:52 +02:00
|
|
|
})
|
|
|
|
|
2015-03-05 23:10:27 +01:00
|
|
|
|
2014-07-27 18:03:52 +02:00
|
|
|
-- FLINT and STEEL
|
|
|
|
minetest.register_tool("fake_fire:flint_and_steel", {
|
|
|
|
description = "Flint and steel",
|
|
|
|
inventory_image = "flint_and_steel.png",
|
|
|
|
liquids_pointable = false,
|
|
|
|
stack_max = 1,
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=0,
|
|
|
|
groupcaps={flamable = {uses=65, maxlevel=1},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
local snow_ice_list = {"snow", "ice",}
|
|
|
|
|
|
|
|
for _, which_one_is_it in pairs(snow_ice_list) do
|
|
|
|
local snow_ice = which_one_is_it
|
|
|
|
|
2015-03-05 23:10:27 +01:00
|
|
|
if pointed_thing.type == "node"
|
|
|
|
and not string.find(minetest.get_node(pointed_thing.under).name, "snow")
|
|
|
|
and not string.find(minetest.get_node(pointed_thing.under).name, "ice")
|
|
|
|
and minetest.get_node(pointed_thing.above).name == "air"
|
2014-07-27 18:03:52 +02:00
|
|
|
then
|
2014-07-30 16:15:25 +02:00
|
|
|
if not minetest.is_protected(pointed_thing.above, user:get_player_name()) then
|
|
|
|
minetest.set_node(pointed_thing.above, {name="fake_fire:smokeless_fire"})
|
|
|
|
else
|
|
|
|
minetest.chat_send_player(user:get_player_name(), "You can't set a fire in someone else's area!")
|
|
|
|
end
|
2015-03-05 23:10:27 +01:00
|
|
|
elseif pointed_thing.type == "node"
|
|
|
|
and string.find(minetest.get_node(pointed_thing.under).name,snow_ice)
|
|
|
|
and minetest.get_node(pointed_thing.above).name == "air" then
|
|
|
|
if not minetest.is_protected(pointed_thing.above, user:get_player_name()) then
|
|
|
|
minetest.set_node(pointed_thing.above, {name="fake_fire:smokeless_ice_fire"})
|
|
|
|
else
|
|
|
|
minetest.chat_send_player(user:get_player_name(), "You can't set a fire in someone else's area!")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-07-27 18:03:52 +02:00
|
|
|
|
2015-03-05 23:10:27 +01:00
|
|
|
minetest.sound_play("", {gain = 1.0, max_hear_distance = 2,})
|
2014-07-27 18:03:52 +02:00
|
|
|
itemstack:add_wear(65535/65)
|
|
|
|
return itemstack
|
|
|
|
end
|
2015-03-05 23:10:27 +01:00
|
|
|
})
|
2014-07-27 18:03:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
-- EMBERS
|
|
|
|
minetest.register_node("fake_fire:embers", {
|
|
|
|
description = "Glowing Embers",
|
|
|
|
tiles = {
|
|
|
|
{name="embers_animated.png", animation={type="vertical_frames",
|
|
|
|
aspect_w=16, aspect_h=16, length=2}},
|
|
|
|
},
|
|
|
|
inventory_image = minetest.inventorycube('fake_fire_embers.png'),
|
|
|
|
is_ground_content = true,
|
|
|
|
light_source = 9,
|
|
|
|
sunlight_propagates = true,
|
|
|
|
groups = {choppy=3, crumbly=3, oddly_breakable_by_hand=3},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
walkable = true,
|
|
|
|
sounds = minetest.sound_play("fire_small", {pos=cp, loop=true}),
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- CHIMNEY TOP - STONE
|
|
|
|
minetest.register_node("fake_fire:chimney_top_stone", {
|
|
|
|
description = "Chimney Top - Stone",
|
|
|
|
tiles = {"chimney_top_stone.png", "default_stone.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {cracky=3, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
|
|
|
paramtype = "light",
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
drop = "fake_fire:smokeless_chimney_top_stone",
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
|
|
},
|
|
|
|
on_punch = function (pos,node,puncher)
|
|
|
|
minetest.set_node(pos, {name = "fake_fire:smokeless_chimney_top_stone"})
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- CHIMNEY TOP - SANDSTONE
|
|
|
|
minetest.register_node("fake_fire:chimney_top_sandstone", {
|
|
|
|
description = "Chimney Top - Sandstone",
|
|
|
|
tiles = {"chimney_top_sandstone.png", "default_sandstone.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {cracky=3, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
|
|
|
|
paramtype = "light",
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
drop = "fake_fire:smokeless_chimney_top_sandstone",
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
|
|
},
|
|
|
|
on_punch = function (pos,node,puncher)
|
2015-03-05 23:10:27 +01:00
|
|
|
minetest.set_node(pos, {name = "fake_fire:smokeless_chimney_top_sandstone"})
|
2014-07-27 18:03:52 +02:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- SMOKELESS CHIMNEY TOP - STONE
|
|
|
|
minetest.register_node("fake_fire:smokeless_chimney_top_stone", {
|
|
|
|
description = "Chimney Top - Stone",
|
|
|
|
tiles = {"chimney_top_stone.png", "default_stone.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {cracky=3, oddly_breakable_by_hand=1},
|
|
|
|
paramtype = "light",
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
|
|
},
|
|
|
|
on_punch = function (pos,node,puncher)
|
|
|
|
minetest.set_node(pos, {name = "fake_fire:chimney_top_stone"})
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- SMOKELESS CHIMNEY TOP - SANDSTONE
|
|
|
|
minetest.register_node("fake_fire:smokeless_chimney_top_sandstone", {
|
|
|
|
description = "Chimney Top - Sandstone",
|
|
|
|
tiles = {"chimney_top_sandstone.png", "default_sandstone.png"},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {cracky=3, oddly_breakable_by_hand=1},
|
|
|
|
paramtype = "light",
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
|
|
},
|
|
|
|
on_punch = function (pos,node,puncher)
|
|
|
|
minetest.set_node(pos, {name = "fake_fire:chimney_top_sandstone"})
|
|
|
|
end
|
|
|
|
})
|