Rename wool sound and add player_eat sounds
This commit is contained in:
parent
785666f4e4
commit
48ace403b4
@ -132,13 +132,13 @@ end
|
|||||||
function default.node_wool_defaults(table)
|
function default.node_wool_defaults(table)
|
||||||
table = table or {}
|
table = table or {}
|
||||||
table.footstep = table.footstep or
|
table.footstep = table.footstep or
|
||||||
{name = "wool_coat_movement", gain = 0.4}
|
{name = "default_wool_footstep", gain = 0.4}
|
||||||
table.dig = table.dig or
|
table.dig = table.dig or
|
||||||
{name = "wool_coat_movement", gain = 0.6}
|
{name = "default_wool_footstep", gain = 0.6}
|
||||||
table.dug = table.dug or
|
table.dug = table.dug or
|
||||||
{name = "wool_coat_movement", gain = 0.6}
|
{name = "default_wool_footstep", gain = 0.6}
|
||||||
table.place = table.place or
|
table.place = table.place or
|
||||||
{name = "default_place_node", gain = 1.0}
|
{name = "default_wool_footstep", gain = 1.0}
|
||||||
return table
|
return table
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -171,13 +171,12 @@ end
|
|||||||
-- food functions
|
-- food functions
|
||||||
local food = hunger.food
|
local food = hunger.food
|
||||||
|
|
||||||
function hunger.register_food(name, hunger_change, replace_with_item, poisen, heal, sound)
|
function hunger.register_food(name, hunger_change, replace_with_item, poisen, heal)
|
||||||
food[name] = {}
|
food[name] = {}
|
||||||
food[name].saturation = hunger_change -- hunger points added
|
food[name].saturation = hunger_change -- hunger points added
|
||||||
food[name].replace = replace_with_item -- what item is given back after eating
|
food[name].replace = replace_with_item -- what item is given back after eating
|
||||||
food[name].poisen = poisen -- time its poisening
|
food[name].poisen = poisen -- time its poisening
|
||||||
food[name].healing = heal -- amount of HP
|
food[name].healing = heal -- amount of HP
|
||||||
food[name].sound = sound -- special sound that is played when eating
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Poison player
|
-- Poison player
|
||||||
@ -220,11 +219,11 @@ function hunger.eat(hp_change, replace_with_item, itemstack, user, pointed_thing
|
|||||||
def.saturation = hp_change * 1.3
|
def.saturation = hp_change * 1.3
|
||||||
def.replace = replace_with_item
|
def.replace = replace_with_item
|
||||||
end
|
end
|
||||||
local func = hunger.item_eat(def.saturation, def.replace, def.poisen, def.healing, def.sound)
|
local func = hunger.item_eat(def.saturation, def.replace, def.poisen, def.healing)
|
||||||
return func(itemstack, user, pointed_thing)
|
return func(itemstack, user, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
function hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound)
|
function hunger.item_eat(hunger_change, replace_with_item, poisen, heal)
|
||||||
return function(itemstack, user, pointed_thing)
|
return function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
if itemstack:take_item() == nil and user == nil then
|
if itemstack:take_item() == nil and user == nil then
|
||||||
@ -256,10 +255,6 @@ function hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound)
|
|||||||
poisenp(1.0, poisen, 0, user)
|
poisenp(1.0, poisen, 0, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- eating sound
|
|
||||||
sound = sound or "hunger_eat"
|
|
||||||
minetest.sound_play(sound, {to_player = name, gain = 0.5})
|
|
||||||
|
|
||||||
if replace_with_item then
|
if replace_with_item then
|
||||||
if itemstack:is_empty() then
|
if itemstack:is_empty() then
|
||||||
itemstack:add_item(replace_with_item)
|
itemstack:add_item(replace_with_item)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user