display adding quest locations
This commit is contained in:
parent
2183c1af32
commit
36ed71ae56
@ -131,7 +131,7 @@ yl_speak_up.input_fs_add_quest_steps = function(player, formname, fields)
|
|||||||
local mode = yl_speak_up.speak_to[pname].quest_step_mode
|
local mode = yl_speak_up.speak_to[pname].quest_step_mode
|
||||||
if(fields.back) then
|
if(fields.back) then
|
||||||
-- go back to quest overview
|
-- go back to quest overview
|
||||||
if(mode and mode == "manage_quest_npcs") then
|
if(mode and (mode == "manage_quest_npcs" or mode == "manage_quest_locations")) then
|
||||||
return yl_speak_up.show_fs(player, "manage_quests")
|
return yl_speak_up.show_fs(player, "manage_quests")
|
||||||
end
|
end
|
||||||
return yl_speak_up.show_fs(player, "manage_quest_steps", current_step)
|
return yl_speak_up.show_fs(player, "manage_quest_steps", current_step)
|
||||||
@ -365,7 +365,8 @@ yl_speak_up.quest_npc_show_table = function(formspec, table_specs, liste, step_d
|
|||||||
-- the n_id of the NPC
|
-- the n_id of the NPC
|
||||||
table.insert(tmp, "#AAFFAA")
|
table.insert(tmp, "#AAFFAA")
|
||||||
if(is_location_list) then
|
if(is_location_list) then
|
||||||
table.insert(tmp, n_id) -- this already encodes the position
|
-- this already encodes the position but contains , and ()
|
||||||
|
table.insert(tmp, minetest.formspec_escape(n_id))
|
||||||
else
|
else
|
||||||
table.insert(tmp, "n_"..minetest.formspec_escape(n_id))
|
table.insert(tmp, "n_"..minetest.formspec_escape(n_id))
|
||||||
end
|
end
|
||||||
@ -403,8 +404,7 @@ yl_speak_up.quest_get_location_candidate_list = function(pname, quest_location_l
|
|||||||
and table.indexof(quest_location_liste or {}, n_id) == -1
|
and table.indexof(quest_location_liste or {}, n_id) == -1
|
||||||
-- and only those that the player can edit
|
-- and only those that the player can edit
|
||||||
and (v.owner == pname or (v.may_edit and v.may_edit[pname]))) then
|
and (v.owner == pname or (v.may_edit and v.may_edit[pname]))) then
|
||||||
table.insert(location_list, k)
|
table.insert(location_list, n_id)
|
||||||
minetest.chat_send_player("singleplayer", "candidate: "..tostring(n_id))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(location_list)
|
table.sort(location_list)
|
||||||
@ -442,6 +442,8 @@ yl_speak_up.get_fs_add_quest_steps = function(player, param)
|
|||||||
local add_what = "Add a new quest step named:"
|
local add_what = "Add a new quest step named:"
|
||||||
if(mode == "manage_quest_npcs") then
|
if(mode == "manage_quest_npcs") then
|
||||||
add_what = "Add the NPC with n_<id>:"
|
add_what = "Add the NPC with n_<id>:"
|
||||||
|
elseif(mode == "manage_quest_locations") then
|
||||||
|
add_what = "Add a location by entering its ID directly:"
|
||||||
end
|
end
|
||||||
|
|
||||||
local formspec = {}
|
local formspec = {}
|
||||||
@ -537,17 +539,36 @@ yl_speak_up.get_fs_add_quest_steps = function(player, param)
|
|||||||
yl_speak_up.quest_npc_show_table(formspec,
|
yl_speak_up.quest_npc_show_table(formspec,
|
||||||
"0.2,0.2;17.0,3.0;delete_from_npc_list;",
|
"0.2,0.2;17.0,3.0;delete_from_npc_list;",
|
||||||
res.quest.npcs or {},
|
res.quest.npcs or {},
|
||||||
step_data)
|
step_data, false)
|
||||||
table.insert(formspec, "label[0.2,3.4;(Click on an entry to delete it from the list above.)]")
|
table.insert(formspec, "label[0.2,3.4;(Click on an entry to delete it from the list above.)]")
|
||||||
local available_npcs = yl_speak_up.quest_get_npc_candidate_list(pname, res.quest.npcs or {})
|
local available_npcs = yl_speak_up.quest_get_npc_candidate_list(pname, res.quest.npcs or {})
|
||||||
yl_speak_up.speak_to[pname].list_available = available_npcs
|
yl_speak_up.speak_to[pname].list_available = available_npcs
|
||||||
table.insert(formspec, "label[0.2,4.4;or select an NPC from the list below:]")
|
table.insert(formspec, "label[0.2,4.4;or select an NPC from the list below:]")
|
||||||
yl_speak_up.quest_npc_show_table(formspec,
|
yl_speak_up.quest_npc_show_table(formspec,
|
||||||
"0.2,4.6;17.0,6.0;add_to_npc_list;",
|
"0.2,4.6;17.0,6.0;add_to_npc_list;",
|
||||||
available_npcs or {}, step_data)
|
available_npcs or {}, step_data, false)
|
||||||
table.insert(formspec, "label[0.2,10.8;Used: Shows in how many quest steps this NPC is used.]")
|
table.insert(formspec, "label[0.2,10.8;Used: Shows in how many quest steps this NPC is used.]")
|
||||||
table.insert(formspec, "container_end[]")
|
table.insert(formspec, "container_end[]")
|
||||||
y_pos = 4.2
|
return table.concat(formspec, "")
|
||||||
|
-- which locations may contribute to the quest?
|
||||||
|
elseif(mode == "manage_quest_locations") then
|
||||||
|
table.insert(formspec, "container[0,3.3;18,6]")
|
||||||
|
table.insert(formspec, "label[0.2,0;so that the location "..
|
||||||
|
minetest.colorize("#9999FF", "may contribute")..
|
||||||
|
" to the quest like these locations:]")
|
||||||
|
yl_speak_up.quest_npc_show_table(formspec,
|
||||||
|
"0.2,0.2;17.0,3.0;delete_from_location_list;",
|
||||||
|
res.quest.locations or {},
|
||||||
|
step_data, true)
|
||||||
|
table.insert(formspec, "label[0.2,3.4;(Click on an entry to delete it from the list above.)]")
|
||||||
|
local available_locations = yl_speak_up.quest_get_location_candidate_list(pname, res.quest.locations or {})
|
||||||
|
yl_speak_up.speak_to[pname].list_available = available_locations
|
||||||
|
table.insert(formspec, "label[0.2,4.4;or select a location from the list below:]")
|
||||||
|
yl_speak_up.quest_npc_show_table(formspec,
|
||||||
|
"0.2,4.6;17.0,6.0;add_to_location_list;",
|
||||||
|
available_locations or {}, step_data, true)
|
||||||
|
table.insert(formspec, "label[0.2,10.8;Used: Shows in how many quest steps this location is used.]")
|
||||||
|
table.insert(formspec, "container_end[]")
|
||||||
return table.concat(formspec, "")
|
return table.concat(formspec, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,8 +51,10 @@ yl_speak_up.input_fs_manage_quests = function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- show and edit NPCs that may contribute
|
-- show and edit NPCs that may contribute
|
||||||
if(fields and fields.edit_npcs) then
|
if( fields and fields.edit_npcs) then
|
||||||
return yl_speak_up.show_fs(player, "add_quest_steps", "manage_quest_npcs")
|
return yl_speak_up.show_fs(player, "add_quest_steps", "manage_quest_npcs")
|
||||||
|
elseif(fields and fields.edit_locations) then
|
||||||
|
return yl_speak_up.show_fs(player, "add_quest_steps", "manage_quest_locations")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- show a particular quest step from the start/unconnected/end list?
|
-- show a particular quest step from the start/unconnected/end list?
|
||||||
|
Loading…
Reference in New Issue
Block a user