Commit 5b28ce44 authored by TenPlus1's avatar TenPlus1
Browse files

Code tweak and tidy

parent 95079203
...@@ -139,7 +139,7 @@ minetest.register_globalstep(function(dtime) ...@@ -139,7 +139,7 @@ minetest.register_globalstep(function(dtime)
if main_timer > hbarmor.tick then -- or timer > 4 then if main_timer > hbarmor.tick then -- or timer > 4 then
if enable_damage then if enable_damage then
if main_timer > hbarmor.tick then main_timer = 0 end if main_timer > hbarmor.tick then main_timer = 0 end
for _,player in ipairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
if hbarmor.player_active[name] == true then if hbarmor.player_active[name] == true then
local ret = hbarmor.get_armor(player) local ret = hbarmor.get_armor(player)
......
...@@ -26,12 +26,10 @@ function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal) ...@@ -26,12 +26,10 @@ function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal)
local name = user:get_player_name() local name = user:get_player_name()
local h = tonumber(hbhunger.hunger[name]) local h = tonumber(hbhunger.hunger[name])
local hp = user:get_hp() local hp = user:get_hp()
minetest.sound_play({ minetest.sound_play("hbhunger_eat_generic", {
name = "hbhunger_eat_generic", object = user,
gain = 1 max_hear_distance = 10,
}, { gain = 1.0
pos = user:getpos(),
max_hear_distance = 16
}) })
-- Saturation -- Saturation
...@@ -177,7 +175,7 @@ if minetest.get_modpath("bushes_classic") then ...@@ -177,7 +175,7 @@ if minetest.get_modpath("bushes_classic") then
"raspberry", "raspberry",
"gooseberry", "gooseberry",
"mixed_berry"} "mixed_berry"}
for _, berry in ipairs(berries) do for _, berry in pairs(berries) do
if berry ~= "mixed_berry" then if berry ~= "mixed_berry" then
overwrite("bushes:"..berry, 1) overwrite("bushes:"..berry, 1)
end end
...@@ -340,6 +338,7 @@ if minetest.get_modpath("farming") and farming.mod == "redo" then ...@@ -340,6 +338,7 @@ if minetest.get_modpath("farming") and farming.mod == "redo" then
overwrite("farming:rhubarb", 1) overwrite("farming:rhubarb", 1)
overwrite("farming:rhubarb_pie", 6) overwrite("farming:rhubarb_pie", 6)
overwrite("farming:beans", 1) overwrite("farming:beans", 1)
overwrite("farming:grapes", 2)
end end
if minetest.get_modpath("kpgmobs") ~= nil then if minetest.get_modpath("kpgmobs") ~= nil then
...@@ -410,7 +409,12 @@ if minetest.get_modpath("xanadu") then ...@@ -410,7 +409,12 @@ if minetest.get_modpath("xanadu") then
overwrite("xanadu:bacon", 4) overwrite("xanadu:bacon", 4)
overwrite("xanadu:burger", 7) overwrite("xanadu:burger", 7)
overwrite("xanadu:fries", 6) overwrite("xanadu:fries", 6)
overwrite("xanadu:glass_wine", 2)
overwrite("xanadu:potato_salad", 8, "ethereal:bowl", nil, 2) overwrite("xanadu:potato_salad", 8, "ethereal:bowl", nil, 2)
overwrite("xanadu:gingerbread_man", 2)
overwrite("xanadu:taco", 4)
overwrite("mobs:clownfish_raw", 2)
overwrite("mobs:bluefish_raw", 2)
end end
-- player-action based hunger changes -- player-action based hunger changes
......
...@@ -118,7 +118,7 @@ minetest.register_globalstep(function(dtime) ...@@ -118,7 +118,7 @@ minetest.register_globalstep(function(dtime)
main_timer = 0 main_timer = 0
end end
for _,player in ipairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
local h = tonumber(hbhunger.hunger[name]) local h = tonumber(hbhunger.hunger[name])
......
...@@ -336,10 +336,22 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value) ...@@ -336,10 +336,22 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value)
return return
end end
--- ADDED THIS BIT
if not player then
print ("line 340 player nil")
return
end
local name = player:get_player_name() local name = player:get_player_name()
local hudtable = hb.get_hudtable(identifier) local hudtable = hb.get_hudtable(identifier)
local value_changed, max_changed = false, false local value_changed, max_changed = false, false
-- ADDED THIS TOO
if not hudtable.hudstate[name] then
print ("line 350 hudtabke.hudstate[name] nil")
return
end
if new_value ~= nil then if new_value ~= nil then
if new_value ~= hudtable.hudstate[name].value then if new_value ~= hudtable.hudstate[name].value then
hudtable.hudstate[name].value = new_value hudtable.hudstate[name].value = new_value
...@@ -415,7 +427,8 @@ end ...@@ -415,7 +427,8 @@ end
function hb.hide_hudbar(player, identifier) function hb.hide_hudbar(player, identifier)
local name = player:get_player_name() local name = player:get_player_name()
local hudtable = hb.get_hudtable(identifier) local hudtable = hb.get_hudtable(identifier)
if hudtable.hudstate[name].hidden == false then if hudtable.hudstate[name]
and hudtable.hudstate[name].hidden == false then
if hb.settings.bar_type == "progress_bar" then if hb.settings.bar_type == "progress_bar" then
if hudtable.hudids[name].icon ~= nil then if hudtable.hudids[name].icon ~= nil then
player:hud_change( player:hud_change(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment