Merge pull request 'Campfire Updates' (#3769) from campfire_update into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3769
This commit is contained in:
ancientmarinerdev 2023-09-04 22:20:48 +00:00
commit b4c693bb20
35 changed files with 5546 additions and 786 deletions

@ -411,6 +411,10 @@ mesecon.register_mvps_stopper("mesecons_solarpanel:solar_panel_inverted_on")
mesecon.register_mvps_stopper("mesecons_solarpanel:solar_panel_inverted_off")
mesecon.register_mvps_stopper("mcl_banners:hanging_banner")
mesecon.register_mvps_stopper("mcl_banners:standing_banner")
mesecon.register_mvps_stopper("mcl_campfires:campfire")
mesecon.register_mvps_stopper("mcl_campfires:campfire_lit")
mesecon.register_mvps_stopper("mcl_campfires:soul_campfire")
mesecon.register_mvps_stopper("mcl_campfires:soul_campfire_lit")
-- Unmovable by technical restrictions.
-- Open formspec would screw up if node is destroyed (minor problem)
@ -935,6 +939,11 @@ mesecon.register_mvps_unsticky("mcl_farming:wheat_4")
mesecon.register_mvps_unsticky("mcl_farming:wheat_5")
mesecon.register_mvps_unsticky("mcl_farming:wheat_6")
mesecon.register_mvps_unsticky("mcl_farming:wheat_7")
-- Campfires
mesecon.register_mvps_unsticky("mcl_campfires:campfire")
mesecon.register_mvps_unsticky("mcl_campfires:campfire_lit")
mesecon.register_mvps_unsticky("mcl_campfires:soul_campfire")
mesecon.register_mvps_unsticky("mcl_campfires:soul_campfire_lit")
-- Includes node heat when moving them
mesecon.register_on_mvps_move(mesecon.move_hot_nodes)

@ -1,6 +1,7 @@
local S = minetest.get_translator(minetest.get_current_modname())
local mod_target = minetest.get_modpath("mcl_target")
local mod_campfire = minetest.get_modpath("mcl_campfires")
local enable_pvp = minetest.settings:get_bool("enable_pvp")
local math = math
@ -395,6 +396,11 @@ function ARROW_ENTITY.on_step(self, dtime)
tnt.ignite(self._stuckin)
end
-- Ignite Campfires
if mod_campfire and mcl_burning.is_burning(self.object) and minetest.get_item_group(snode.name, "campfire") ~= 0 then
mcl_campfires.light_campfire(self._stuckin)
end
-- Activate target
if mod_target and snode.name == "mcl_target:target_off" then
mcl_target.hit(self._stuckin, 1) --10 redstone ticks

@ -1,7 +1,5 @@
MineClone 2 Campfire API
========================
`mcl_campfires.register_campfire`
---------------------------------
# MineClone 2 Campfire API
## `mcl_campfires.register_campfire`
Used to register campfires.
**Example Usage**
@ -24,3 +22,6 @@ mcl_campfires.register_campfire("mcl_campfires:campfire", {
* drops - what items drop when the campfire is mined.
* lightlevel - the level of light the campfire emits.
* damage - amount of damage the campfire deals when the player stands on it.
## Cooking Items
To allow an item to be cooked on the campfire, it must first have a registered cooked variant. To allow placing the item on the campfire to be cooked, add `campfire_cookable = 1` into the item groups list.

@ -9,6 +9,9 @@ Authors:
Gerold55 - Code Start + Models?
PrairieWind - Improved and Cleaned Up Code, and added the soul campfire and crafting recipes.
cora - Added burning damage.
DinoNuggies4665 - Cooking logic implemented
thunder1035 - Redesigned model and texture tweaks
AncientMariner - Changed smoke to particle spawner and tweaked particle configuration.
License of media
----------------

@ -1,6 +1,235 @@
local S = minetest.get_translator(minetest.get_current_modname())
mcl_campfires = {}
local COOK_TIME = 30 -- Time it takes to cook food on a campfire.
local food_entity = {nil, nil, nil, nil}
local campfire_spots = {
vector.new(-0.25, -0.04, -0.25),
vector.new( 0.25, -0.04, -0.25),
vector.new( 0.25, -0.04, 0.25),
vector.new(-0.25, -0.04, 0.25),
}
local drop_inventory = mcl_util.drop_items_from_meta_container("main")
local function campfire_drops(pos, digger, drops, nodename)
local wield_item = digger:get_wielded_item()
local silk_touch = mcl_enchanting.has_enchantment(wield_item, "silk_touch")
local is_creative = minetest.is_creative_enabled(digger:get_player_name())
local inv = digger:get_inventory()
if not is_creative then
if silk_touch then
minetest.add_item(pos, nodename)
else
minetest.add_item(pos, drops)
end
elseif is_creative and inv:room_for_item("main", nodename) and not inv:contains_item("main", nodename) then
inv:add_item("main", nodename)
end
end
local function drop_items(pos, node, oldmeta)
local meta = minetest.get_meta(pos)
drop_inventory(pos, node, oldmeta)
local entites = minetest.get_objects_inside_radius(pos, 0.5)
if entites then
for _, food_entity in ipairs(entites) do
if food_entity then
if food_entity:get_luaentity().name == "mcl_campfires:food_entity" then
food_entity:remove()
for i = 1, 4 do
meta:set_string("food_x_"..tostring(i), nil)
meta:set_string("food_y_"..tostring(i), nil)
meta:set_string("food_z_"..tostring(i), nil)
end
end
end
end
end
end
local function on_blast(pos)
local node = minetest.get_node(pos)
drop_items(pos, node)
minetest.remove_node(pos)
end
function mcl_campfires.light_campfire(pos)
local campfire = minetest.get_node(pos)
local name = campfire.name .. "_lit"
minetest.set_node(pos, {name = name, param2 = campfire.param2})
end
-- on_rightclick function to take items that are cookable in a campfire, and put them in the campfire inventory
function mcl_campfires.take_item(pos, node, player, itemstack)
local food_entity = {nil,nil,nil,nil}
local is_creative = minetest.is_creative_enabled(player:get_player_name())
local inv = player:get_inventory()
local campfire_meta = minetest.get_meta(pos)
local campfire_inv = campfire_meta:get_inventory()
local timer = minetest.get_node_timer(pos)
local stack = itemstack:peek_item(1)
if minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then
local cookable = minetest.get_craft_result({method = "cooking", width = 1, items = {itemstack}})
if cookable then
for space = 1, 4 do -- Cycle through spots
local spot = campfire_inv:get_stack("main", space)
if not spot or spot == (ItemStack("") or ItemStack("nil")) then -- Check if the spot is empty or not
if not is_creative then itemstack:take_item(1) end -- Take the item if in creative
campfire_inv:set_stack("main", space, stack) -- Set the inventory itemstack at the empty spot
campfire_meta:set_int("cooktime_"..tostring(space), COOK_TIME) -- Set the cook time meta
food_entity[space] = minetest.add_entity(pos + campfire_spots[space], "mcl_campfires:food_entity") -- Spawn food item on the campfire
local food_luaentity = food_entity[space]:get_luaentity()
food_luaentity.wield_item = campfire_inv:get_stack("main", space):get_name() -- Set the wielditem of the food item to the food on the campfire
food_luaentity.wield_image = "mcl_mobitems_"..string.sub(campfire_inv:get_stack("main", space):get_name(), 14).."_raw.png" -- Set the wield_image to the food item on the campfire
food_entity[space]:set_properties(food_luaentity) -- Apply changes to the food entity
campfire_meta:set_string("food_x_"..tostring(space), tostring(food_entity[space]:get_pos().x))
campfire_meta:set_string("food_y_"..tostring(space), tostring(food_entity[space]:get_pos().y))
campfire_meta:set_string("food_z_"..tostring(space), tostring(food_entity[space]:get_pos().z))
break
end
end
end
timer:start(1) -- Start cook timer
end
end
-- on_timer function to run the cook timer and cook items.
function mcl_campfires.cook_item(pos, elapsed)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local continue = 0
-- Cycle through slots to cook them.
for i = 1, 4 do
local time_r = meta:get_int("cooktime_"..tostring(i))
local item = inv:get_stack("main", i)
local food_entity = nil
local food_x = tonumber(meta:get_string("food_x_"..tostring(i)))
local food_y = tonumber(meta:get_string("food_y_"..tostring(i)))
local food_z = tonumber(meta:get_string("food_z_"..tostring(i)))
if food_x and food_y and food_z then
local entites = minetest.get_objects_inside_radius(vector.new(food_x, food_y, food_z), 0)
if entites then
for _, entity in ipairs(entites) do
if entity then
local luaentity = entity:get_luaentity()
if luaentity then
local name = luaentity.name
if name == "mcl_campfires:food_entity" then
food_entity = entity
food_entity:set_properties({wield_item = inv:get_stack("main", i):get_name()})
end
end
end
end
end
end
if item ~= (ItemStack("") or ItemStack("nil")) then
-- Item hasn't been cooked completely, continue cook timer countdown.
if time_r > 0 then
meta:set_int("cooktime_"..tostring(i), time_r - 1)
-- Item cook timer is up, finish cooking process and drop cooked item.
elseif time_r <= 0 then
local cooked = minetest.get_craft_result({method = "cooking", width = 1, items = {item}})
if cooked then
if food_entity then
food_entity:remove() -- Remove visual food entity
meta:set_string("food_x_"..tostring(i), nil)
meta:set_string("food_y_"..tostring(i), nil)
meta:set_string("food_z_"..tostring(i), nil)
minetest.add_item(pos, cooked.item) -- Drop Cooked Item
-- Throw some Experience Points because why not?
-- Food is cooked, xp is deserved for using this unique cooking method. Take that Minecraft ;)
local dir = vector.divide(minetest.facedir_to_dir(minetest.get_node(pos).param2),-1.95)
mcl_experience.throw_xp(vector.add(pos, dir), 1)
inv:set_stack("main", i, "") -- Clear Inventory
continue = continue + 1 -- Indicate that the slot is clear.
end
end
end
else
continue = continue + 1
end
end
-- Not all slots are empty, continue timer.
if continue ~= 4 then
return true
-- Slots are empty, stop node timer.
else
return false
end
end
local function destroy_particle_spawner (pos)
local meta = minetest.get_meta(pos)
local part_spawn_id = meta:get_int("particle_spawner_id")
if part_spawn_id and part_spawn_id > 0 then
minetest.delete_particlespawner(part_spawn_id)
end
end
local function create_smoke_partspawner (pos, constructor)
if not constructor then
destroy_particle_spawner (pos)
end
local haybale = false
local node_below = vector.offset(pos, 0, -1, 0)
if minetest.get_node(node_below).name == "mcl_farming:hay_block" then
haybale = true
end
local smoke_timer
if haybale then
smoke_timer = 4
else
smoke_timer = 2.4
end
local spawner_id = minetest.add_particlespawner({
amount = 3,
time = 0,
minpos = vector.add(pos, vector.new(-0.25, 0, -0.25)),
maxpos = vector.add(pos, vector.new( 0.25, 0, 0.25)),
minvel = vector.new(-0.2, 0.5, -0.2),
maxvel = vector.new(0.2, 1, 0.2),
minacc = vector.new(0, 0.5, 0),
maxacc = vector.new(0, 0.5, 0),
minexptime = smoke_timer,
maxexptime = smoke_timer * 2,
minsize = 6,
maxsize = 8,
collisiondetection = true,
vertical = false,
texture = "mcl_campfires_particle_1.png",
texpool = {
"mcl_campfires_particle_1.png";
{ name = "mcl_campfires_particle_1.png", fade = "out" },
{ name = "mcl_campfires_particle_2.png", fade = "out" },
{ name = "mcl_campfires_particle_3.png", fade = "out" },
{ name = "mcl_campfires_particle_4.png", fade = "out" },
{ name = "mcl_campfires_particle_5.png", fade = "out" },
{ name = "mcl_campfires_particle_6.png", fade = "out" },
{ name = "mcl_campfires_particle_7.png", fade = "out" },
{ name = "mcl_campfires_particle_8.png", fade = "out" },
{ name = "mcl_campfires_particle_9.png", fade = "out" },
{ name = "mcl_campfires_particle_10.png", fade = "out" },
{ name = "mcl_campfires_particle_11.png", fade = "out" },
{ name = "mcl_campfires_particle_11.png", fade = "out" },
{ name = "mcl_campfires_particle_12.png", fade = "out" },
}
})
local meta = minetest.get_meta(pos)
meta:set_int("particle_spawner_id", spawner_id)
end
function mcl_campfires.register_campfire(name, def)
-- Define Campfire
minetest.register_node(name, {
@ -15,16 +244,13 @@ function mcl_campfires.register_campfire(name, def)
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, not_in_creative_inventory=1, campfire=1, },
paramtype = "light",
paramtype2 = "facedir",
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
if player:get_wielded_item():get_name() == "mcl_fire:flint_and_steel" then
node.name = name.."_lit"
minetest.set_node(pos, node)
end
paramtype2 = "4dir",
_on_ignite = function(player, node)
mcl_campfires.light_campfire(node.under)
return true
end,
drop = def.drops,
_mcl_silk_touch_drop = {name},
mcl_sounds.node_sound_wood_defaults(),
drop = "",
sounds = mcl_sounds.node_sound_wood_defaults(),
selection_box = {
type = 'fixed',
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
@ -35,6 +261,9 @@ function mcl_campfires.register_campfire(name, def)
},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
after_dig_node = function(pos, node, oldmeta, digger)
campfire_drops(pos, digger, def.drops, name.."_lit")
end,
})
--Define Lit Campfire
@ -45,38 +274,71 @@ function mcl_campfires.register_campfire(name, def)
inventory_image = def.inv_texture,
wield_image = def.inv_texture,
drawtype = "mesh",
mesh = "mcl_campfires_campfire_lit.obj",
tiles = {{
mesh = "mcl_campfires_campfire.obj",
tiles = {
{
name=def.fire_texture,
animation={
type="vertical_frames",
aspect_w=16,
aspect_h=16,
length=2.0
}},
{name=def.lit_logs_texture,
animation={
type="vertical_frames",
aspect_w=16,
aspect_w=32,
aspect_h=16,
length=2.0
}}
},
overlay_tiles = {
{
name=def.lit_logs_texture,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 16,
length = 2.0,
}
},
},
use_texture_alpha = "clip",
groups = { handy=1, axey=1, material_wood=1, campfire=1, lit_campfire=1 },
groups = { handy=1, axey=1, material_wood=1, lit_campfire=1 },
paramtype = "light",
paramtype2 = "facedir",
paramtype2 = "4dir",
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("main", 4)
create_smoke_partspawner (pos, true)
end,
on_destruct = function(pos)
destroy_particle_spawner (pos)
end,
on_rightclick = function (pos, node, player, itemstack, pointed_thing)
if player:get_wielded_item():get_name():find("shovel") then
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv then inv:set_size("main", 4) end
if minetest.get_item_group(itemstack:get_name(), "shovel") ~= 0 then
local protected = mcl_util.check_position_protection(pos, player)
if not protected then
if not minetest.is_creative_enabled(player:get_player_name()) then
-- Add wear (as if digging a shovely node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "shovely")
if wear then
itemstack:add_wear(wear)
end
end
node.name = name
minetest.set_node(pos, node)
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
end
elseif minetest.get_item_group(itemstack:get_name(), "campfire_cookable") ~= 0 then
mcl_campfires.take_item(pos, node, player, itemstack)
else
minetest.item_place_node(itemstack, player, pointed_thing)
end
end,
drop = def.drops,
_mcl_silk_touch_drop = {name.."_lit"},
on_timer = mcl_campfires.cook_item,
drop = "",
light_source = def.lightlevel,
mcl_sounds.node_sound_wood_defaults(),
sounds = mcl_sounds.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {-.5, -.5, -.5, .5, -.05, .5}, --left, bottom, front, right, top
@ -87,7 +349,13 @@ function mcl_campfires.register_campfire(name, def)
},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
damage_per_second = def.damage,
damage_per_second = def.damage, -- FIXME: Once entity burning is fixed, this needs to be removed.
on_blast = on_blast,
after_dig_node = function(pos, node, oldmeta, digger)
drop_items(pos, node, oldmeta)
campfire_drops(pos, digger, def.drops, name.."_lit")
end,
_mcl_campfires_smothered_form = name,
})
end
@ -107,11 +375,25 @@ minetest.register_globalstep(function(dtime)
if etime < 0.5 then return end
etime = 0
for _,pl in pairs(minetest.get_connected_players()) do
local armor_feet = pl:get_inventory():get_stack("armor", 5)
if pl and pl:get_player_control().sneak or (minetest.global_exists("mcl_enchanting") and mcl_enchanting.has_enchantment(armor_feet, "frost_walker")) or (minetest.global_exists("mcl_potions") and mcl_potions.player_has_effect(pl, "fire_proof")) then
return
end
burn_in_campfire(pl)
end
for _,ent in pairs(minetest.luaentities) do
if ent.is_mob then
burn_in_campfire(ent.object)
burn_in_campfire(ent.object) -- FIXME: Mobs don't seem to burn properly anymore.
end
end
end)
minetest.register_lbm({
label = "Campfire Smoke",
name = "mcl_campfires:campfire_smoke",
nodenames = {"group:lit_campfire"},
run_at_every_load = true,
action = function(pos, node)
create_smoke_partspawner (pos)
end,
})

