delete campfire mod, switch to my fork of googol's new_campfire

update homedecor
This commit is contained in:
VanessaE 2020-06-03 00:20:29 -04:00
parent f4655c2b0e
commit 3bdcb6c9b3
31 changed files with 3101 additions and 342 deletions

View File

@ -1 +0,0 @@
default

View File

@ -1,180 +0,0 @@
minetest.register_craft({
output = "campfire:campfire",
recipe = {{'', 'default:stick', ''}, {'default:stick', '', 'default:stick'}}
})
minetest.register_node("campfire:campfire", {
description = "Camp Fire",
drawtype = "plantlike",
tiles = {"CampFire_off.png"},
walkable=false,
sunlight_propogates=true,
paramtype="light",
paramtype2 = "facedir",
groups = {oddly_breakable_by_hand=1},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Campfire")
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
})
minetest.register_node("campfire:campfire_active", {
description = "Campfire Active",
drawtype = "plantlike",
tiles = {{name="CampFire.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}},
light_source = 8,
paramtype="light",
walkable=false,
drop = "campfire:campfire",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", default.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace");
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
})
function hacky_swap_node(pos,name)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local meta0 = meta:to_table()
if node.name == name then
return
end
node.name = name
local meta0 = meta:to_table()
minetest.set_node(pos,node)
meta = minetest.get_meta(pos)
meta:from_table(meta0)
end
minetest.register_abm({
nodenames = {"campfire:campfire","campfire:campfire_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
for i, name in ipairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time"
}) do
if meta:get_string(name) == "" then
meta:set_float(name, 0.0)
end
end
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local cooked = nil
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 0.25)
meta:set_float("src_time", meta:get_float("src_time") + 0.25)
if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
-- check if there's room for output in "dst" list
if inv:room_for_item("dst",cooked.item) then
-- Put result in "dst" list
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
srcstack = inv:get_stack("src", 1)
srcstack:take_item()
inv:set_stack("src", 1, srcstack)
else
print("Could not insert '"..cooked.item:to_string().."'")
end
meta:set_string("src_time", 0)
end
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Furnace active: "..percent.."%")
hacky_swap_node(pos,"campfire:campfire_active")
meta:set_string("formspec",
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]")
return
end
local fuel = nil
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
if fuellist then
fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
if fuel.time <= 0 then
meta:set_string("infotext","Put more wood on the fire!")
hacky_swap_node(pos,"campfire:campfire")
meta:set_string("formspec", default.furnace_inactive_formspec)
return
end
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
local stack = inv:get_stack("fuel", 1)
stack:take_item()
inv:set_stack("fuel", 1, stack)
end,
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

View File

@ -83,7 +83,7 @@ gardening \
caverealms_lite \ caverealms_lite \
deezls_mods/extra_stairsplus \ deezls_mods/extra_stairsplus \
blox \ blox \
campfire \ new_campfire \
item_drop" item_drop"
COPY_MODS_LIST="my_mods/dreambuilder_mp_extras \ COPY_MODS_LIST="my_mods/dreambuilder_mp_extras \

View File

@ -3,7 +3,80 @@ local S = homedecor.gettext
screwdriver = screwdriver or {} screwdriver = screwdriver or {}
local function start_smoke(pos, node, clicker, chimney) 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 = 9,
time = 0,
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.7, z= 0},
minexptime = 0.5,
maxexptime = 0.7,
minsize = 2,
maxsize = 5,
collisiondetection = false,
vertical = true,
texture = "fake_fire_particle_anim_fire.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.8,},
})
meta:set_int("layer_1", id)
local id = minetest.add_particlespawner({ -- 2 layer smol particles fire
amount = 1,
time = 0,
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.4,
maxexptime = 0.6,
minsize = 0.5,
maxsize = 0.7,
collisiondetection = false,
vertical = true,
texture = "fake_fire_particle_anim_fire.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.7,},
})
meta:set_int("layer_2", id)
local id = minetest.add_particlespawner({ --3 layer smoke
amount = 1,
time = 0,
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.8,
minsize = 2,
maxsize = 4,
collisiondetection = true,
vertical = true,
texture = "fake_fire_particle_anim_smoke.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.9,},
})
meta:set_int("layer_3", id)
end
local function fire_particles_off(pos)
local meta = minetest.get_meta(pos)
local id_1 = meta:get_int("layer_1");
local id_2 = meta:get_int("layer_2");
local id_3 = meta:get_int("layer_3");
minetest.delete_particlespawner(id_1)
minetest.delete_particlespawner(id_2)
minetest.delete_particlespawner(id_3)
end
local function start_fire_effects(pos, node, clicker, chimney)
local this_spawner_meta = minetest.get_meta(pos) local this_spawner_meta = minetest.get_meta(pos)
local id = this_spawner_meta:get_int("smoky") local id = this_spawner_meta:get_int("smoky")
local s_handle = this_spawner_meta:get_int("sound") local s_handle = this_spawner_meta:get_int("sound")
@ -41,7 +114,7 @@ local function start_smoke(pos, node, clicker, chimney)
max_hear_distance = 5, max_hear_distance = 5,
loop = true loop = true
}) })
this_spawner_meta:set_int("smoky", id) fire_particles_on(pos)
this_spawner_meta:set_int("sound", s_handle) this_spawner_meta:set_int("sound", s_handle)
end end
end end
@ -83,7 +156,7 @@ minetest.register_node("fake_fire:ice_fire", {
aspect_w=16, aspect_h=16, length=1.5}}, aspect_w=16, aspect_h=16, length=1.5}},
}, },
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
start_smoke(pos, node, clicker) start_fire_effects(pos, node, clicker)
return itemstack return itemstack
end, end,
on_destruct = function (pos) on_destruct = function (pos)
@ -97,42 +170,54 @@ minetest.register_node("fake_fire:ice_fire", {
minetest.register_alias("fake_fire:fake_fire", "fire:permanent_flame") minetest.register_alias("fake_fire:fake_fire", "fire:permanent_flame")
local sbox = {
type = 'fixed',
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16},
}
minetest.register_node("fake_fire:fancy_fire", { minetest.register_node("fake_fire:fancy_fire", {
inventory_image = "fancy_fire_inv.png", inventory_image = "fancy_fire_inv.png",
description = S("Fancy Fire"), description = S("Fancy Fire"),
drawtype = "mesh", drawtype = "mesh",
mesh = "fancy_fire.obj", mesh = "fancy_fire.obj",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {dig_immediate=3}, groups = {oddly_breakable_by_hand=3, flammable=0},
sunlight_propagates = true, sunlight_propagates = true,
light_source = 14, light_source = 13,
walkable = false, walkable = false,
damage_per_second = 4, buildable_to = false,
on_rotate = screwdriver.rotate_simple, damage_per_second = 3,
tiles = { selection_box = sbox,
{name="fake_fire_animated.png", tiles = {
animation={type='vertical_frames', aspect_w=16, aspect_h=16, length=1}}, {name='fake_fire_logs.png'}}, "basic_materials_concrete_block.png",
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) "default_junglewood.png",
start_smoke(pos, node, clicker) "fake_fire_empty_tile.png"
return itemstack },
end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
on_destruct = function (pos) fire_particles_on(pos)
stop_smoke(pos) return itemstack
minetest.sound_play("fire_extinguish", { end,
pos = pos, max_hear_distance = 5 on_construct = function(pos)
}) local meta = minetest.get_meta(pos)
end, fire_particles_on(pos)
drop = { end,
max_items = 3, on_destruct = function(pos, oldnode, oldmetadata, digger)
items = { fire_particles_off(pos)
{ minetest.sound_play("fire_extinguish", {
items = { "default:torch", "default:torch", "building_blocks:sticks" }, pos = pos, max_hear_distance = 5
rarity = 1, })
} end,
drop = {
max_items = 3,
items = {
{
items = { "default:torch", "default:torch", "building_blocks:sticks" },
rarity = 1,
} }
} }
}) }
})
-- EMBERS -- EMBERS
minetest.register_node("fake_fire:embers", { minetest.register_node("fake_fire:embers", {
@ -168,7 +253,7 @@ for _, mat in ipairs(materials) do
}, },
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local chimney = 1 local chimney = 1
start_smoke(pos, node, clicker, chimney) start_fire_effects(pos, node, clicker, chimney)
return itemstack return itemstack
end, end,
on_destruct = function (pos) on_destruct = function (pos)
@ -209,8 +294,22 @@ minetest.register_craft({
}) })
-- ALIASES -- ALIASES
minetest.register_alias("fake_fire:smokeless_fire", "fake_fire:fake_fire") 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_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_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:smokeless_chimney_top_sandstone", "fake_fire:chimney_top_sandstone")
minetest.register_alias("fake_fire:flint", "fake_fire:flint_and_steel") minetest.register_alias("fake_fire:flint", "fake_fire:flint_and_steel")
-- OTHER
minetest.register_lbm({
name = "fake_fire:reload_particles",
label = "restart fire particles on reload",
nodenames = {"fake_fire:fancy_fire"},
run_at_every_load = true,
action = function(pos, node)
fire_particles_off(pos)
fire_particles_on(pos)
end
})

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

