Dialogues: added support for custom functions on multi-option dialogues.

Data: dialogues are now Lua tables indexed by numbers
This commit is contained in:
zorman2000
2016-12-04 09:30:25 -05:00
parent e89cd1e18d
commit f462e6af75
2 changed files with 62 additions and 26 deletions

View File

@ -11,40 +11,40 @@ npc.data.DIALOGUES = {
-- Female dialogue options defined by phase
-- Phase 1
npc.data.DIALOGUES.female["phase1"] = {
{
[1] = {
text = "Hello there!"
},
{
[2] = {
text = "How are you doing?"
},
{
[3] = {
text = "Hey, I haven't seen you before!"
},
{
[4] = {
text = "Just another day..."
},
{
[5] = {
text = "The weather is nice today"
},
{
[6] = {
text = "Hello! Have you been to the sea?",
responses = {
{
[1] = {
text = "No, never before",
action_type = "function",
action = function(player_name, item)
action = function(self, player_name)
minetest.chat_send_player(player_name, "Oh, never? How come! You should."..
"\nHere, take this. It will guide you to the sea...")
end
},
{
[2] = {
text = "Yes, sure",
action_type = "dialogue",
action = {
text = "It's so beautiful, and big, and large, and infinite, and..."
}
},
{
[3] = {
text = "Of course! And to all the seas in the world!",
action_type = "dialogue",
action = {
@ -58,39 +58,39 @@ npc.data.DIALOGUES.female["phase1"] = {
-- Male dialogue options defined by phase
-- Phase 1
npc.data.DIALOGUES.male["phase1"] = {
{
[1] = {
text = "Hello!"
},
{
[2] = {
text = "Welcome to our village, stranger."
},
{
[3] = {
text = "Just a great day to go to the woods..."
},
{
[4] = {
text = "Bah, stone! Useless stuff."
},
{
[5] = {
text = "What do you think of this weather?"
},
{
[6] = {
text = "Hello! Have you been to the sea?",
responses = {
{
[1] = {
text = "No, never before",
action_type = "function",
action = function(player_name, item)
action = function(npc, player_name)
minetest.chat_send_player(player_name, "Then you are not worth my time.")
end
},
{
[2] = {
text = "Yes, sure",
action_type = "dialogue",
action = {
text = "Then you should appreciate it as a great pirate of the seven seas do!"
}
},
{
[3] = {
text = "Of course! And to all the seas in the world!",
action_type = "dialogue",
action = {