@ -1,8 +1,8 @@
-- TO-DO:
-- * Add Smoke Particles
-- * Add Spark Particles
-- * Add Cooking Meat
-- * Add Working Sounds
-- * Waterlogging (needs engine change)
-- * Fix the mob damage when mobs go back to burning again
local modname = minetest.get_modpath(minetest.get_current_modname())
dofile(modname.."/api.lua") -- Load API File

@ -1,3 +1,3 @@
name = mcl_campfires
depends = mcl_sounds
author = PrairieWind, Gerold55
depends = mcl_sounds, mcl_util
author = PrairieWind, Gerold55, DinoNuggies4665

File diff suppressed because it is too large Load Diff

@ -1,35 +0,0 @@
# Blender MTL File: 'campfire.blend'
# Material Count: 3
newmtl Material.001
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd G:\minetest-0.4.16-win641\textures\Pixel Perfection v4.0\mcl_campfire_fire.png
newmtl none
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd \home\nathan\Downloads\mcl_campfire_log.png
newmtl none_NONE
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd \\home\\nathan\\Downloads\\mcl_campfire_log.png

@ -1,248 +0,0 @@
# Blender v2.78 (sub 0) OBJ File: 'campfire.blend'
# www.blender.org
mtllib campfire1.mtl
o nodebox4.005_nodebox4.006
v 0.243779 -0.499707 -0.497529
v 0.493779 -0.499707 -0.497421
v 0.493779 -0.249707 -0.497421
v 0.243779 -0.249707 -0.497529
v 0.243349 -0.499707 0.502471
v 0.493349 -0.499707 0.502578
v 0.493349 -0.249707 0.502578
v 0.243349 -0.249707 0.502471
v 0.493779 -0.499707 -0.497421
v 0.493779 -0.249707 -0.497421
v 0.493349 -0.499707 0.502578
v 0.493349 -0.249707 0.502578
vt -0.0000 0.7500
vt -0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt -0.0000 0.7500
vt -0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt -0.0000 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt -0.0000 0.7500
vn -0.0004 0.0000 1.0000
vn 1.0000 -0.0000 0.0004
vn -0.0000 -1.0000 0.0000
usemtl none
s off
f 1/1/1 2/2/1 3/3/1 4/4/1
f 5/5/1 6/6/1 7/7/1 8/8/1
f 1/9/2 4/10/2 8/11/2 5/5/2
f 1/9/3 2/12/3 6/13/3 5/5/3
f 4/14/3 3/15/3 7/16/3 8/17/3
f 9/18/2 10/19/2 12/20/2 11/21/2
o nodebox4.004_nodebox4.005
v -0.500021 -0.499707 -0.497848
v -0.250021 -0.499707 -0.497741
v -0.250021 -0.249707 -0.497741
v -0.500021 -0.249707 -0.497848
v -0.500451 -0.499707 0.502152
v -0.250451 -0.499707 0.502259
v -0.250451 -0.249707 0.502259
v -0.500451 -0.249707 0.502152
v -0.250021 -0.499707 -0.497741
v -0.250021 -0.249707 -0.497741
v -0.250451 -0.499707 0.502259
v -0.250451 -0.249707 0.502259
vt -0.0000 0.7500
vt -0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt -0.0000 0.7500
vt -0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt -0.0000 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt -0.0000 0.7500
vn -0.0004 0.0000 1.0000
vn 1.0000 -0.0000 0.0004
vn -0.0000 -1.0000 0.0000
usemtl none
s off
f 13/22/4 14/23/4 15/24/4 16/25/4
f 17/26/4 18/27/4 19/28/4 20/29/4
f 13/30/5 16/31/5 20/32/5 17/26/5
f 13/30/6 14/33/6 18/34/6 17/26/6
f 16/35/6 15/36/6 19/37/6 20/38/6
f 21/39/5 22/40/5 24/41/5 23/42/5
o nodebox4.001_nodebox4.004
v 0.500000 -0.312500 -0.493800
v 0.500000 -0.312500 -0.243800
v 0.500000 -0.062500 -0.243800
v 0.500000 -0.062500 -0.493800
v -0.500000 -0.312500 -0.493800
v -0.500000 -0.312500 -0.243800
v -0.500000 -0.062500 -0.243800
v -0.500000 -0.062500 -0.493800
v 0.500000 -0.312500 -0.243800
v 0.500000 -0.062500 -0.243800
v -0.500000 -0.312500 -0.243800
v -0.500000 -0.062500 -0.243800
vt 0.0000 0.7500
vt 0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt 0.0000 0.7500
vt 0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.7500
vn -1.0000 0.0000 0.0000
vn 0.0000 -0.0000 1.0000
vn 0.0000 -1.0000 -0.0000
usemtl none
s off
f 25/43/7 26/44/7 27/45/7 28/46/7
f 29/47/7 30/48/7 31/49/7 32/50/7
f 25/51/8 28/52/8 32/53/8 29/47/8
f 25/51/9 26/54/9 30/55/9 29/47/9
f 28/56/9 27/57/9 31/58/9 32/59/9
f 33/60/8 34/61/8 36/62/8 35/63/8
o Plane
v -0.311754 -0.438770 -0.196249
v 0.276360 -0.438621 0.247948
v -0.311276 0.135801 -0.196634
v 0.276838 0.135950 0.247562
v -0.274993 -0.438696 0.270317
v 0.240407 -0.438696 -0.218656
v -0.275322 0.135875 0.269969
v 0.240077 0.135875 -0.219003
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt -0.0000 1.0000
vn -0.6027 0.0010 0.7980
vn 0.6883 0.0008 0.7255
usemtl Material.001
s off
f 37/64/10 38/65/10 40/66/10 39/67/10
f 41/68/11 42/69/11 44/70/11 43/71/11
o nodebox3
v 0.250000 -0.500000 -0.500000
v 0.250000 -0.500000 0.500000
v 0.250000 -0.437500 0.500000
v 0.250000 -0.437500 -0.500000
v -0.250000 -0.500000 -0.500000
v -0.250000 -0.500000 0.500000
v -0.250000 -0.437500 0.500000
v -0.250000 -0.437500 -0.500000
vt 1.0000 0.0000
vt 1.0000 0.0625
vt 0.0000 0.0625
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 0.0625
vt 0.0000 0.0625
vt 0.0000 0.0000
vt 1.0000 0.4375
vt 0.0000 0.4375
vt 0.0001 0.0001
vt 0.9999 0.0001
vt 1.0000 0.5000
vt 0.0000 0.5000
vt 0.0001 0.0001
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vt 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 -0.0000
vn -1.0000 0.0000 0.0000
usemtl none
s off
f 45/72/12 48/73/12 52/74/12 49/75/12
f 46/76/12 47/77/12 51/78/12 50/79/12
f 45/72/13 46/80/13 50/81/13 49/82/13
f 48/83/13 47/84/13 51/85/13 52/86/13
usemtl none_NONE
f 45/87/14 46/88/14 47/89/14 48/90/14
f 49/75/14 50/79/14 51/91/14 52/92/14
o nodebox4
v 0.500000 -0.312500 0.250000
v 0.500000 -0.312500 0.500000
v 0.500000 -0.062500 0.500000
v 0.500000 -0.062500 0.250000
v -0.500000 -0.312500 0.250000
v -0.500000 -0.312500 0.500000
v -0.500000 -0.062500 0.500000
v -0.500000 -0.062500 0.250000
v 0.500000 -0.312500 0.500000
v 0.500000 -0.062500 0.500000
v -0.500000 -0.312500 0.500000
v -0.500000 -0.062500 0.500000
vt -0.0000 0.7500
vt 0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt -0.0000 0.7500
vt -0.0000 0.5000
vt 0.2500 0.5000
vt 0.2500 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt -0.0000 0.7500
vt 1.0000 0.7500
vt 1.0000 1.0000
vt 0.0000 1.0000
vt -0.0000 0.7500
vn -1.0000 0.0000 0.0000
vn 0.0000 -0.0000 1.0000
vn 0.0000 -1.0000 -0.0000
usemtl none
s off
f 53/93/15 54/94/15 55/95/15 56/96/15
f 57/97/15 58/98/15 59/99/15 60/100/15
f 53/101/16 56/102/16 60/103/16 57/97/16
f 53/101/17 54/104/17 58/105/17 57/97/17
f 56/106/17 55/107/17 59/108/17 60/109/17
f 61/110/16 62/111/16 64/112/16 63/113/16

