added npc_talk_style command
This commit is contained in:
parent
430a1eae71
commit
058baca37b
11
README.md
11
README.md
@ -3,6 +3,17 @@ This mod allows to set RPG-like texts for NPC where the NPC "says" something
|
||||
to the player and the player can reply with a selection of given replies -
|
||||
which most of the time lead to the next dialog.
|
||||
|
||||
Chat commands
|
||||
=============
|
||||
|
||||
/npc_talk_style Allows to select the formspec version:
|
||||
1: Very rudamentary. Not recommended.
|
||||
2: Shows additional buttons for up and down.
|
||||
3: Default (recommended) version.
|
||||
|
||||
/npc_talk_debug Allows to debug dialogs.
|
||||
|
||||
|
||||
Terminology
|
||||
===========
|
||||
dialog A text said by the NPC, with diffrent replys the player can
|
||||
|
@ -481,16 +481,16 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
||||
owner_info = "\n\n(owned by "..minetest.formspec_escape(yl_speak_up.npc_owner[ n_id ])..")"
|
||||
end
|
||||
|
||||
local fs_version = 1
|
||||
if formspec_v >= 4 then
|
||||
fs_version = 3
|
||||
elseif formspec_v >= 2 then
|
||||
fs_version = 2
|
||||
else
|
||||
fs_version = 1
|
||||
end
|
||||
-- store which formspec version the player has
|
||||
if(not(yl_speak_up.fs_version[pname])) then
|
||||
local fs_version = yl_speak_up.fs_version[pname]
|
||||
if(not(fs_version)) then
|
||||
if formspec_v >= 4 then
|
||||
fs_version = 3
|
||||
elseif formspec_v >= 2 then
|
||||
fs_version = 2
|
||||
else
|
||||
fs_version = 1
|
||||
end
|
||||
-- store which formspec version the player has
|
||||
yl_speak_up.fs_version[pname] = fs_version
|
||||
end
|
||||
formspec = {
|
||||
@ -955,3 +955,32 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
||||
return table.concat(formspec, "")
|
||||
end
|
||||
|
||||
-- a chat command for entering and leaving debug mode; needs to be a chat command
|
||||
-- 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)
|
||||
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. Perhaps you like this more.\n"..
|
||||
" Version 3: Default 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
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user