summaryrefslogtreecommitdiff
path: root/fake_fire
diff options
context:
space:
mode:
Diffstat (limited to 'fake_fire')
-rw-r--r--fake_fire/depends.txt1
-rw-r--r--fake_fire/init.lua235
-rw-r--r--fake_fire/models/fancy_fire.obj133
-rw-r--r--fake_fire/sounds/fire_extinguish.oggbin0 -> 8401 bytes
-rw-r--r--fake_fire/sounds/fire_small.oggbin0 -> 43539 bytes
-rw-r--r--fake_fire/textures/chimney_top.pngbin0 -> 113 bytes
-rw-r--r--fake_fire/textures/embers_animated.pngbin0 -> 844 bytes
-rw-r--r--fake_fire/textures/fake_fire_animated.pngbin0 -> 4671 bytes
-rw-r--r--fake_fire/textures/fake_fire_embers.pngbin0 -> 214 bytes
-rw-r--r--fake_fire/textures/fake_fire_inv.pngbin0 -> 640 bytes
-rw-r--r--fake_fire/textures/fake_fire_logs.pngbin0 -> 2037 bytes
-rw-r--r--fake_fire/textures/fancy_fire_inv.pngbin0 -> 526 bytes
-rw-r--r--fake_fire/textures/flint_and_steel.pngbin0 -> 373 bytes
-rw-r--r--fake_fire/textures/ice_fire_animated.pngbin0 -> 3117 bytes
-rw-r--r--fake_fire/textures/ice_fire_inv.pngbin0 -> 409 bytes
-rw-r--r--fake_fire/textures/smoke_particle.pngbin0 -> 358 bytes
16 files changed, 369 insertions, 0 deletions
diff --git a/fake_fire/depends.txt b/fake_fire/depends.txt
new file mode 100644
index 0000000..562cf63
--- /dev/null
+++ b/fake_fire/depends.txt
@@ -0,0 +1 @@
+default
diff --git a/fake_fire/init.lua b/fake_fire/init.lua
new file mode 100644
index 0000000..08760de
--- /dev/null
+++ b/fake_fire/init.lua
@@ -0,0 +1,235 @@
+screwdriver = screwdriver or {}
+
+local function start_smoke(pos, node, clicker, chimney)
+ local this_spawner_meta = minetest.get_meta(pos)
+ local id = this_spawner_meta:get_int("smoky")
+ local s_handle = this_spawner_meta:get_int("sound")
+ local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
+
+ if id ~= 0 then
+ if s_handle then
+ minetest.after(0, function(s_handle)
+ minetest.sound_stop(s_handle)
+ end, s_handle)
+ end
+ minetest.delete_particlespawner(id)
+ this_spawner_meta:set_int("smoky", nil)
+ this_spawner_meta:set_int("sound", nil)
+ return
+ end
+
+ if above == "air" and (not id or id == 0) then
+ id = minetest.add_particlespawner({
+ amount = 4, time = 0, collisiondetection = true,
+ minpos = {x=pos.x-0.25, y=pos.y+0.4, z=pos.z-0.25},
+ maxpos = {x=pos.x+0.25, y=pos.y+5, z=pos.z+0.25},
+ minvel = {x=-0.2, y=0.3, z=-0.2}, maxvel = {x=0.2, y=1, z=0.2},
+ minacc = {x=0,y=0,z=0}, maxacc = {x=0,y=0.5,z=0},
+ minexptime = 1, maxexptime = 3,
+ minsize = 4, maxsize = 8,
+ texture = "smoke_particle.png",
+ })
+ if chimney == 1 then
+ s_handle = nil
+ this_spawner_meta:set_int("smoky", id)
+ this_spawner_meta:set_int("sound", nil)
+ else
+ s_handle = minetest.sound_play("fire_small", {
+ pos = pos,
+ max_hear_distance = 5,
+ loop = true
+ })
+ this_spawner_meta:set_int("smoky", id)
+ this_spawner_meta:set_int("sound", s_handle)
+ end
+ return end
+end
+
+local function stop_smoke(pos)
+ local this_spawner_meta = minetest.get_meta(pos)
+ local id = this_spawner_meta:get_int("smoky")
+ local s_handle = this_spawner_meta:get_int("sound")
+
+ if id ~= 0 then
+ minetest.delete_particlespawner(id)
+ end
+
+ if s_handle then
+ minetest.after(0, function(s_handle)
+ minetest.sound_stop(s_handle)
+ end, s_handle)
+ end
+
+ this_spawner_meta:set_int("smoky", nil)
+ this_spawner_meta:set_int("sound", nil)
+end
+
+-- FLAME TYPES
+local flame_types = {"fake", "ice"}
+
+for _, f in ipairs(flame_types) do
+ minetest.register_node("fake_fire:"..f.."_fire", {
+ inventory_image = f.."_fire_inv.png",
+ description = f.." fire",
+ drawtype = "plantlike",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ groups = {dig_immediate=3, not_in_creative_inventory=1},
+ sunlight_propagates = true,
+ buildable_to = true,
+ walkable = false,
+ light_source = 14,
+ waving = 1,
+ tiles = {
+ {name=f.."_fire_animated.png", animation={type="vertical_frames",
+ aspect_w=16, aspect_h=16, length=1.5}},
+ },
+ on_rightclick = function (pos, node, clicker)
+ start_smoke(pos, node, clicker)
+ end,
+ on_destruct = function (pos)
+ stop_smoke(pos)
+ minetest.sound_play("fire_extinguish", {
+ pos = pos, max_hear_distance = 5
+ })
+ end,
+ drop = ""
+ })
+end
+
+minetest.register_node("fake_fire:fancy_fire", {
+ inventory_image = "fancy_fire_inv.png",
+ description = "Fancy Fire",
+ drawtype = "mesh",
+ mesh = "fancy_fire.obj",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ groups = {dig_immediate=3},
+ sunlight_propagates = true,
+ light_source = 14,
+ walkable = false,
+ damage_per_second = 4,
+ on_rotate = screwdriver.rotate_simple,
+ tiles = {
+ {name="fake_fire_animated.png",
+ animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='fake_fire_logs.png'}},
+ on_rightclick = function (pos, node, clicker)
+ start_smoke(pos, node, clicker)
+ end,
+ on_destruct = function (pos)
+ stop_smoke(pos)
+ minetest.sound_play("fire_extinguish", {
+ pos = pos, max_hear_distance = 5
+ })
+ end,
+ drop = {
+ max_items = 3,
+ items = {
+ {
+ items = { "default:torch", "default:torch", "building_blocks:sticks" },
+ rarity = 1,
+ }
+ }
+ }
+ })
+
+-- 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}},
+ },
+ light_source = 9,
+ groups = {crumbly=3},
+ paramtype = "light",
+ sounds = default.node_sound_dirt_defaults(),
+})
+
+-- CHIMNEYS
+local materials = {"stone", "sandstone"}
+
+for _, m in ipairs(materials) do
+ minetest.register_node("fake_fire:chimney_top_"..m, {
+ description = "Chimney Top - "..m,
+ tiles = {"default_"..m..".png^chimney_top.png", "default_"..m..".png"},
+ groups = {snappy=3},
+ 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_rightclick = function (pos, node, clicker)
+ local chimney = 1
+ start_smoke(pos, node, clicker, chimney)
+ end,
+ on_destruct = function (pos)
+ stop_smoke(pos)
+ end
+ })
+
+ minetest.register_craft({
+ type = "shapeless",
+ output = 'fake_fire:chimney_top_'..m,
+ recipe = {"default:torch", "stairs:slab_"..m}
+ })
+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)
+ if pointed_thing.type == "node" and minetest.get_node(pointed_thing.above).name == "air" then
+ if not minetest.is_protected(pointed_thing.above, user:get_player_name()) then
+ if string.find(minetest.get_node(pointed_thing.under).name, "ice") then
+ minetest.set_node(pointed_thing.above, {name="fake_fire:ice_fire"})
+ else
+ minetest.set_node(pointed_thing.above, {name="fake_fire:fake_fire"})
+ end
+ else
+ minetest.chat_send_player(user:get_player_name(), "This area is protected!")
+ end
+ else
+ return
+ end
+
+ itemstack:add_wear(65535/65)
+ return itemstack
+ end
+})
+
+-- CRAFTS
+minetest.register_craft({
+ type = "shapeless",
+ output = 'fake_fire:flint_and_steel',
+ recipe = {"default:obsidian_shard", "default:steel_ingot"}
+})
+
+minetest.register_craft({
+ type = "shapeless",
+ output = 'fake_fire:embers',
+ recipe = {"default:torch", "group:wood", "default:torch"}
+})
+
+minetest.register_craft({
+ type = "shapeless",
+ output = 'fake_fire:fancy_fire',
+ recipe = {"default:torch", "building_blocks:sticks", "default:torch" }
+})
+
+-- ALIASES
+minetest.register_alias("fake_fire:smokeless_fire", "fake_fire:fake_fire")
+minetest.register_alias("fake_fire:smokeless_ice_fire", "fake_fire:ice_fire")
+minetest.register_alias("fake_fire:smokeless_chimney_top_stone", "fake_fire:chimney_top_stone")
+minetest.register_alias("fake_fire:smokeless_chimney_top_sandstone", "fake_fire:chimney_top_sandstone")
+minetest.register_alias("fake_fire:flint", "fake_fire:flint_and_steel")
diff --git a/fake_fire/models/fancy_fire.obj b/fake_fire/models/fancy_fire.obj
new file mode 100644
index 0000000..ad81f6e
--- /dev/null
+++ b/fake_fire/models/fancy_fire.obj
@@ -0,0 +1,133 @@
+# Blender v2.72 (sub 2) OBJ File: 'campfire.blend'
+# www.blender.org
+v 0.353153 -0.337287 0.000000
+v -0.366847 -0.337287 0.000000
+v -0.366847 0.382713 -0.000000
+v -0.186847 -0.337287 0.311769
+v 0.173153 -0.337287 -0.311769
+v -0.186846 0.382713 0.311769
+v 0.173154 0.382713 -0.311769
+v -0.186846 -0.337287 -0.311769
+v 0.173154 -0.337287 0.311769
+v -0.186846 0.382713 -0.311769
+v 0.173153 0.382713 0.311769
+v 0.353153 0.382713 0.000000
+vt 0.000000 0.000000
+vt 1.000000 0.000000
+vt 1.000000 1.000000
+vt 0.000000 1.000000
+g Flames.001_Cube.004_Fire
+s off
+f 4/1 5/2 7/3 6/4
+f 8/1 9/2 11/3 10/4
+f 1/1 2/2 3/3 12/4
+v 0.151217 -0.347540 0.439253
+v 0.151217 -0.207593 0.411057
+v 0.008458 -0.207593 0.411057
+v 0.008458 -0.347540 0.439253
+v 0.151217 -0.526542 -0.449208
+v 0.151217 -0.386595 -0.477403
+v 0.008458 -0.386595 -0.477403
+v 0.008458 -0.526542 -0.449208
+v -0.419949 -0.512482 0.485423
+v -0.419949 -0.369723 0.485423
+v -0.444739 -0.369723 0.344833
+v -0.444739 -0.512482 0.344833
+v 0.472595 -0.512482 0.328044
+v 0.472595 -0.369723 0.328044
+v 0.447805 -0.369723 0.187453
+v 0.447805 -0.512482 0.187453
+v 0.033402 -0.347540 0.433815
+v 0.025205 -0.207593 0.406838
+v -0.111388 -0.207593 0.448342
+v -0.103191 -0.347540 0.475320
+v -0.224900 -0.526542 -0.416268
+v -0.233097 -0.386595 -0.443246
+v -0.369690 -0.386595 -0.401741
+v -0.361493 -0.526542 -0.374763
+v 0.254175 -0.345963 0.293196
+v 0.254175 -0.277187 0.265611
+v 0.181422 -0.282425 0.252550
+v 0.181422 -0.351201 0.280135
+v 0.343511 -0.517901 -0.135488
+v 0.343511 -0.449125 -0.163073
+v 0.270757 -0.454364 -0.176133
+v 0.270757 -0.523140 -0.148548
+v -0.418506 -0.513914 0.100698
+v -0.418472 -0.439812 0.100704
+v -0.392481 -0.439819 0.031309
+v -0.392514 -0.513921 0.031304
+v 0.022046 -0.514125 0.265705
+v 0.022080 -0.440022 0.265710
+v 0.048071 -0.440029 0.196316
+v 0.048038 -0.514131 0.196310
+v -0.249910 -0.307656 -0.062181
+v -0.249882 -0.234638 -0.074807
+v -0.278776 -0.246254 -0.142048
+v -0.278804 -0.319272 -0.129422
+v 0.183295 -0.339072 -0.242901
+v 0.183323 -0.266053 -0.255527
+v 0.154429 -0.277669 -0.322768
+v 0.154401 -0.350687 -0.310143
+vt 0.418293 0.016195
+vt 0.418293 0.216092
+vt 0.218396 0.216092
+vt 0.218396 0.016195
+vt 0.002609 0.212891
+vt 0.002609 0.012994
+vt 0.989254 0.012994
+vt 0.989254 0.212891
+vt 0.010050 0.219323
+vt 0.010050 0.019426
+vt 0.996695 0.019426
+vt 0.996695 0.219323
+vt 0.618448 0.016195
+vt 0.618448 0.216092
+vt 0.418551 0.216092
+vt 0.418551 0.016195
+vt 0.010050 0.228781
+vt 0.010050 0.028884
+vt 0.996695 0.028884
+vt 0.996695 0.228781
+vt 0.005089 0.207467
+vt 0.005089 0.007570
+vt 0.991734 0.007570
+vt 0.991734 0.207467
+g Campfire_Cube.003_Logs-Stone
+s off
+f 20/5 19/6 18/7 17/8
+f 14/9 13/10 17/11 18/12
+f 15/13 14/14 18/15 19/16
+f 13/17 14/18 15/19 16/20
+f 13/21 16/22 20/23 17/24
+f 16/25 15/26 19/27 20/28
+f 28/5 27/6 26/7 25/8
+f 22/9 21/10 25/11 26/12
+f 23/13 22/14 26/15 27/16
+f 21/17 22/18 23/19 24/20
+f 21/21 24/22 28/23 25/24
+f 24/25 23/26 27/27 28/28
+f 36/5 35/6 34/7 33/8
+f 30/9 29/10 33/11 34/12
+f 31/13 30/14 34/15 35/16
+f 29/17 30/18 31/19 32/20
+f 29/21 32/22 36/23 33/24
+f 32/25 31/26 35/27 36/28
+f 44/5 43/6 42/7 41/8
+f 38/9 37/10 41/11 42/12
+f 39/13 38/14 42/15 43/16
+f 37/17 38/18 39/19 40/20
+f 37/21 40/22 44/23 41/24
+f 40/25 39/26 43/27 44/28
+f 52/5 51/6 50/7 49/8
+f 46/9 45/10 49/11 50/12
+f 47/13 46/14 50/15 51/16
+f 45/17 46/18 47/19 48/20
+f 45/21 48/22 52/23 49/24
+f 48/25 47/26 51/27 52/28
+f 60/5 59/6 58/7 57/8
+f 54/9 53/10 57/11 58/12
+f 55/13 54/14 58/15 59/16
+f 53/17 54/18 55/19 56/20
+f 53/21 56/22 60/23 57/24
+f 56/25 55/26 59/27 60/28
diff --git a/fake_fire/sounds/fire_extinguish.ogg b/fake_fire/sounds/fire_extinguish.ogg
new file mode 100644
index 0000000..a53525d
--- /dev/null
+++ b/fake_fire/sounds/fire_extinguish.ogg
Binary files differ
diff --git a/fake_fire/sounds/fire_small.ogg b/fake_fire/sounds/fire_small.ogg
new file mode 100644
index 0000000..bf51b17
--- /dev/null
+++ b/fake_fire/sounds/fire_small.ogg
Binary files differ
diff --git a/fake_fire/textures/chimney_top.png b/fake_fire/textures/chimney_top.png
new file mode 100644
index 0000000..a2e16cb
--- /dev/null
+++ b/fake_fire/textures/chimney_top.png
Binary files differ
diff --git a/fake_fire/textures/embers_animated.png b/fake_fire/textures/embers_animated.png
new file mode 100644
index 0000000..3b78b72
--- /dev/null
+++ b/fake_fire/textures/embers_animated.png
Binary files differ
diff --git a/fake_fire/textures/fake_fire_animated.png b/fake_fire/textures/fake_fire_animated.png
new file mode 100644
index 0000000..f4cd8db
--- /dev/null
+++ b/fake_fire/textures/fake_fire_animated.png
Binary files differ
diff --git a/fake_fire/textures/fake_fire_embers.png b/fake_fire/textures/fake_fire_embers.png
new file mode 100644
index 0000000..3b5dea0
--- /dev/null
+++ b/fake_fire/textures/fake_fire_embers.png
Binary files differ
diff --git a/fake_fire/textures/fake_fire_inv.png b/fake_fire/textures/fake_fire_inv.png
new file mode 100644
index 0000000..989963c
--- /dev/null
+++ b/fake_fire/textures/fake_fire_inv.png
Binary files differ
diff --git a/fake_fire/textures/fake_fire_logs.png b/fake_fire/textures/fake_fire_logs.png
new file mode 100644
index 0000000..e7a16ba
--- /dev/null
+++ b/fake_fire/textures/fake_fire_logs.png
Binary files differ
diff --git a/fake_fire/textures/fancy_fire_inv.png b/fake_fire/textures/fancy_fire_inv.png
new file mode 100644
index 0000000..8747d53
--- /dev/null
+++ b/fake_fire/textures/fancy_fire_inv.png
Binary files differ
diff --git a/fake_fire/textures/flint_and_steel.png b/fake_fire/textures/flint_and_steel.png
new file mode 100644
index 0000000..44c692e
--- /dev/null
+++ b/fake_fire/textures/flint_and_steel.png
Binary files differ
diff --git a/fake_fire/textures/ice_fire_animated.png b/fake_fire/textures/ice_fire_animated.png
new file mode 100644
index 0000000..538700a
--- /dev/null
+++ b/fake_fire/textures/ice_fire_animated.png
Binary files differ
diff --git a/fake_fire/textures/ice_fire_inv.png b/fake_fire/textures/ice_fire_inv.png
new file mode 100644
index 0000000..878936e
--- /dev/null
+++ b/fake_fire/textures/ice_fire_inv.png
Binary files differ
diff --git a/fake_fire/textures/smoke_particle.png b/fake_fire/textures/smoke_particle.png
new file mode 100644
index 0000000..115d12b
--- /dev/null
+++ b/fake_fire/textures/smoke_particle.png
Binary files differ