@ -1,225 +0,0 @@
# Blender v2.79 (sub 7) OBJ File: 'campfire.blend'
# www.blender.org
o Plane
v -0.240246 -0.438696 -0.141059
v 0.205043 -0.438696 0.192756
v -0.239959 0.135875 -0.141442
v 0.205331 0.135875 0.192373
v -0.216088 -0.438696 0.214432
v 0.181502 -0.438696 -0.162771
v -0.216417 0.135875 0.214085
v 0.181172 0.135875 -0.163119
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt -0.000000 1.000000
vn -0.5998 0.0008 0.8001
vn 0.6883 0.0008 0.7255
g Plane_Plane_Material.001
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 5/5/2 6/6/2 8/7/2 7/8/2
o nodebox3
v 0.250000 -0.500000 -0.500000
v 0.250000 -0.500000 0.500000
v 0.250000 -0.437500 0.500000
v 0.250000 -0.437500 -0.500000
v -0.250000 -0.500000 -0.500000
v -0.250000 -0.500000 0.500000
v -0.250000 -0.437500 0.500000
v -0.250000 -0.437500 -0.500000
v 0.243779 -0.499707 -0.497529
v 0.493779 -0.499707 -0.497421
v 0.493779 -0.249707 -0.497421
v 0.243779 -0.249707 -0.497529
v 0.243349 -0.499707 0.502471
v 0.493349 -0.499707 0.502579
v 0.493349 -0.249707 0.502578
v 0.243349 -0.249707 0.502471
v 0.493779 -0.499707 -0.497421
v 0.493779 -0.249707 -0.497421
v 0.493349 -0.499707 0.502579
v 0.493349 -0.249707 0.502578
v -0.500021 -0.499707 -0.497848
v -0.250021 -0.499707 -0.497741
v -0.250021 -0.249707 -0.497741
v -0.500021 -0.249707 -0.497848
v -0.500451 -0.499707 0.502152
v -0.250451 -0.499707 0.502259
v -0.250451 -0.249707 0.502259
v -0.500451 -0.249707 0.502152
v -0.250021 -0.499707 -0.497741
v -0.250021 -0.249707 -0.497741
v -0.250451 -0.499707 0.502259
v -0.250451 -0.249707 0.502259
v 0.500000 -0.312500 -0.493800
v 0.500000 -0.312500 -0.243800
v 0.500000 -0.062500 -0.243800
v 0.500000 -0.062500 -0.493800
v -0.500000 -0.312500 -0.493800
v -0.500000 -0.312500 -0.243800
v -0.500000 -0.062500 -0.243800
v -0.500000 -0.062500 -0.493800
v 0.500000 -0.312500 -0.243800
v 0.500000 -0.062500 -0.243800
v -0.500000 -0.312500 -0.243800
v -0.500000 -0.062500 -0.243800
v 0.500000 -0.312500 0.250000
v 0.500000 -0.312500 0.500000
v 0.500000 -0.062500 0.500000
v 0.500000 -0.062500 0.250000
v -0.500000 -0.312500 0.250000
v -0.500000 -0.312500 0.500000
v -0.500000 -0.062500 0.500000
v -0.500000 -0.062500 0.250000
v 0.500000 -0.312500 0.500000
v 0.500000 -0.062500 0.500000
v -0.500000 -0.312500 0.500000
v -0.500000 -0.062500 0.500000
vt 0.999982 0.000018
vt 1.000000 0.062500
vt 0.000000 0.062500
vt 0.000018 0.000018
vt 0.999982 0.000018
vt 1.000000 0.062500
vt 0.000000 0.062500
vt 0.000018 0.000018
vt 1.000000 0.437500
vt 0.000000 0.437500
vt 0.000071 0.000071
vt 0.999929 0.000071
vt 1.000000 0.500000
vt 0.000000 0.500000
vt 0.000071 0.000071
vt -0.000000 0.750000
vt -0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt -0.000000 0.750000
vt -0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt -0.000000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt -0.000000 0.750000
vt -0.000000 0.750000
vt -0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt -0.000000 0.750000
vt -0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt -0.000000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt -0.000000 0.750000
vt 0.000000 0.750000
vt 0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt 0.000000 0.750000
vt 0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.750000
vt -0.000000 0.750000
vt 0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt -0.000000 0.750000
vt -0.000000 0.500000
vt 0.250000 0.500000
vt 0.250000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt -0.000000 0.750000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt -0.000000 0.750000
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.000000 0.000000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 -0.0000
vn -0.0004 0.0000 1.0000
vn 1.0000 -0.0000 0.0004
vn -1.0000 0.0000 0.0000
g nodebox3_nodebox3_none
s off
f 9/9/3 12/10/3 16/11/3 13/12/3
f 10/13/3 11/14/3 15/15/3 14/16/3
f 9/9/4 10/17/4 14/18/4 13/19/4
f 12/20/4 11/21/4 15/22/4 16/23/4
f 17/24/5 18/25/5 19/26/5 20/27/5
f 21/28/5 22/29/5 23/30/5 24/31/5
f 17/32/6 20/33/6 24/34/6 21/28/6
f 17/32/4 18/35/4 22/36/4 21/28/4
f 20/37/4 19/38/4 23/39/4 24/40/4
f 25/41/6 26/42/6 28/43/6 27/44/6
f 29/45/5 30/46/5 31/47/5 32/48/5
f 33/49/5 34/50/5 35/51/5 36/52/5
f 29/53/6 32/54/6 36/55/6 33/49/6
f 29/53/4 30/56/4 34/57/4 33/49/4
f 32/58/4 31/59/4 35/60/4 36/61/4
f 37/62/6 38/63/6 40/64/6 39/65/6
f 41/66/7 42/67/7 43/68/7 44/69/7
f 45/70/7 46/71/7 47/72/7 48/73/7
f 41/74/3 44/75/3 48/76/3 45/70/3
f 41/74/4 42/77/4 46/78/4 45/70/4
f 44/79/4 43/80/4 47/81/4 48/82/4
f 49/83/3 50/84/3 52/85/3 51/86/3
f 53/87/7 54/88/7 55/89/7 56/90/7
f 57/91/7 58/92/7 59/93/7 60/94/7
f 53/95/3 56/96/3 60/97/3 57/91/3
f 53/95/4 54/98/4 58/99/4 57/91/4
f 56/100/4 55/101/4 59/102/4 60/103/4
f 61/104/3 62/105/3 64/106/3 63/107/3
g nodebox3_nodebox3_none_NONE
f 9/108/7 10/109/7 11/110/7 12/111/7
f 13/12/7 14/16/7 15/112/7 16/113/7

