Fix hud and /setspawn, update credits, fix crashes

master
MoNTE48 2019-06-16 09:16:39 +02:00
parent e11a78243b
commit 5d1c3abe6d
6 changed files with 14 additions and 12 deletions

View File

@ -1023,12 +1023,12 @@ minetest.register_chatcommand("setspawn", {
return false, "Player not found"
end
local pos = player:get_pos()
local x = pos.x
local y = pos.y
local z = pos.z
local x = math.floor(pos.x)
local y = math.floor(pos.y)
local z = math.floor(pos.z)
local pos_string = x..","..y..","..z
local pos_string_2 = "Setting spawn point to ("..x..", "..y..", "..z..")"
minetest.setting_set("static_spawnpoint",pos_string)
minetest.setting_set("static_spawnpoint", pos_string)
spawn_spawnpos = pos
minetest.setting_save()
return true, pos_string_2

View File

@ -15,10 +15,9 @@
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
hud = {}
hud, hud_id = {}, {}
-- keep id handling internal
local hud_id = {} -- hud item ids
local sb_bg = {} -- statbar background ids
-- localize often used table

View File

@ -53,7 +53,7 @@ local function initialize_builtin_statbars(player)
if player:hud_get_flags().healthbar and enable_damage then
if hud_ids[name].id_healthbar == nil then
health_bar_definition.number = player:get_hp()
hud_ids[name].id_healthbar = player:hud_add(health_bar_definition)
hud_ids[name].id_healthbar = player:hud_add(health_bar_definition)
end
else
if hud_ids[name].id_healthbar ~= nil then
@ -94,7 +94,7 @@ local function cleanup_builtin_statbars(player)
hud_ids[name] = nil
end
local function player_event_handler(player,eventname)
local function player_event_handler(player, eventname)
assert(player:is_player())
local name = player:get_player_name()
@ -106,7 +106,7 @@ local function player_event_handler(player,eventname)
if eventname == "health_changed" then
initialize_builtin_statbars(player)
if hud_ids[name].id_healthbar ~= nil then
if hud_id[name.."_".."health"] ~= nil then
hud.change_item(player, "health", {number = player:get_hp()})
return true
end
@ -166,7 +166,6 @@ function core.hud_replace_builtin(name, definition)
return false
end
core.register_on_joinplayer(initialize_builtin_statbars)
core.register_on_leaveplayer(cleanup_builtin_statbars)
core.register_playerevent(player_event_handler)
@ -187,6 +186,7 @@ local function add_text(player)
end
core.register_on_joinplayer(function(player)
initialize_builtin_statbars(player)
core.after(1, add_text, player)
end)

View File

@ -23,7 +23,7 @@ local multicraft_developers = {
"Alexander Zavrin (Ransom.00)",
"sfan5 <sfan5@live.de>",
"Stuart Jones (stujones11) <stujones111@gmail.com>",
"paramat",
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
"And other people who helped make the world better!",
}

View File

@ -144,6 +144,9 @@ function doors:register_door(name, def)
if not def.only_placer_can_open then
return true
end
if not player then
return
end
local meta = minetest.get_meta(pos)
local pn = player:get_player_name()
return meta:get_string("doors_owner") == pn

View File

@ -259,7 +259,7 @@ function workbench.on_take(pos, listname, index, stack, player)
local stackname = stack:get_name()
if listname == "input" then
if stackname == inputname and registered_nodes[inputname.."_cube"] then
if stackname == inputname and minetest.registered_nodes[inputname.."_cube"] then
workbench:get_output(inv, input, stackname)
else
inv:set_list("forms", {})