14
new_campfire/LICENSE.txt Normal file
View File

@ -0,0 +1,14 @@
License of source code
----------------------
GNU Lesser General Public License, version 2.1
Copyright (C) 2011-2016 googol, Pavel Litvinoff <googolgl@gmail.com>
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html

61
new_campfire/README.md Normal file
View File

@ -0,0 +1,61 @@
Minetest mod "New Campfire"
======================
Version: 0.3.0
# License of source code:
- Copyright (C) 2017 Pavel Litvinoff <googolgl@gmail.com>
- Authors of media (contained_campfire.obj) and (campfire.png) files:
- Nathan Salapat
- License of media (models): CC BY-SA
# Notice:
- This mod is only useable with Minetest 0.4.15-dev or above!
# Description:
- You can craft and use better campfire.
# Using the mod:
- To use the campfire, you have to craft one. You need 2 stick and 3 stone to craft it following way:
```
default:stick
stairs:slab_cobble default:stick stairs:slab_cobble
stairs:slab_cobble
```
- Just rightclick with a flint_and_steel in your hand on the campfire and it will flame.
# Change Log
#### [0.1.0] - 2017-02-07
- Release
#### [0.1.1] - 2017-02-08
- added initllib support
- improved texture fire
#### [0.2.0] - 2017-02-13
- added animation particles of fire and smoke
#### [0.2.3] - 2017-03-15
- added: sound file, new textures, changed model, config_file
- added campfire life time
#### [0.2.4] - 2017-04-20
- added: fireplace, ash
- flamable nodes around the campfire can fire
- removed config_file
- changed recipe
#### [0.3.0] - 2017-
- added: cooking
# Links:
- Forum Topic:
- <https://forum.minetest.net/viewtopic.php?f=9&t=16611>
- Bitbucket:
- <https://bitbucket.org/g00g01/new_campfire>
- Intllib:
- https://github.com/minetest-mods/intllib

View File

@ -0,0 +1 @@
You can craft and use better campfire.

548
new_campfire/init.lua Normal file
View File

@ -0,0 +1,548 @@
-- VARIABLES
new_campfire_cooking = 1; -- nil - not cooked, 1 - cooked
new_campfire_limit = 1; -- nil - unlimited campfire, 1 - limited
new_campfire_ttl = 30; -- Time in sec
new_campfire_stick_time = new_campfire_ttl/2; -- How long does the stick increase. In sec.
new_campfire = {}
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.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 = 9,
time = 1.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.7, z= 0},
minexptime = 0.5,
maxexptime = 0.7,
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.8,},
-- playername = "singleplayer"
})
meta:set_int("layer_1", id)
local id = minetest.add_particlespawner({ -- 2 layer smol particles fire
amount = 1,
time = 1.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.4,
maxexptime = 0.6,
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.7,},
-- playername = "singleplayer"
})
meta:set_int("layer_2", id)
local id = minetest.add_particlespawner({ --3 layer smoke
amount = 1,
time = 1.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.8,
minsize = 2,
maxsize = 4,
collisiondetection = true,
vertical = true,
texture = "new_campfire_anim_smoke.png",
animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.9,},
-- playername = "singleplayer"
})
meta:set_int("layer_3", id)
end
local function fire_particles_off(pos)
local meta = minetest.get_meta(pos)
local id_1 = meta:get_int("layer_1");
local id_2 = meta:get_int("layer_2");
local id_3 = meta:get_int("layer_3");
minetest.delete_particlespawner(id_1)
minetest.delete_particlespawner(id_2)
minetest.delete_particlespawner(id_3)
end
-- we do this to determine the number of bytes each block symbol takes in the
-- user's current encoding (they're 3-byte UTF8 on my box, but that may not be
-- the case elsewhere)
local utf8_len_1=string.find("▓X", "X")-1
local utf8_len_2=string.find("▒X", "X")-1
local function indicator(maxVal, curVal)
local percent_val = math.floor(curVal / maxVal * 100)
local v = math.ceil(percent_val / 10)
return "\n"
..string.sub("▓▓▓▓▓▓▓▓▓▓", 1, v*utf8_len_1)
..string.sub("▒▒▒▒▒▒▒▒▒▒", 1, (10-v)*utf8_len_2)
.." "..percent_val.."%"
end
local function effect(pos, texture, vlc, acc, time, size)
local id = minetest.add_particle({
pos = pos,
velocity = vlc,
acceleration = acc,
expirationtime = time,
size = size,
collisiondetection = true,
vertical = true,
texture = texture,
})
end
local function infotext_edit(meta)
local infotext = S("Active campfire")
if new_campfire_limit and new_campfire_ttl > 0 then
local it_val = meta:get_int("it_val");
infotext = infotext..indicator(new_campfire_ttl, it_val)
end
local cooked_time = meta:get_int('cooked_time');
if new_campfire_cooking and cooked_time ~= 0 then
local cooked_cur_time = meta:get_int('cooked_cur_time');
infotext = infotext.."\n"..S("Cooking")..indicator(cooked_time, cooked_cur_time)
end
meta:set_string('infotext', infotext)
end
local function cooking(pos, itemstack)
local meta = minetest.get_meta(pos)
local cooked, _ = minetest.get_craft_result({method = "cooking", width = 1, items = {itemstack}})
local cookable = cooked.time ~= 0
if cookable and new_campfire_cooking then
local eat_y = ItemStack(cooked.item:to_table().name):get_definition().on_use
if string.find(minetest.serialize(eat_y), "do_item_eat") and meta:get_int("cooked_time") == 0 then
meta:set_int('cooked_time', cooked.time);
meta:set_int('cooked_cur_time', 0);
local name = itemstack:get_name()
local texture = itemstack:get_definition().inventory_image
infotext_edit(meta)
effect(
{x = pos.x, y = pos.y+0.2, z = pos.z},
texture,
{x=0, y=0, z=0},
{x=0, y=0, z=0},
cooked.time,
4
)
minetest.after(cooked.time/2, function()
if meta:get_int("it_val") > 0 then
local item = cooked.item:to_table().name
minetest.after(cooked.time/2, function(item)
if meta:get_int("it_val") > 0 then
minetest.add_item({x=pos.x, y=pos.y+0.2, z=pos.z}, item)
meta:set_int('cooked_time', 0);
meta:set_int('cooked_cur_time', 0);
else
minetest.add_item({x=pos.x, y=pos.y+0.2, z=pos.z}, name)
end
end, item)
else
minetest.add_item({x=pos.x, y=pos.y+0.2, z=pos.z}, name)
end
end)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
return itemstack
end
end
end
end
-- NODES
local sbox = {
type = 'fixed',
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16},
}
local grille_sbox = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, 2/16, 8/16 },
}
local grille_cbox = {
type = "fixed",
fixed = {
{ -8/16, 1/16, -8/16, 8/16, 2/16, 8/16 },
{ -8/16, -8/16, -8/16, -7/16, 1/16, -7/16 },
{ 8/16, -8/16, 8/16, 7/16, 1/16, 7/16 },
{ 8/16, -8/16, -8/16, 7/16, 1/16, -7/16 },
{ -8/16, -8/16, 8/16, -7/16, 1/16, 7/16 }
}
}
minetest.register_node('new_campfire:fireplace', {
description = S("Fireplace"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
"default_stone.png",
"new_campfire_empty_tile.png",
"new_campfire_empty_tile.png"
},
walkable = false,
buildable_to = false,
sunlight_propagates = false,
paramtype = 'light',
groups = {dig_immediate=3, flammable=0, not_in_creative_inventory=1},
selection_box = sbox,
sounds = default.node_sound_stone_defaults(),
drop = {max_items = 3, items = {{items = {"stairs:slab_cobble 3"}}}},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local name = itemstack:get_name()
if name == "new_campfire:grille" then
itemstack:take_item()
minetest.swap_node(pos, {name = "new_campfire:fireplace_with_grille"})
end
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('infotext', S("Fireplace"));
end,
})
minetest.register_node('new_campfire:campfire', {
description = S("Campfire"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
"default_stone.png",
"default_wood.png",
"new_campfire_empty_tile.png"
},
inventory_image = "new_campfire_campfire.png",
walkable = false,
buildable_to = false,
sunlight_propagates = true,
groups = {dig_immediate=3, flammable=0},
paramtype = 'light',
selection_box = sbox,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('infotext', S("Campfire"));
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if itemname == "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"
})
elseif itemname == "new_campfire:grille" then
itemstack:take_item()
minetest.swap_node(pos, {name = "new_campfire:campfire_with_grille"})
end
end,
})
minetest.register_node('new_campfire:campfire_active', {
description = S("Active campfire"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
"default_stone.png",
"default_wood.png",
"new_campfire_empty_tile.png"
},
inventory_image = "new_campfire_campfire.png",
walkable = false,
buildable_to = false,
sunlight_propagates = true,
groups = {oddly_breakable_by_hand=3, flammable=0, not_in_creative_inventory=1, igniter=1},
paramtype = 'none',
light_source = 13,
damage_per_second = 3,
drop = "new_campfire:campfire",
sounds = default.node_sound_stone_defaults(),
selection_box = sbox,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local name = itemstack:get_name()
if name == "new_campfire:grille" then
itemstack:take_item()
minetest.swap_node(pos, {name = "new_campfire:campfire_active_with_grille"})
end
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int('it_val', new_campfire_ttl);
infotext_edit(meta)
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)
end,
})
minetest.register_node('new_campfire:fireplace_with_grille', {
description = S("Fireplace with grille"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
"default_stone.png",
"new_campfire_empty_tile.png",
"default_steel_block.png"
},
buildable_to = false,
sunlight_propagates = false,
paramtype = 'light',
groups = {dig_immediate=3, flammable=0, not_in_creative_inventory=1},
selection_box = grille_sbox,
node_box = grille_cbox,
sounds = default.node_sound_stone_defaults(),
drop = {max_items = 3, items = {{items = {"stairs:slab_cobble 3"}}}},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('infotext', S("Fireplace"));
end,
})
minetest.register_node('new_campfire:campfire_with_grille', {
description = S("Campfire with grille"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
"default_stone.png",
"default_wood.png",
"default_steel_block.png"
},
inventory_image = "new_campfire_campfire.png",
buildable_to = false,
sunlight_propagates = true,
groups = {dig_immediate=3, flammable=0, not_in_creative_inventory=1},
paramtype = 'light',
selection_box = grille_sbox,
node_box = grille_cbox,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('infotext', S("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_with_grille'})
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,
})
minetest.register_node('new_campfire:campfire_active_with_grille', {
description = S("Active campfire with grille"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
"default_stone.png",
"default_wood.png",
"default_steel_block.png"
},
inventory_image = "new_campfire_campfire.png",
buildable_to = false,
sunlight_propagates = true,
groups = {oddly_breakable_by_hand=3, flammable=0, not_in_creative_inventory=1, igniter=1},
paramtype = 'none',
light_source = 13,
damage_per_second = 3,
drop = "new_campfire:campfire",
sounds = default.node_sound_stone_defaults(),
selection_box = grille_sbox,
node_box = grille_cbox,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
if itemstack:get_definition().groups.stick == 1 then
local it_val = meta:get_int("it_val") + (new_campfire_ttl);
meta:set_int('it_val', it_val);
effect(
{x = pos.x, y = pos.y+0.4, z = pos.z},
"default_stick.png",
{x=0, y=-1, z=0},
{x=0, y=0, z=0},
1,
6
)
infotext_edit(meta)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
return itemstack
end
else
cooking(pos, itemstack)
end
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int('it_val', new_campfire_ttl);
infotext_edit(meta)
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)
end,
on_timer = function(pos) -- Every 6 seconds play sound fire_small
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)
end,
})
-- ABM
minetest.register_abm({
nodenames = {"new_campfire:campfire_active", "new_campfire:campfire_active_with_grille"},
-- neighbors = {"group:puts_out_fire"},
interval = 1.0, -- Run every 3 seconds
chance = 1, -- Select every 1 in 1 nodes
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},
{x=pos.x+1, y=pos.y+1, z=pos.z+1},
{"group:water"}
)
if #fpos > 0 then
minetest.set_node(pos, {name = string.gsub(node.name, "_active", "")})
minetest.sound_play("fire_extinguish_flame",{pos = pos, max_hear_distance = 16, gain = 0.15})
else
local meta = minetest.get_meta(pos)
local it_val = meta:get_int("it_val") - 1;
if new_campfire_limit and new_campfire_ttl > 0 then
if it_val <= 0 then
minetest.remove_node(pos)
minetest.set_node(pos, {name = string.gsub(node.name, "campfire_active", "fireplace")} )
minetest.add_item(pos, "new_campfire:ash")
return
end
meta:set_int('it_val', it_val);
end
if new_campfire_cooking then
if meta:get_int('cooked_cur_time') <= meta:get_int('cooked_time') then
meta:set_int('cooked_cur_time', meta:get_int('cooked_cur_time') + 1);
else
meta:set_int('cooked_time', 0);
meta:set_int('cooked_cur_time', 0);
end
end
infotext_edit(meta)
fire_particles_on(pos)
end
end
})
-- CRAFTS
minetest.register_craft({
output = "new_campfire:grille",
recipe = {
{ "basic_materials:steel_bar", "", "basic_materials:steel_bar" },
{ "", "basic_materials:steel_wire", "" },
{ "basic_materials:steel_bar", "", "basic_materials:steel_bar" },
}
})
minetest.register_craft({
output = "new_campfire:campfire",
recipe = {
{'', 'group:stick', ''},
{'stairs:slab_cobble','group:stick', 'stairs:slab_cobble'},
{'', 'stairs:slab_cobble', ''},
}
})
-- ITEMS
minetest.register_craftitem("new_campfire:grille", {
description = S("Metal Grille"),
inventory_image = "new_campfire_grille.png"
})
minetest.register_craftitem("new_campfire:ash", {
description = S("Ash"),
inventory_image = "new_campfire_ash.png"
})
-- EXTRA
if not minetest.get_modpath("campfire") then
minetest.register_alias("campfire:campfire", "new_campfire:campfire")
minetest.register_alias("campfire:campfire_active", "new_campfire:campfire")
end

45
new_campfire/intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

38
new_campfire/locale/ru.po Normal file
View File

@ -0,0 +1,38 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-22 20:24+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua:119 init.lua:260
msgid "Active campfire"
msgstr "Горящий костер"
#: init.lua:129
msgid "Cooking"
msgstr "Приготовление"
#: init.lua:193 init.lua:211
msgid "Fireplace"
msgstr "Кострище"
#: init.lua:216 init.lua:236
msgid "Campfire"
msgstr "Костер"
#: init.lua:382
msgid "Ash"
msgstr "Пепел"

View File

@ -0,0 +1,38 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-22 20:24+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua:119 init.lua:260
msgid "Active campfire"
msgstr ""
#: init.lua:129
msgid "Cooking"
msgstr ""
#: init.lua:193 init.lua:211
msgid "Fireplace"
msgstr ""
#: init.lua:216 init.lua:236
msgid "Campfire"
msgstr ""
#: init.lua:382
msgid "Ash"
msgstr ""

38
new_campfire/locale/ua.po Normal file
View File

@ -0,0 +1,38 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-22 20:24+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua:119 init.lua:260
msgid "Active campfire"
msgstr "Палаюче багаття"
#: init.lua:129
msgid "Cooking"
msgstr "Готування"
#: init.lua:193 init.lua:211
msgid "Fireplace"
msgstr "Місце від багаття"
#: init.lua:216 init.lua:236
msgid "Campfire"
msgstr "Багаття"
#: init.lua:382
msgid "Ash"
msgstr "Попіл"

3
new_campfire/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = new_campfire
depends = default, fire, basic_materials
optional_depends = campfire

View File

@ -0,0 +1,10 @@
==========================
Minetest 0.4 mod: more_fire
--------------------------------------
Authors of model file:
Nathan Salapat
contained_campfire.obj
License of media (models): CC BY-SA
==========================

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B