forked from Sokomine/yl_speak_up
moved chat command npc_talk_style into own file
This commit is contained in:
parent
300d557a80
commit
74b024645b
35
command_npc_talk_style.lua
Normal file
35
command_npc_talk_style.lua
Normal file
@ -0,0 +1,35 @@
|
||||
-- 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
|
||||
})
|
||||
|
@ -1,39 +1,8 @@
|
||||
-- the formspec menu used for talking to the NPC can also used for
|
||||
-- the trading formspec and similar things
|
||||
|
||||
-- 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
|
||||
})
|
||||
|
||||
-- the chat command npc_talk_style found in command_npc_talk_style.lua
|
||||
-- can be used to switch formspec style.
|
||||
|
||||
|
||||
-- helper function for yl_speak_up.show_fs_decorated
|
||||
|
2
init.lua
2
init.lua
@ -40,6 +40,8 @@ dofile(modpath .. "interface_mobs_api.lua")
|
||||
dofile(modpath .. "show_fs.lua")
|
||||
-- general decoration part for main formspec, trade window etc.
|
||||
dofile(modpath .. "fs_decorated.lua")
|
||||
-- command for switching the formspec version of the player
|
||||
dofile(modpath .. "command_npc_talk_style.lua")
|
||||
-- the formspec and input handling for the main dialog
|
||||
dofile(modpath .. "fs_talkdialog.lua")
|
||||
-- ask if the player wants to save, discard or go back in edit mode
|
||||
|
Loading…
Reference in New Issue
Block a user