[PLAYER/pyutest_home] Add listhomes command and output to sethome
command
This commit is contained in:
@@ -13,7 +13,9 @@ minetest.register_chatcommand("sethome", {
|
||||
description = "Sets the position of home <NAME>",
|
||||
func = function (name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
homes[name][param] = player:get_pos()
|
||||
local pos = player:get_pos()
|
||||
homes[name][param] = pos
|
||||
return true, string.format("Set home `%s` position to (%d, %d, %d)", param, pos.x, pos.y, pos.z)
|
||||
end
|
||||
})
|
||||
|
||||
@@ -26,6 +28,16 @@ minetest.register_chatcommand("tphome", {
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("listhomes", {
|
||||
description = "Lists all your homes",
|
||||
func = function (name)
|
||||
for k, v in pairs(homes[name]) do
|
||||
minetest.chat_send_player(name, string.format("%s - (%d, %d, %d)", k, v.x, v.y, v.z))
|
||||
end
|
||||
return true, "Listed all homes"
|
||||
end
|
||||
})
|
||||
|
||||
local function save_data()
|
||||
storage:set_string("player_homes", minetest.serialize(homes))
|
||||
end
|
||||
|
Reference in New Issue
Block a user