Update campfire rightclick and smothering
parent
61f489e71f
commit
23d6c3d17b
|
@ -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.
|
||||
|
|
|
@ -223,8 +223,11 @@ function mcl_campfires.register_campfire(name, def)
|
|||
minetest.set_node(pos, node)
|
||||
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16}, true)
|
||||
end
|
||||
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,
|
||||
on_timer = mcl_campfires.cook_item,
|
||||
drop = def.drops,
|
||||
|
@ -244,6 +247,7 @@ function mcl_campfires.register_campfire(name, def)
|
|||
damage_per_second = def.damage,
|
||||
on_blast = on_blast,
|
||||
after_dig_node = drop_items,
|
||||
_mcl_campfires_smothered_form = name,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
-- TO-DO:
|
||||
-- * Add Smoke Particles
|
||||
-- * Add Spark Particles
|
||||
-- * Add Cooking Meat
|
||||
-- * Add Working Sounds
|
||||
local modname = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue