added: sound file, new textures, changed model, config_file.

master
Pavel Litvinoff 2017-03-13 09:21:32 +02:00
parent 41c99e7762
commit ef990ee389
9 changed files with 222 additions and 239 deletions

3
config.lua Normal file
View File

@ -0,0 +1,3 @@
-- config.lua
campfire_limit = 1 --Values: 0 - no limit, 1 - limit

213
init.lua
View File

@ -1,75 +1,78 @@
-- VARIABLES
new_campfire = {}
-- Load support for intllib.
-- Load support for intllib. and config
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
dofile(MP.."/config.lua")
-- FUNCTIONS
local function fire_particles_on(pos) -- 3 layers of fire
local meta = minetest.get_meta(pos)
local id = minetest.add_particlespawner({ -- 1 layer big particles fire
amount = 26,
time = 3,
minpos = {x = pos.x - 0.2, y = pos.y - 0.4, z = pos.z - 0.2},
maxpos = {x = pos.x + 0.2, y = pos.y - 0.1, z = pos.z + 0.2},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 0.5, z= 0},
minexptime = 0.3,
maxexptime = 0.6,
minsize = 2,
maxsize = 5,
collisiondetection = false,
vertical = true,
texture = "anim_cfire.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.7,},
local meta = minetest.get_meta(pos)
local id = minetest.add_particlespawner({ -- 1 layer big particles fire
amount = 26,
time = 3.3,
minpos = {x = pos.x - 0.2, y = pos.y - 0.4, z = pos.z - 0.2},
maxpos = {x = pos.x + 0.2, y = pos.y - 0.1, z = pos.z + 0.2},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 0.5, z= 0},
minexptime = 0.3,
maxexptime = 0.6,
minsize = 2,
maxsize = 5,
collisiondetection = false,
vertical = true,
texture = "new_campfire_anim_fire.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.7,},
-- playername = "singleplayer"
})
meta:set_int("layer_1", id)
})
meta:set_int("layer_1", id)
local id = minetest.add_particlespawner({ -- 2 layer smol particles fire
amount = 3,
time = 3,
minpos = {x = pos.x - 0.1, y = pos.y, z = pos.z - 0.1},
maxpos = {x = pos.x + 0.1, y = pos.y + 0.4, z = pos.z + 0.1},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 1, z= 0},
minexptime = 0.3,
maxexptime = 0.5,
minsize = 0.5,
maxsize = 0.7,
collisiondetection = false,
vertical = true,
texture = "anim_cfire.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.6,},
-- playername = "singleplayer" -- показывать только определенному игроку.
})
meta:set_int("layer_2", id)
local id = minetest.add_particlespawner({ -- 2 layer smol particles fire
amount = 3,
time = 3.3,
minpos = {x = pos.x - 0.1, y = pos.y, z = pos.z - 0.1},
maxpos = {x = pos.x + 0.1, y = pos.y + 0.4, z = pos.z + 0.1},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 1, z= 0},
minexptime = 0.3,
maxexptime = 0.5,
minsize = 0.5,
maxsize = 0.7,
collisiondetection = false,
vertical = true,
texture = "new_campfire_anim_fire.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.6,},
-- playername = "singleplayer" -- показывать только определенному игроку.
})
meta:set_int("layer_2", id)
local id = minetest.add_particlespawner({ --3 layer smoke
amount = 6,
time = 3,
minpos = {x = pos.x - 0.1, y = pos.y - 0.2, z = pos.z - 0.1},
maxpos = {x = pos.x + 0.2, y = pos.y + 0.4, z = pos.z + 0.2},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 1, z= 0},
minexptime = 0.6,
maxexptime = 0.6,
minsize = 1,
maxsize = 4,
collisiondetection = true,
vertical = true,
texture = "anim_smoke.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.7,},
-- playername = "singleplayer"
})
meta:set_int("layer_3", id)
local id = minetest.add_particlespawner({ --3 layer smoke
amount = 6,
time = 3.3,
minpos = {x = pos.x - 0.1, y = pos.y - 0.2, z = pos.z - 0.1},
maxpos = {x = pos.x + 0.2, y = pos.y + 0.4, z = pos.z + 0.2},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 1, z= 0},
minexptime = 0.6,
maxexptime = 0.6,
minsize = 1,
maxsize = 4,
collisiondetection = true,
vertical = true,
texture = "new_campfire_anim_smoke.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.7,},
-- playername = "singleplayer"
})
-- print (dump(id))
meta:set_int("layer_3", id)
end
local function fire_particles_off(pos)
@ -88,10 +91,9 @@ minetest.register_node('new_campfire:campfire', {
description = S("Campfire"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
{name='invisible.png'}, {name='[combine:16x16:0,0=default_cobble.png:0,8=default_wood.png'}},
inventory_image = "campfire.png",
wield_image = "[combine:16x16:0,0=fire_basic_flame.png:0,12=default_cobble.png",
tiles = {{name='[combine:16x16:0,0=default_cobble.png:0,8=default_wood.png'}},
inventory_image = "campfire.png",
wield_image = "[combine:16x16:0,0=fire_basic_flame.png:0,12=default_cobble.png",
walkable = false,
buildable_to = false,
sunlight_propagates = true,
@ -109,25 +111,22 @@ minetest.register_node('new_campfire:campfire', {
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
if itemstack:get_name() == "fire:flint_and_steel" then
minetest.sound_play(
"fire_flint_and_steel",
{pos = pos, gain = 0.5, max_hear_distance = 8}
)
minetest.set_node(pos, {name = 'new_campfire:campfire_active'})
minetest.add_particle({
pos = {x = pos.x, y = pos.y, z = pos.z},
velocity = {x=0, y=0.1, z=0},
acceleration = {x=0, y=0, z=0},
expirationtime = 2,
size = 4,
collisiondetection = true,
vertical = true,
texture = "anim_smoke.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 2.5,},
-- playername = "singleplayer"
})
end
if itemstack:get_name() == "fire:flint_and_steel" then
minetest.sound_play("fire_flint_and_steel",{pos = pos, gain = 0.5, max_hear_distance = 8})
minetest.set_node(pos, {name = 'new_campfire:campfire_active'})
local id = minetest.add_particle({
pos = {x = pos.x, y = pos.y, z = pos.z},
velocity = {x=0, y=0.1, z=0},
acceleration = {x=0, y=0, z=0},
expirationtime = 2,
size = 4,
collisiondetection = true,
vertical = true,
texture = "new_campfire_anim_smoke.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 2.5,},
-- playername = "singleplayer"
})
end
end,
})
@ -135,39 +134,46 @@ minetest.register_node('new_campfire:campfire_active', {
description = S("Active campfire"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
{name='invisible.png'}, {name='[combine:16x16:0,0=default_cobble.png:0,8=default_wood.png'}},
inventory_image = "campfire.png",
wield_image = "[combine:16x16:0,0=fire_basic_flame.png:0,12=default_cobble.png",
tiles = {{name='[combine:16x16:0,0=new_campfire_cobble.png:0,8=nnew_campfire_wood.png'}},
inventory_image = "campfire.png",
wield_image = "[combine:16x16:0,0=fire_basic_flame.png:0,12=default_cobble.png",
walkable = false,
buildable_to = false,
sunlight_propagates = true,
groups = {dig_immediate=3, flammable=0, not_in_creative_inventory=1},
paramtype = 'light',
light_source = 13,
damage_per_second = 3,
drop = "new_campfire:campfire",
sounds = default.node_sound_stone_defaults(),
-- paramtype = 'light',
paramtype = 'none',
light_source = 13,
damage_per_second = 3,
drop = "new_campfire:campfire",
sounds = default.node_sound_stone_defaults(),
selection_box = {
type = 'fixed',
fixed = { -0.48, -0.5, -0.48, 0.48, -0.4, 0.48 },
},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
if itemstack:get_name() == "default:stick" then
print("=================")
print(campfire_limit)
end
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string('infotext', S("Active campfire"));
minetest.get_node_timer(pos):start(2)
meta:set_string('infotext', S("Active campfire").."\n▓▓▓▓▓▓▓▒▒▒ 70% ");
minetest.get_node_timer(pos):start(2)
end,
on_destruct = function(pos, oldnode, oldmetadata, digger)
fire_particles_off(pos)
local meta = minetest.get_meta(pos)
local handle = meta:get_int("handle")
minetest.sound_stop(handle)
fire_particles_off(pos)
local meta = minetest.get_meta(pos)
local handle = meta:get_int("handle")
minetest.sound_stop(handle)
end,
on_timer = function(pos) -- Every 6 seconds play sound fire_small
local meta = minetest.get_meta(pos)
local meta = minetest.get_meta(pos)
local handle = minetest.sound_play("fire_small",{pos=pos, max_hear_distance = 18, loop=false, gain=0.1})
meta:set_int("handle", handle)
minetest.get_node_timer(pos):start(6)
@ -180,7 +186,7 @@ minetest.register_abm({
-- neighbors = {"group:puts_out_fire"},
interval = 3.0, -- Run every 3 seconds
chance = 1, -- Select every 1 in 1 nodes
catch_up = false,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
local fpos, num = minetest.find_nodes_in_area(
{x=pos.x-1, y=pos.y, z=pos.z-1},
@ -189,9 +195,10 @@ minetest.register_abm({
)
if #fpos > 0 then
minetest.set_node(pos, {name = 'new_campfire:campfire'})
minetest.sound_play("fire_extinguish_flame",
{pos = pos, max_hear_distance = 16, gain = 0.15})
minetest.sound_play("fire_extinguish_flame",{pos = pos, max_hear_distance = 16, gain = 0.15})
else
local meta = minetest.get_meta(pos)
-- local id_1 = meta:get_int("layer_1")
fire_particles_on(pos)
end
end

View File

@ -1,30 +1,5 @@
# Blender v2.71 (sub 6) OBJ File: 'campfire.blend'
# Blender v2.72 (sub 0) OBJ File: ''
# www.blender.org
mtllib more_fire_contained_campfire.mtl
o Flames_Cube.001
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_Cube.001_Fire
usemtl 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
o Contained_Fire_Cube.000
v 0.109850 -0.357143 0.305314
v 0.109850 -0.248233 0.283371
v -0.001248 -0.248233 0.283371
@ -362,114 +337,112 @@ vt 0.312500 0.984375
vt 0.312500 0.625000
vt 0.031250 0.625000
vt 0.023438 0.968750
g Contained_Fire_Cube.000_Logs-Stone
usemtl Logs-Stone
s off
f 20/5 17/6 18/7 19/8
f 14/9 18/10 17/11 13/12
f 15/13 19/14 18/15 14/16
f 13/17 16/18 15/19 14/20
f 13/21 17/22 20/23 16/24
f 16/25 20/26 19/15 15/16
f 28/27 25/28 26/29 27/30
f 22/31 26/32 25/33 21/34
f 23/35 27/36 26/37 22/38
f 21/39 24/40 23/41 22/42
f 21/43 25/44 28/45 24/46
f 24/47 28/48 27/49 23/50
f 36/51 33/52 34/53 35/8
f 30/54 34/55 33/56 29/57
f 31/58 35/59 34/60 30/61
f 29/62 32/63 31/64 30/65
f 29/66 33/67 36/68 32/69
f 32/70 36/71 35/72 31/73
f 44/74 41/75 42/76 43/77
f 38/54 42/55 41/56 37/57
f 39/58 43/59 42/60 38/61
f 37/78 40/79 39/80 38/81
f 37/66 41/67 44/68 40/69
f 40/70 44/71 43/72 39/73
f 52/82 49/83 50/84 51/85
f 46/54 50/55 49/56 45/57
f 47/58 51/59 50/60 46/61
f 45/86 48/87 47/88 46/89
f 45/66 49/67 52/68 48/69
f 48/70 52/71 51/72 47/73
f 60/90 57/91 58/92 59/93
f 54/54 58/55 57/56 53/57
f 55/58 59/59 58/60 54/61
f 53/94 56/95 55/96 54/97
f 53/66 57/67 60/68 56/69
f 56/70 60/71 59/72 55/73
f 65/98 61/99 62/100 66/101
f 66/102 62/103 63/104 67/105
f 67/106 63/107 64/108 68/109
f 68/110 64/111 61/112 65/113
f 61/114 64/115 63/116 62/117
f 68/118 65/119 66/120 67/121
f 73/122 69/123 70/124 74/125
f 74/126 70/127 71/128 75/129
f 75/130 71/131 72/132 76/133
f 76/134 72/135 69/136 73/137
f 69/138 72/139 71/140 70/141
f 76/142 73/143 74/144 75/145
f 81/122 77/123 78/124 82/125
f 82/146 78/147 79/148 83/149
f 83/150 79/151 80/152 84/153
f 84/134 80/135 77/136 81/137
f 77/138 80/139 79/140 78/141
f 84/154 81/155 82/156 83/157
f 89/122 85/123 86/124 90/125
f 90/158 86/159 87/160 91/161
f 91/162 87/163 88/164 92/165
f 92/134 88/135 85/136 89/137
f 85/138 88/139 87/140 86/141
f 92/166 89/167 90/168 91/169
f 97/122 93/123 94/124 98/125
f 98/170 94/171 95/172 99/173
f 99/174 95/175 96/176 100/177
f 100/134 96/135 93/136 97/137
f 93/138 96/139 95/140 94/141
f 100/178 97/179 98/180 99/125
f 105/122 101/123 102/124 106/125
f 106/181 102/182 103/183 107/184
f 107/185 103/186 104/187 108/188
f 108/134 104/135 101/136 105/137
f 101/138 104/139 103/140 102/141
f 108/178 105/179 106/180 107/125
f 113/122 109/123 110/124 114/125
f 114/189 110/190 111/191 115/192
f 115/193 111/194 112/195 116/196
f 116/134 112/135 109/136 113/137
f 109/138 112/139 111/140 110/141
f 116/178 113/179 114/180 115/125
f 121/122 117/123 118/124 122/125
f 122/189 118/190 119/191 123/192
f 123/197 119/122 120/125 124/180
f 124/134 120/135 117/136 121/137
f 117/138 120/139 119/140 118/141
f 124/178 121/179 122/180 123/125
f 129/122 125/123 126/124 130/125
f 130/189 126/190 127/191 131/192
f 131/197 127/122 128/125 132/180
f 132/134 128/135 125/136 129/137
f 125/138 128/139 127/140 126/141
f 132/178 129/179 130/180 131/125
f 137/122 133/123 134/124 138/125
f 138/189 134/190 135/191 139/192
f 139/197 135/122 136/125 140/180
f 140/134 136/135 133/136 137/137
f 133/138 136/139 135/140 134/141
f 140/178 137/179 138/180 139/125
f 145/122 141/123 142/124 146/125
f 146/189 142/190 143/191 147/192
f 147/197 143/122 144/125 148/180
f 148/134 144/135 141/136 145/137
f 141/138 144/139 143/140 142/141
f 148/178 145/179 146/180 147/125
f 153/122 149/123 150/124 154/125
f 154/189 150/190 151/191 155/192
f 155/197 151/122 152/125 156/180
f 156/134 152/135 149/136 153/137
f 149/138 152/139 151/140 150/141
f 156/178 153/179 154/180 155/125
f 8/1 5/2 6/3 7/4
f 2/5 6/6 5/7 1/8
f 3/9 7/10 6/11 2/12
f 1/13 4/14 3/15 2/16
f 1/17 5/18 8/19 4/20
f 4/21 8/22 7/11 3/12
f 16/23 13/24 14/25 15/26
f 10/27 14/28 13/29 9/30
f 11/31 15/32 14/33 10/34
f 9/35 12/36 11/37 10/38
f 9/39 13/40 16/41 12/42
f 12/43 16/44 15/45 11/46
f 24/47 21/48 22/49 23/4
f 18/50 22/51 21/52 17/53
f 19/54 23/55 22/56 18/57
f 17/58 20/59 19/60 18/61
f 17/62 21/63 24/64 20/65
f 20/66 24/67 23/68 19/69
f 32/70 29/71 30/72 31/73
f 26/50 30/51 29/52 25/53
f 27/54 31/55 30/56 26/57
f 25/74 28/75 27/76 26/77
f 25/62 29/63 32/64 28/65
f 28/66 32/67 31/68 27/69
f 40/78 37/79 38/80 39/81
f 34/50 38/51 37/52 33/53
f 35/54 39/55 38/56 34/57
f 33/82 36/83 35/84 34/85
f 33/62 37/63 40/64 36/65
f 36/66 40/67 39/68 35/69
f 48/86 45/87 46/88 47/89
f 42/50 46/51 45/52 41/53
f 43/54 47/55 46/56 42/57
f 41/90 44/91 43/92 42/93
f 41/62 45/63 48/64 44/65
f 44/66 48/67 47/68 43/69
f 53/94 49/95 50/96 54/97
f 54/98 50/99 51/100 55/101
f 55/102 51/103 52/104 56/105
f 56/106 52/107 49/108 53/109
f 49/110 52/111 51/112 50/113
f 56/114 53/115 54/116 55/117
f 61/118 57/119 58/120 62/121
f 62/122 58/123 59/124 63/125
f 63/126 59/127 60/128 64/129
f 64/130 60/131 57/132 61/133
f 57/134 60/135 59/136 58/137
f 64/138 61/139 62/140 63/141
f 69/118 65/119 66/120 70/121
f 70/142 66/143 67/144 71/145
f 71/146 67/147 68/148 72/149
f 72/130 68/131 65/132 69/133
f 65/134 68/135 67/136 66/137
f 72/150 69/151 70/152 71/153
f 77/118 73/119 74/120 78/121
f 78/154 74/155 75/156 79/157
f 79/158 75/159 76/160 80/161
f 80/130 76/131 73/132 77/133
f 73/134 76/135 75/136 74/137
f 80/162 77/163 78/164 79/165
f 85/118 81/119 82/120 86/121
f 86/166 82/167 83/168 87/169
f 87/170 83/171 84/172 88/173
f 88/130 84/131 81/132 85/133
f 81/134 84/135 83/136 82/137
f 88/174 85/175 86/176 87/121
f 93/118 89/119 90/120 94/121
f 94/177 90/178 91/179 95/180
f 95/181 91/182 92/183 96/184
f 96/130 92/131 89/132 93/133
f 89/134 92/135 91/136 90/137
f 96/174 93/175 94/176 95/121
f 101/118 97/119 98/120 102/121
f 102/185 98/186 99/187 103/188
f 103/189 99/190 100/191 104/192
f 104/130 100/131 97/132 101/133
f 97/134 100/135 99/136 98/137
f 104/174 101/175 102/176 103/121
f 109/118 105/119 106/120 110/121
f 110/185 106/186 107/187 111/188
f 111/193 107/118 108/121 112/176
f 112/130 108/131 105/132 109/133
f 105/134 108/135 107/136 106/137
f 112/174 109/175 110/176 111/121
f 117/118 113/119 114/120 118/121
f 118/185 114/186 115/187 119/188
f 119/193 115/118 116/121 120/176
f 120/130 116/131 113/132 117/133
f 113/134 116/135 115/136 114/137
f 120/174 117/175 118/176 119/121
f 125/118 121/119 122/120 126/121
f 126/185 122/186 123/187 127/188
f 127/193 123/118 124/121 128/176
f 128/130 124/131 121/132 125/133
f 121/134 124/135 123/136 122/137
f 128/174 125/175 126/176 127/121
f 133/118 129/119 130/120 134/121
f 134/185 130/186 131/187 135/188
f 135/193 131/118 132/121 136/176
f 136/130 132/131 129/132 133/133
f 129/134 132/135 131/136 130/137
f 136/174 133/175 134/176 135/121
f 141/118 137/119 138/120 142/121
f 142/185 138/186 139/187 143/188
f 143/193 139/118 140/121 144/176
f 144/130 140/131 137/132 141/133
f 137/134 140/135 139/136 138/137
f 144/174 141/175 142/176 143/121

BIN
sounds/fire_small.ogg Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B