mirror of
https://gitlab.com/rubenwardy/awards.git
synced 2024-11-22 15:23:44 +01:00
parent
4e6ade249e
commit
a5768efbc0
@ -12,15 +12,22 @@ minetest.register_chatcommand("awards", {
|
||||
S("All your awards and statistics have been cleared. You can now start again."))
|
||||
elseif param == "disable" then
|
||||
awards.disable(name)
|
||||
minetest.chat_send_player(name, S("You have disabled your achievements."))
|
||||
minetest.chat_send_player(name, S("You have disabled achievements."))
|
||||
elseif param == "enable" then
|
||||
awards.enable(name)
|
||||
minetest.chat_send_player(name, S("You have enabled your achievements."))
|
||||
minetest.chat_send_player(name, S("You have enabled achievements."))
|
||||
elseif param == "c" then
|
||||
awards.show_to(name, name, nil, true)
|
||||
else
|
||||
awards.show_to(name, name, nil, false)
|
||||
end
|
||||
|
||||
if (param == "disable" or param == "enable") and minetest.global_exists("sfinv") then
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
6
gui.lua
6
gui.lua
@ -166,7 +166,7 @@ function awards.show_to(name, to, sid, text)
|
||||
end
|
||||
local data = awards.player(to)
|
||||
if name == to and data.disabled then
|
||||
minetest.chat_send_player(S("You've disabled achievement. Type /awards enable to reenable."))
|
||||
minetest.chat_send_player(name, S("You've disabled achievements. Type /awards enable to reenable."))
|
||||
return
|
||||
end
|
||||
if text then
|
||||
@ -215,6 +215,10 @@ if minetest.get_modpath("sfinv") then
|
||||
on_enter = function(self, player, context)
|
||||
context.awards_idx = 1
|
||||
end,
|
||||
is_in_nav = function(self, player, context)
|
||||
local data = awards.player(player:get_player_name())
|
||||
return not data.disabled
|
||||
end,
|
||||
get = function(self, player, context)
|
||||
local name = player:get_player_name()
|
||||
return sfinv.make_formspec(player, context,
|
||||
|
Loading…
Reference in New Issue
Block a user