@ -40,3 +40,19 @@ minetest.register_craft({
{ "group:tree", "group:tree", "group:tree" },
}
})
-- Register Visual Food Entity
minetest.register_entity("mcl_campfires:food_entity", {
initial_properties = {
physical = false,
visual = "wielditem",
wield_item = "mcl_mobitems:mutton",
wield_image = "mcl_mobitems_mutton_raw.png",
visual_size = {x=0.25, y=0.25},
collisionbox = {0,0,0,0,0,0},
pointable = false,
},
on_activate = function(self, staticdata)
self.object:set_rotation({x = math.pi / -2, y = 0, z = 0})
end,
})

@ -66,6 +66,12 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
if not minetest.is_creative_enabled("") then
stack:add_wear(65535/65) -- 65 uses
end
-- Ignite Campfire
elseif minetest.get_item_group(dropnode.name, "campfire") ~= 0 then
add_node(droppos, {name=dropnode.name.."_lit"})
if not minetest.is_creative_enabled("") then
stack:add_wear(65535/65) -- 65 uses
end
end
return stack
end,

@ -435,7 +435,7 @@ minetest.register_craftitem("mcl_fishing:fish_raw", {
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
stack_max = 64,
groups = { food=2, eatable = 2, smoker_cookable = 1 },
groups = { food=2, eatable = 2, smoker_cookable = 1, campfire_cookable = 1 },
_mcl_saturation = 0.4,
})
@ -465,7 +465,7 @@ minetest.register_craftitem("mcl_fishing:salmon_raw", {
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
stack_max = 64,
groups = { food=2, eatable = 2, smoker_cookable = 1 },
groups = { food=2, eatable = 2, smoker_cookable = 1, campfire_cookable = 1 },
_mcl_saturation = 0.4,
})

