forked from MineClone5/MineClone5
Remove food particles for eating a cake
This commit is contained in:
parent
d798df0742
commit
bbf7efc338
|
@ -49,6 +49,8 @@ minetest.register_node("mcl_cake:cake", {
|
||||||
minetest.add_node(pos,{type="node",name="mcl_cake:cake_5",param2=0})
|
minetest.add_node(pos,{type="node",name="mcl_cake:cake_5",param2=0})
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
_food_particles = false,
|
||||||
})
|
})
|
||||||
minetest.register_node("mcl_cake:cake_5", {
|
minetest.register_node("mcl_cake:cake_5", {
|
||||||
description = "Cake (5 Slices Left)",
|
description = "Cake (5 Slices Left)",
|
||||||
|
@ -71,6 +73,8 @@ minetest.register_node("mcl_cake:cake_5", {
|
||||||
minetest.add_node(pos,{type="node",name="mcl_cake:cake_4",param2=0})
|
minetest.add_node(pos,{type="node",name="mcl_cake:cake_4",param2=0})
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
_food_particles = false,
|
||||||
})
|
})
|
||||||
minetest.register_node("mcl_cake:cake_4", {
|
minetest.register_node("mcl_cake:cake_4", {
|
||||||
description = "Cake (4 Slices Left)",
|
description = "Cake (4 Slices Left)",
|
||||||
|
@ -93,6 +97,8 @@ minetest.register_node("mcl_cake:cake_4", {
|
||||||
minetest.add_node(pos,{type="node",name="mcl_cake:cake_3",param2=0})
|
minetest.add_node(pos,{type="node",name="mcl_cake:cake_3",param2=0})
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
_food_particles = false,
|
||||||
})
|
})
|
||||||
minetest.register_node("mcl_cake:cake_3", {
|
minetest.register_node("mcl_cake:cake_3", {
|
||||||
description = "Cake (3 Slices Left)",
|
description = "Cake (3 Slices Left)",
|
||||||
|
@ -115,6 +121,8 @@ minetest.register_node("mcl_cake:cake_3", {
|
||||||
minetest.add_node(pos,{type="node",name="mcl_cake:cake_2",param2=0})
|
minetest.add_node(pos,{type="node",name="mcl_cake:cake_2",param2=0})
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
_food_particles = false,
|
||||||
})
|
})
|
||||||
minetest.register_node("mcl_cake:cake_2", {
|
minetest.register_node("mcl_cake:cake_2", {
|
||||||
description = "Cake (2 Slices Left)",
|
description = "Cake (2 Slices Left)",
|
||||||
|
@ -137,6 +145,8 @@ minetest.register_node("mcl_cake:cake_2", {
|
||||||
minetest.add_node(pos,{type="node",name="mcl_cake:cake_1",param2=0})
|
minetest.add_node(pos,{type="node",name="mcl_cake:cake_1",param2=0})
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
_food_particles = false,
|
||||||
})
|
})
|
||||||
minetest.register_node("mcl_cake:cake_1", {
|
minetest.register_node("mcl_cake:cake_1", {
|
||||||
description = "Cake (1 Slice Left)",
|
description = "Cake (1 Slice Left)",
|
||||||
|
@ -159,4 +169,6 @@ minetest.register_node("mcl_cake:cake_1", {
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
_food_particles = false,
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
# API information (WIP)
|
||||||
|
This API information is WIP. The mod API is still pretty much unofficial;
|
||||||
|
this mod is mostly seen as standalone for now.
|
||||||
|
This may change in the future development of MineClone 2. Hopefully.
|
||||||
|
|
||||||
|
## Groups
|
||||||
|
Items in group `food=3` will make a drinking sound and no particles.
|
||||||
|
Items in group `food` with any other rating will make an eating sound and particles,
|
||||||
|
based on the inventory image or wield image (whatever is available first).
|
||||||
|
|
||||||
|
## Suppressing food particles
|
||||||
|
Normally, all food items considered food (not drinks) make food particles.
|
||||||
|
You can suppress the food particles by adding the field
|
||||||
|
`_food_particles=false` to the item definition.
|
|
@ -93,11 +93,14 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
|
||||||
else
|
else
|
||||||
-- Assume the item is a food
|
-- Assume the item is a food
|
||||||
-- Add eat particle effect and sound
|
-- Add eat particle effect and sound
|
||||||
local texture = minetest.registered_items[itemname].inventory_image
|
local def = minetest.registered_items[itemname]
|
||||||
|
local texture = def.inventory_image
|
||||||
if not texture or texture == "" then
|
if not texture or texture == "" then
|
||||||
texture = minetest.registered_items[itemname].wield_image
|
texture = def.wield_image
|
||||||
end
|
end
|
||||||
if texture and texture ~= "" then
|
-- Special item definition field: _food_particles
|
||||||
|
-- If false, force item to not spawn any food partiles when eaten
|
||||||
|
if def._food_particles ~= false and texture and texture ~= "" then
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 20,
|
amount = 20,
|
||||||
time = 0.1,
|
time = 0.1,
|
||||||
|
|
Loading…
Reference in New Issue