yl_speak_up/command_npc_talk_style.lua

36 lines
1.4 KiB
Lua

-- change the formspec style used in fs_decorated.lua
-- because the player may have wandered off from his NPC and get too many messages
-- without a quick way to get rid of them otherwise
minetest.register_chatcommand( 'npc_talk_style', {
description = "This command sets your formspec version "..
"for the yl_speak_up NPC to value <version>.\n"..
" Version 1: For very old clients. Not recommended.\n"..
" Version 2: Adds extra scroll buttons. Perhaps you like this more.\n"..
" Version 3: Default version.",
privs = {},
func = function(pname, param)
-- set a default value
if(not(yl_speak_up.fs_version[pname])) then
yl_speak_up.fs_version[pname] = 3
end
if(param and param == "1") then
yl_speak_up.fs_version[pname] = 1
elseif(param and param == "2") then
yl_speak_up.fs_version[pname] = 2
elseif(param and param == "3") then
yl_speak_up.fs_version[pname] = 3
else
minetest.chat_send_player(pname, "This command sets your formspec version "..
"for the yl_speak_up NPC to value <version>.\n"..
" Version 1: For very old clients. Not recommended.\n"..
" Version 2: Adds extra scroll buttons.\n"..
" Version 3: Default (recommended) version.")
end
minetest.chat_send_player(pname, "Your formspec version for the yl_speak_up NPC "..
"has been set to version "..tostring(yl_speak_up.fs_version[pname])..
" for this session.")
end
})