@ -20,7 +20,7 @@ minetest.register_craftitem("mcl_mobitems:mutton", {
wield_image = "mcl_mobitems_mutton_raw.png",
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2, smoker_cookable = 1 },
groups = { food = 2, eatable = 2, smoker_cookable = 1, campfire_cookable = 1 },
_mcl_saturation = 1.2,
stack_max = 64,
})
@ -44,7 +44,7 @@ minetest.register_craftitem("mcl_mobitems:beef", {
wield_image = "mcl_mobitems_beef_raw.png",
on_place = minetest.item_eat(3),
on_secondary_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
groups = { food = 2, eatable = 3, smoker_cookable = 1, campfire_cookable = 1 },
_mcl_saturation = 1.8,
stack_max = 64,
})
@ -69,7 +69,7 @@ minetest.register_craftitem("mcl_mobitems:chicken", {
wield_image = "mcl_mobitems_chicken_raw.png",
on_place = minetest.item_eat(2),
on_secondary_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2, smoker_cookable = 1 },
groups = { food = 2, eatable = 2, smoker_cookable = 1, campfire_cookable = 1 },
_mcl_saturation = 1.2,
stack_max = 64,
})
@ -93,7 +93,7 @@ minetest.register_craftitem("mcl_mobitems:porkchop", {
wield_image = "mcl_mobitems_porkchop_raw.png",
on_place = minetest.item_eat(3),
on_secondary_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
groups = { food = 2, eatable = 3, smoker_cookable = 1, campfire_cookable = 1 },
_mcl_saturation = 1.8,
stack_max = 64,
})
@ -117,7 +117,7 @@ minetest.register_craftitem("mcl_mobitems:rabbit", {
wield_image = "mcl_mobitems_rabbit_raw.png",
on_place = minetest.item_eat(3),
on_secondary_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3, smoker_cookable = 1 },
groups = { food = 2, eatable = 3, smoker_cookable = 1, campfire_cookable = 1 },
_mcl_saturation = 1.8,
stack_max = 64,
})

