Created
March 7, 2020 17:17
-
-
Save appgurueu/79fee6fa43f802907f7b34b3dba05163 to your computer and use it in GitHub Desktop.
Minetest Waypoint Testmod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use this to test waypoint capabilities | |
minetest.register_chatcommand( | |
"test_waypoints", | |
{ | |
description = "tests waypoint capabilities", | |
func = function(name) | |
local player = minetest.get_player_by_name(name) | |
minetest.chat_send_all( | |
"regular: " .. | |
player:hud_add { | |
hud_elem_type = "waypoint", | |
name = "regular waypoint", | |
text = "m", | |
number = 0xFF0000, | |
world_pos = vector.add(player:get_pos(), {x = 0, y = 2, z = 0}) | |
} | |
) | |
minetest.chat_send_all( | |
"reduced precision: " .. | |
player:hud_add { | |
hud_elem_type = "waypoint", | |
name = "better waypoint", | |
text = "m (0.5 steps, precision = 2)", | |
precision = 2, | |
number = 0xFFFF00, | |
world_pos = vector.add(player:get_pos(), {x = 0, y = 1, z = 0}) | |
} | |
) | |
minetest.chat_send_all( | |
"hidden distance: " .. | |
player:hud_add { | |
hud_elem_type = "waypoint", | |
name = "waypoint with hidden distance", | |
text = "this text is hidden as well (precision = 0)", | |
precision = 0, | |
number = 0x0000FF, | |
world_pos = vector.add(player:get_pos(), {x = 0, y = 0.5, z = 0}) | |
} | |
) | |
minetest.chat_send_all( | |
"image: " .. | |
player:hud_add { | |
hud_elem_type = "image_waypoint", | |
text = "wieldhand.png", | |
world_pos = player:get_pos(), | |
scale = {x = 10, y = 10}, | |
offset = {x = 0, y = -32} | |
} | |
) | |
end | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment