mirror of
git://repo.or.cz/minetest_hbhunger.git
synced 2025-07-04 07:30:24 +02:00
Compare commits
6 Commits
1.1.2
...
ad2dbf5647
Author | SHA1 | Date | |
---|---|---|---|
ad2dbf5647 | |||
d90513c22b | |||
1d78be907b | |||
235a8652eb | |||
9989c26c65 | |||
53df2c500b |
@ -1,6 +1,6 @@
|
|||||||
# Hunger with HUD bar [`hbhunger`]
|
# Hunger with HUD bar [`hbhunger`]
|
||||||
|
|
||||||
* Version: 1.1.2
|
* Version: 1.1.1
|
||||||
|
|
||||||
## Using the mod
|
## Using the mod
|
||||||
|
|
||||||
|
12
hunger.lua
12
hunger.lua
@ -79,24 +79,14 @@ function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound
|
|||||||
if h == nil or hp == nil then
|
if h == nil or hp == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if user:is_player() then
|
|
||||||
local object, object_pos
|
|
||||||
-- Check if user is a "fake player" (unofficial imitation of a the player data structure)
|
|
||||||
if type(user) == "userdata" then
|
|
||||||
object = user
|
|
||||||
else
|
|
||||||
object_pos = user:get_pos()
|
|
||||||
end
|
|
||||||
minetest.sound_play(
|
minetest.sound_play(
|
||||||
{name = sound or "hbhunger_eat_generic",
|
{name = sound or "hbhunger_eat_generic",
|
||||||
gain = 1},
|
gain = 1},
|
||||||
{object=object,
|
{object=user,
|
||||||
pos=object_pos,
|
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 16,
|
||||||
pitch = 1 + math.random(-10, 10)*0.005,},
|
pitch = 1 + math.random(-10, 10)*0.005,},
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
end
|
|
||||||
|
|
||||||
-- Saturation
|
-- Saturation
|
||||||
if h < hbhunger.SAT_MAX and hunger_change then
|
if h < hbhunger.SAT_MAX and hunger_change then
|
||||||
|
2
init.lua
2
init.lua
@ -186,3 +186,5 @@ minetest.register_chatcommand("satiation", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.log("action", "[hbhunger] loaded.")
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user