Added jp's fork of LazyJ's fork of semmet9's fake fire mod

Used and re-licensed with permission of LazyJ and jp:

```
[07-27 10:02] <jp__> Hi Vanessa. I replaced the LazyJ's smokes nodes by few particules : https://forum.minetest.net/viewtopic.php?p=149534#p149534
[07-27 10:03] <jp__> Now I think this mod is mature for integrate Homedecor...

[07-27 10:17] <VanessaE> LazyJ: homedecor is LGPL.  your code is GPL.  by extension so is jp's fork.
[07-27 10:18] <VanessaE> I'd like to include his fork of your mod into homedecor modpack.
[07-27 10:18] <VanessaE> your permission is required :)
[07-27 10:18] <LazyJ> Ok.
[07-27 10:18] <LazyJ> What's the difference between LGPL and GPL? I just go with whatever the original author uses.
[07-27 10:19] <VanessaE> beats the hell out of me exactly except LGPL is supposed to make it easier to use code so-licensed in proprietary projects or something.
[07-27 10:19] <VanessaE> I only use it because minetest_game did and I got some code from there.
[07-27 10:20] <LazyJ> Ok with me to use it.
[07-27 10:21] <LazyJ> Credit to semmett9 too.
```
This commit is contained in:
Vanessa Ezekowitz
2014-07-27 12:03:52 -04:00
parent 2e05b5d49c
commit 6f492914db
29 changed files with 1581 additions and 0 deletions

View File

@ -0,0 +1,77 @@
--[[
I commented out this part because:
1. water and lava buckets are disabled on some servers,
2. putting out fire with water and especially lava would only make
a big mess, and...
As for 'realism':
* C'mon... This is *fake* fire.
* Torches have long been impervious to water.
* Minetest creates surreal worlds so it's OK if some things aren't
perfectly realistic.
Besides, the fake-fire can be put out by punching it - simple and effective.
~ LazyJ, 2014_03_14
-- water and lava puts out fake fire --
minetest.register_abm({
nodenames = {"fake_fire:fake_fire"},
interval = 1,
chance = 1,
action = function(pos, node)
if minetest.env:find_node_near(pos, 1, {"default:water_source",
"default:water_flowing","default:lava_source",
"default:lava_flowing"}) then
minetest.sound_play("fire_extinguish",
{gain = 1.0, max_hear_distance = 20,})
node.name = "air"
minetest.env:set_node(pos, node)
end
end
})
--]]
-- ADVISING ABOUT SMOKE PARTICLES SETTINGS
-- For the best visual result...
-- If you increase the particles size,
-- you should decrease the particles amount and/or increase the smoke column lenght.
-- If you increase the particle time duration and/or particle course,
-- you should decrease the particles amount or increase the smoke column lenght.
-- Or conversely...
-- ~ JP
minetest.register_abm({
nodenames = {
"fake_fire:fake_fire",
"fake_fire:ice_fire",
"fake_fire:chimney_top_stone",
"fake_fire:chimney_top_sandstone"
},
interval = 1,
chance = 2,
action = function(pos, node)
minetest.add_particlespawner(
10, --particles amount
5, --time
{x=pos.x-0.3, y=pos.y-0, z=pos.z-0.3}, --smoke column starting
{x=pos.x+0.3, y=pos.y+8, z=pos.z+0.3}, --smoke column ending
{x=-0.2, y=0.1, z=-0.2}, --min. particle course
{x=0.2, y=2, z=0.2}, --max. particle course
{x=0,y=0,z=0}, --min. particle deviation
{x=0,y=0,z=0}, --max. particle deviation
0.5, --min. time particle expiration
3, --max. time particle expiration
8, --min. particle size
10, --max. particle size
false, --collision detection
"smoke_particle.png" --textures
)
end,
})

View File

