Change “saturation” to “satiation”

This commit is contained in:
Wuzzy 2015-03-03 03:25:44 +01:00
parent e34e66a989
commit 71266f1dbb
2 changed files with 15 additions and 15 deletions

View File

@ -19,12 +19,12 @@ You can create a "hunger.conf" file to customize the properties of hunger for yo
About hunger About hunger
============ ============
This mod adds a hunger mechanic to the game. This mod adds a hunger mechanic to the game.
A new player starts with 20 saturation points out of 30. A new player starts with 20 satiation points out of 30.
Player actions like digging, placing and walking cause exhausion, which lower the player's Player actions like digging, placing and walking cause exhausion, which lower the player's
saturation. Also every 800 seconds you lose 1 saturation point without doing anything. satiation. Also every 800 seconds you lose 1 satiation point without doing anything.
If you are hungry (0 saturation) you will suffer damage and die in case you don't eat something. If you are hungry (0 satiation) you will suffer damage and die in case you don't eat something.
If your saturation is greater than 15, you will slowly regenerate health points. If your satiation is greater than 15, you will slowly regenerate health points.
Eating food will increase your saturation. Eating food will increase your satiation.
Important: Eating food will not directly increase your health anymore, as long as the food item Important: Eating food will not directly increase your health anymore, as long as the food item
is supported by this mod (see below). is supported by this mod (see below).
@ -56,8 +56,8 @@ Currently supported food:
- Simple mobs - Simple mobs
Examples: Examples:
Eating an apple (from the default Minetest game) increases your saturation by 2, Eating an apple (from the default Minetest game) increases your satiation by 2,
eating a bread (from the default Minetest game) increases your saturation by 4. eating a bread (from the default Minetest game) increases your satiation by 4.
License of textures: License of textures:

View File

@ -18,7 +18,7 @@ HUNGER_HUNGER_TICK = 800 -- time in seconds after that 1 hunger point is taken
HUNGER_EXHAUST_DIG = 3 -- exhaustion increased this value after digged node HUNGER_EXHAUST_DIG = 3 -- exhaustion increased this value after digged node
HUNGER_EXHAUST_PLACE = 1 -- exhaustion increased this value after placed HUNGER_EXHAUST_PLACE = 1 -- exhaustion increased this value after placed
HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected
HUNGER_EXHAUST_LVL = 160 -- at what exhaustion player saturation gets lowerd HUNGER_EXHAUST_LVL = 160 -- at what exhaustion player satiation gets lowerd
--load custom settings --load custom settings
@ -29,13 +29,13 @@ if set then
end end
local function custom_hud(player) local function custom_hud(player)
hb.init_hudbar(player, "saturation", hbhunger.get_hunger(player)) hb.init_hudbar(player, "satiation", hbhunger.get_hunger(player))
end end
dofile(minetest.get_modpath("hbhunger").."/hunger.lua") dofile(minetest.get_modpath("hbhunger").."/hunger.lua")
-- register saturation hudbar -- register satiation hudbar
hb.register_hudbar("saturation", 0xFFFFFF, "Saturation", { icon = "hbhunger_icon.png", bar = "hbhunger_bar.png" }, 20, 30, false) hb.register_hudbar("satiation", 0xFFFFFF, "Satiation", { icon = "hbhunger_icon.png", bar = "hbhunger_bar.png" }, 20, 30, false)
-- update hud elemtens if value has changed -- update hud elemtens if value has changed
local function update_hud(player) local function update_hud(player)
@ -45,7 +45,7 @@ local function update_hud(player)
local h = tonumber(hbhunger.hunger[name]) local h = tonumber(hbhunger.hunger[name])
if h_out ~= h then if h_out ~= h then
hbhunger.hunger_out[name] = h hbhunger.hunger_out[name] = h
hb.change_hudbar(player, "saturation", h) hb.change_hudbar(player, "satiation", h)
end end
end end
@ -109,15 +109,15 @@ minetest.register_globalstep(function(dtime)
local h = tonumber(hbhunger.hunger[name]) local h = tonumber(hbhunger.hunger[name])
local hp = player:get_hp() local hp = player:get_hp()
if timer > 4 then if timer > 4 then
-- heal player by 1 hp if not dead and saturation is > 15 (of 30) -- heal player by 1 hp if not dead and satiation is > 15 (of 30)
if h > 15 and hp > 0 and player:get_breath() > 0 then if h > 15 and hp > 0 and player:get_breath() > 0 then
player:set_hp(hp+1) player:set_hp(hp+1)
-- or damage player by 1 hp if saturation is < 2 (of 30) -- or damage player by 1 hp if satiation is < 2 (of 30)
elseif h <= 1 then elseif h <= 1 then
if hp-1 >= 0 then player:set_hp(hp-1) end if hp-1 >= 0 then player:set_hp(hp-1) end
end end
end end
-- lower saturation by 1 point after xx seconds -- lower satiation by 1 point after xx seconds
if timer2 > HUNGER_HUNGER_TICK then if timer2 > HUNGER_HUNGER_TICK then
if h > 0 then if h > 0 then
h = h-1 h = h-1