Now compatible with "sethome"

"sethome" mod commands will be overriden: they will have "intllib" support!
This commit is contained in:
Panquesito7 2019-08-19 18:55:12 -05:00 committed by GitHub
parent 39706ebc13
commit 632f4996fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -862,3 +862,32 @@ else
func = enhanced_builtin_commands.do_help_cmd,
})
end
-- Minetest Game commands
if minetest.get_modpath("sethome") then
core.override_chatcommand("home", {
description = S("Teleport you to your home point"),
privs = {home = true},
func = function(name)
if sethome.go(name) then
return true, S("Teleported to home!")
end
return false, S("Set a home using /sethome")
end,
})
core.override_chatcommand("sethome", {
description = S("Set your home point"),
privs = {home = true},
func = function(name)
name = name or "" -- fallback to blank name if nil
local player = core.get_player_by_name(name)
if player and sethome.set(name, player:get_pos()) then
return true, S("Home set!")
end
return false, S("Player not found!")
end,
})
else
return
end