@ -969,7 +969,7 @@ end
function mcl_potions._extinguish_nearby_fire(pos, radius)
local epos = {x=pos.x, y=pos.y+0.5, z=pos.z}
local dnode = minetest.get_node({x=pos.x,y=pos.y-0.5,z=pos.z})
if minetest.get_item_group(dnode.name, "fire") ~= 0 then
if minetest.get_item_group(dnode.name, "fire") ~= 0 or minetest.get_item_group(dnode.name, "lit_campfire") ~= 0 then
epos.y = pos.y - 0.5
end
local exting = false
@ -989,6 +989,11 @@ function mcl_potions._extinguish_nearby_fire(pos, radius)
minetest.sound_play("fire_extinguish_flame", {pos = tpos, gain = 0.25, max_hear_distance = 16}, true)
minetest.remove_node(tpos)
exting = true
elseif minetest.get_item_group(node.name, "lit_campfire") ~= 0 then
minetest.sound_play("fire_extinguish_flame", {pos = tpos, gain = 0.25, max_hear_distance = 16}, true)
local def = minetest.registered_nodes[node.name]
minetest.set_node(tpos, {name = def._mcl_campfires_smothered_form, param2 = node.param2})
exting = true
end
end
-- Has radius: lingering, extinguish all nodes in area
@ -996,10 +1001,16 @@ function mcl_potions._extinguish_nearby_fire(pos, radius)
local nodes = minetest.find_nodes_in_area(
{x=epos.x-radius,y=epos.y,z=epos.z-radius},
{x=epos.x+radius,y=epos.y,z=epos.z+radius},
{"group:fire"})
{"group:fire", "group:lit_campfire"})
for n=1, #nodes do
local node = minetest.get_node(nodes[n])
minetest.sound_play("fire_extinguish_flame", {pos = nodes[n], gain = 0.25, max_hear_distance = 16}, true)
if minetest.get_item_group(node.name, "fire") ~= 0 then
minetest.remove_node(nodes[n])
elseif minetest.get_item_group(node.name, "lit_campfire") ~= 0 then
local def = minetest.registered_nodes[node.name]
minetest.set_node(nodes[n], {name = def._mcl_campfires_smothered_form, param2 = node.param2})
end
exting = true
end
end

@ -187,7 +187,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
itemstack:add_wear(wear)
end
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above, max_hear_distance = 16}, true)
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 623 B