@ -0,0 +1,169 @@
--[[
NEVER-ENDING FLINT and STEEL
Uncraftable, at the moment, and I'm not sure yet how many wanna-be-firebug
griefers are going to litter with fake-fire. Why give them this if it only
makes the mess bigger? ~ LazyJ, 2014_03_13
May add a priv for this later so trusted players can use it.
~ LazyJ, 2014_06_19
minetest.register_craftitem("fake_fire:old_flint_and_steel", {
description = "Never ending flint and steel",
inventory_image = "flint_and_steel.png",
stack_max = 1,
liquids_pointable = false,
on_use = function(itemstack, user, pointed_thing)
n = minetest.env:get_node(pointed_thing)
if pointed_thing.type == "node" then
minetest.env:add_node(pointed_thing.above,
{name="fake_fire:fake_fire"})
minetest.sound_play("",
{gain = 1.0, max_hear_distance = 20,})
end
end
})
--]]
-- RECIPE ITEM - FLINT
minetest.register_craftitem("fake_fire:flint", {
description = "flint",
inventory_image = "flint.png",
stack_max = 99,
liquids_pointable = false,
})
-- FLINT
minetest.register_craft({
type = "shapeless",
output = 'fake_fire:flint',
recipe = {
"default:gravel",
"default:gravel",
}
})
-- FLINT & STEEL
minetest.register_craft({
type = "shapeless",
output = 'fake_fire:flint_and_steel',
recipe = {
"fake_fire:flint",
"default:steel_ingot",
}
})
-- EMBERS
minetest.register_craft({
type = "shapeless",
output = 'fake_fire:embers',
recipe = {
"default:torch",
"group:wood",
}
})
-- CHIMNEY TOPS - SMOKELESS
-- Only the smokeless kind will be craftable and shown in the inventory.
-- The nodes are coded to switch to the smoking chimney tops when punched.
-- ~ LazyJ
-- STONE CHIMNEY TOP
minetest.register_craft({
type = "shapeless",
output = 'fake_fire:smokeless_chimney_top_stone',
recipe = {
"default:torch",
"stairs:slab_stone",
}
})
-- SANDSTONE CHIMNEY TOP
minetest.register_craft({
type = "shapeless",
output = 'fake_fire:smokeless_chimney_top_sandstone',
recipe = {
"default:torch",
"stairs:slab_sandstone",
}
})
-- Crafting Chain - Cobble-to-Gravel-to-Sand and Convert Sands
--[[
Craft one cobble into one gravel.
Craft one gravel into one sand.
Convert-craft sand to desert sand and vice-versa.
This was suggested by klappspaten and it makes sense in both its natural
progression and as a practical way for players to get some of the non-
renewable resources that they need.
Because the gravel-to-sand recipe (from one of our other custom mods)
conflicted with the Fake Fire mod's flint recipe, the Fake Fire mod's
recipe was changed to require 2 gravel.
I've added the cobble-gravel-sand and convert sands recipes as a bonus and
to make-up for the more expensive flint recipe. You can comment-out these
recipes because they aren't *required* by this fork of Fake Fire, but they
*are* handy recipes to have.
~ LazyJ
--]]
-- Cobble to Gravel
minetest.register_craft({
output = 'default:gravel',
recipe = {
{'default:cobble'},
}
})
-- Gravel to Sand
minetest.register_craft({
output = 'default:sand',
recipe = {
{'default:gravel'},
}
})
-- Desert Sand to Sand
minetest.register_craft({
output = 'default:sand',
recipe = {
{'default:desert_sand'},
}
})
-- Sand to Desert Sand
minetest.register_craft({
output = 'default:desert_sand',
recipe = {
{'default:sand'},
}
})

View File

@ -0,0 +1,455 @@
-- FLAME TYPES
-- SMOKEY FIRE (TRIGGERS SMOKE ABM)
minetest.register_node("fake_fire:fake_fire", {
description = "Smokey, Fake Fire",
tiles = {
{name="fake_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
is_ground_content = true,
inventory_image = 'fake_fire.png',
wield_image = {
{name="fake_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
drawtype = "plantlike",
-- Waving wasn't an option when this mod was written. ~ LazyJ, 2014_03_13
waving = 1,
light_source = 14,
-- Adding sunlight_propagtes and leaving comments as a future reference.
-- If true, sunlight will go infinitely through this (no shadow is cast).
-- Because fire produces light it should be "true" so fire *doesn't* have
-- a shadow.
sunlight_propagates = true,
-- damage_per_second = 2*0.5, -- It's *fake* fire. PvP on our server has
-- been disabled for a reason. I don't want griefers lighting players on
-- fire or trapping them in blazes. ~ LazyJ, 2014_0_13
--groups = {dig_immediate=3,attached_node=1},
groups = {
oddly_breakable_by_hand=3, dig_immediate=2, attached_node=1,
not_in_creative_inventory=1
},
paramtype = "light",
walkable = false,
drop = "", -- So fire won't return to the inventory. ~ LazyJ
sounds = minetest.sound_play("fire_small", {pos=cp, loop=true}),
on_punch = function (pos,node,puncher)
-- A max_hear_distance of 20 may freak some players out by the "hiss"
-- so I reduced it to 5.
minetest.sound_play("fire_extinguish", {pos = pos, gain = 1.0,
max_hear_distance = 5,})
-- This swaps the smoky version with the smokeless version. ~ LazyJ
minetest.set_node(pos, {name = "fake_fire:smokeless_fire"})
end
})
-- SMOKELESS FIRE (DOES NOT TRIGGER SMOKE ABM)
minetest.register_node("fake_fire:smokeless_fire", {
description = "Smokeless, Fake Fire",
tiles = {
{name="fake_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
is_ground_content = true,
inventory_image = 'fake_fire.png',
wield_image = {
{name="fake_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
drawtype = "plantlike",
-- Waving wasn't an option when this mod was written. ~ LazyJ, 2014_03_13
waving = 1,
light_source = 14,
-- Adding sunlight_propagtes and leaving comments as a future reference.
-- If true, sunlight will go infinitely through this (no shadow is cast).
-- Because fire produces light it should be "true" so fire *doesn't* have
-- a shadow.
sunlight_propagates = true,
-- damage_per_second = 2*0.5, -- It's *fake* fire. PvP on our server has
-- been disabled for a reason. I don't want griefers lighting players on
-- fire or trapping them in blazes. ~ LazyJ, 2014_0_13
--groups = {dig_immediate=3,attached_node=1},
groups = {
oddly_breakable_by_hand=3, dig_immediate=2, attached_node=1,
not_in_creative_inventory=1
},
paramtype = "light",
walkable = false,
drop = "", -- So fire won't return to the inventory. ~ LazyJ
sounds = minetest.sound_play("fire_small", {pos=cp, loop=true}),
on_punch = function (pos,node,puncher)
-- A max_hear_distance of 20 may freak some players out by the "hiss"
-- so I reduced it to 5.
minetest.sound_play("fire_extinguish", {pos = pos, gain = 1.0,
max_hear_distance = 5,})
-- This swaps the smokeless version with the smoky version. ~ LazyJ
minetest.set_node(pos, {name = "fake_fire:fake_fire"})
end
})
-- SMOKEY ICE FIRE (TRIGGERS SMOKE ABM)
minetest.register_node("fake_fire:ice_fire", {
description = "Smoky, Fake, Ice Fire",
tiles = {
{name="ice_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
is_ground_content = true,
inventory_image = 'ice_fire.png',
wield_image = {
{name="ice_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
drawtype = "plantlike",
-- Waving wasn't an option when this mod was written. ~ LazyJ, 2014_03_13
waving = 1,
light_source = 14,
-- Adding sunlight_propagtes and leaving comments as a future reference.
-- If true, sunlight will go infinitely through this (no shadow is cast).
-- Because fire produces light it should be "true" so fire *doesn't* have
-- a shadow.
sunlight_propagates = true,
-- damage_per_second = 2*0.5, -- It's *fake* fire. PvP on our server has
-- been disabled for a reason. I don't want griefers lighting players on
-- fire or trapping them in blazes. ~ LazyJ, 2014_0_13
--groups = {dig_immediate=3,attached_node=1},
groups = {
oddly_breakable_by_hand=3, dig_immediate=2, attached_node=1,
not_in_creative_inventory=1
},
paramtype = "light",
walkable = false,
drop = "", -- So fire won't return to the inventory. ~ LazyJ
sounds = minetest.sound_play("fire_small", {pos=cp, loop=true}),
on_punch = function (pos,node,puncher)
-- A max_hear_distance of 20 may freak some players out by the "hiss"
-- so I reduced it to 5.
minetest.sound_play("fire_extinguish", {pos = pos, gain = 1.0,
max_hear_distance = 5,})
-- This swaps the smoky version with the smokeless version. ~ LazyJ
minetest.set_node(pos, {name = "fake_fire:smokeless_ice_fire"})
end
})
-- SMOKELESS ICE FIRE (DOES NOT TRIGGER SMOKE ABM)
minetest.register_node("fake_fire:smokeless_ice_fire", {
description = "Smokeless, Fake, Ice Fire",
tiles = {
{name="ice_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
is_ground_content = true,
inventory_image = 'ice_fire.png',
wield_image = {
{name="ice_fire_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=1.5}},
},
drawtype = "plantlike",
-- Waving wasn't an option when this mod was written. ~ LazyJ, 2014_03_13
waving = 1,
light_source = 14,
-- Adding sunlight_propagtes and leaving comments as a future reference.
-- If true, sunlight will go infinitely through this (no shadow is cast).
-- Because fire produces light it should be "true" so fire *doesn't* have
-- a shadow.
sunlight_propagates = true,
-- damage_per_second = 2*0.5, -- It's *fake* fire. PvP on our server has
-- been disabled for a reason. I don't want griefers lighting players on
-- fire or trapping them in blazes. ~ LazyJ, 2014_0_13
--groups = {dig_immediate=3,attached_node=1},
groups = {
oddly_breakable_by_hand=3, dig_immediate=2, attached_node=1,
not_in_creative_inventory=1
},
paramtype = "light",
walkable = false,
drop = "", -- So fire won't return to the inventory. ~ LazyJ
sounds = minetest.sound_play("fire_small", {pos=cp, loop=true}),
on_punch = function (pos,node,puncher)
-- A max_hear_distance of 20 may freak some players out by the "hiss"
-- so I reduced it to 5.
minetest.sound_play("fire_extinguish", {pos = pos, gain = 1.0,
max_hear_distance = 5,})
-- This swaps the smokeless version with the smoky version. ~ LazyJ
minetest.set_node(pos, {name = "fake_fire:ice_fire"})
end
})
-- 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)
-- This next section took me a lot of keyboard bashing to figure out.
-- The lua documentation and examples for Minetest are terrible.
-- ~ LazyJ, 2014_06_23
local snow_ice_list = {"snow", "ice",}
for _, which_one_is_it in pairs(snow_ice_list) do
local snow_ice = which_one_is_it
if
-- A *node*, not a player or sprite. ~ LazyJ
pointed_thing.type == "node"
--[[
These next two "and nots" tell Minetest not to put the
red flame on snow and ice stuff. This "string" bit was
the workable solution that took many hours, over
several days, to finally come around to. It's a search
for any node name that contains whatever is between the
double-quotes, ie. "snow" or "ice". I had been trying
to identify the nodes by their group properties and I
couldn't figure out how to do it. The clue for the
"string"came from Blockmen's "Landscape" mod.
Another quirk is that the "string" doesn't work well
with variable lists (see "snow_ice_list") when using
"and not". Ice-fire would light on snow but when I
clicked on ice, the regular flame appeared. I couldn't
understand what was happening until I mentally changed
the wording "and not" to "is not" and spoke out-loud
each thing that line of code was to accomplish:
"Is not snow, then make fake-fire."
"Is not ice, then make fake-fire."
That's when I caught the problem.
Ice *is not* snow, so Minetest was correctly following
the instruction, "Is not snow, then make fake-fire."
and that is why fake-fire appeared instead of ice-fire
when I clicked on ice.
~ LazyJ
--]]
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"
then
minetest.set_node(pointed_thing.above,
{name="fake_fire:smokeless_fire"})
elseif
pointed_thing.type == "node"
and
-- Split this "string" across several lines because I ran out
-- of room while trying to adhere to the 80-column wide rule
-- of coding style.
string.find(
minetest.get_node(pointed_thing.under).name,
snow_ice
)
and
minetest.get_node(pointed_thing.above).name == "air"
then
minetest.set_node(pointed_thing.above,
{name="fake_fire:smokeless_ice_fire"})
end -- Line 210, if
end -- Line 207, for/do
minetest.sound_play("",
{gain = 1.0, max_hear_distance = 2,})
itemstack:add_wear(65535/65)
return itemstack
end
}) -- Closes the flint and steel tool registration
--[[
SOME LESSONS LEARNED (and keeping this because I'll forget)
flint_and_steel is registered as a tool. Tools do not materialize something
like placing a block (on_construct) makes that block appear. Tools are
*used* so "on_use" works but not "on_construct".
on_rightclick is meant for the code of the thing being clicked on, not the
code of the thing doing the clicking.
~ LazyJ
--]]
-- ANIMATED, RISING, DISPAPPEARING SMOKE
--[[
These next two sections of code are a real bonus that I figured out how
to pull-off. ;)
The first section creates animated smoke. Trying to figure out how to make
the animation appear to go upward was a headache.
The second section places the animated smoke *only* above the fake-fire
*if* there is nothing but air straight above the fake-fire. I also made
the smoke skip a space so it looks more like puffs of smoke and made it
stretch high enough to be used in chimneys. For large builds, a second
fake-fire will have to be hidden close to the top of the chimney so the
smoke will be visible. The smoke also emmits a low-level light.
Yup, I'm proud of this little addition I've made to Semmett9's mod. :D
~ LazyJ, 2014_03_15
--]]
-- 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,
-- Adding sunlight_propagtes and leaving comments as a future reference.
-- If true, sunlight will go infinitely through this (no shadow is cast).
-- Because embers produce some light it should be somewhat "true" but this
-- is an area where Minetest lacks in subtlety so I'm opting for 100% that
-- embers *don't* have a shadow.
sunlight_propagates = true,
-- It's almost soft, brittle charcoal. ~ LazyJ
groups = {choppy=3, crumbly=3, oddly_breakable_by_hand=3},
paramtype = "light",
-- You never know when a creative builder may use the screwdriver or
-- position to create a subtle effect that makes their creation just
-- that little bit nicer looking. ~ Lazyj
paramtype2 = "facedir",
walkable = true,
sounds = minetest.sound_play("fire_small", {pos=cp, loop=true}),
})
-- CHIMNEY TOPS
-- Stone (cool tone) to go with cool colors.
-- Sandstone (warm tone) to go with warm colors.
-- 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)
-- This swaps the smokeless version with the smoky version when punched.
-- ~ LazyJ
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)
-- This swaps the smokeless version with the smoky version when punched.
-- ~ LazyJ
minetest.set_node(pos,
{name = "fake_fire:smokeless_chimney_top_sandstone"})
end
})
-- SMOKELESS CHIMNEY TOPS
-- Some players may want a chimney top *without* smoke. This is the node
-- that will be craftable. To get the smoking variety, simply punch the
-- node. Same approach is used with the smoking and non-smoking flames.
-- ~ LazyJ
-- 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)
-- This swaps the smokeless version with the smoky version when punched.
-- ~ LazyJ
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)
-- This swaps the smokeless version with the smoky version when punched.
-- ~ LazyJ
minetest.set_node(pos, {name = "fake_fire:chimney_top_sandstone"})
end
})