Fix: marker not showing up (#23)

This commit is contained in:
Coder12a 2018-12-15 12:56:15 -06:00 committed by Billy S
parent 6130bbe487
commit f27dd81242

View File

@ -19,17 +19,17 @@ minetest.register_chatcommand("mrkr", {
end
if marker[name] then
player:hud_change(marker[name], "name", x .. ", " .. y .. ", " .. z)
player:hud_change(marker[name], "world_pos", {x = x, y = y, z = z})
else
marker[name] = player:hud_add({
hud_elem_type = "waypoint",
name = x .. ", " .. y .. ", " .. z,
number = 0xFF0000,
world_pos = {x = x, y = y, z = z}
})
player:hud_remove(marker[name])
marker[name] = nil
end
marker[name] = player:hud_add({
hud_elem_type = "waypoint",
name = x .. ", " .. y .. ", " .. z,
number = 0xFF0000,
world_pos = {x = x, y = y, z = z}
})
minetest.chat_send_player(name, "Marker set to: "..x..", "..y..", "..z)
return true
end
@ -55,3 +55,7 @@ minetest.register_chatcommand("marker",
minetest.registered_chatcommands["mrkr"])
minetest.register_chatcommand("clearmarker",
minetest.registered_chatcommands["clrmrkr"])
minetest.register_on_leaveplayer(function(player)
marker[player:get_player_name()] = nil
end)