forked from minetest/minetest_game
Add support for MT 5 game translation (rebasing ) (#2466)
rebased #2368
This commit is contained in:
@ -1,6 +1,11 @@
|
||||
-- sethome/init.lua
|
||||
|
||||
sethome = {}
|
||||
|
||||
-- Load support for MT game translation.
|
||||
local S = minetest.get_translator("sethome")
|
||||
|
||||
|
||||
local homes_file = minetest.get_worldpath() .. "/homes"
|
||||
local homepos = {}
|
||||
|
||||
@ -68,30 +73,30 @@ sethome.go = function(name)
|
||||
end
|
||||
|
||||
minetest.register_privilege("home", {
|
||||
description = "Can use /sethome and /home",
|
||||
description = S("Can use /sethome and /home"),
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("home", {
|
||||
description = "Teleport you to your home point",
|
||||
description = S("Teleport you to your home point"),
|
||||
privs = {home = true},
|
||||
func = function(name)
|
||||
if sethome.go(name) then
|
||||
return true, "Teleported to home!"
|
||||
return true, S("Teleported to home!")
|
||||
end
|
||||
return false, "Set a home using /sethome"
|
||||
return false, S("Set a home using /sethome")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("sethome", {
|
||||
description = "Set your home point",
|
||||
description = S("Set your home point"),
|
||||
privs = {home = true},
|
||||
func = function(name)
|
||||
name = name or "" -- fallback to blank name if nil
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player and sethome.set(name, player:get_pos()) then
|
||||
return true, "Home set!"
|
||||
return true, S("Home set!")
|
||||
end
|
||||
return false, "Player not found!"
|
||||
return false, S("Player not found!")
|
||||
end,
|
||||
})
|
||||
|
Reference in New Issue
Block a user