allowed export/import without editor/

This commit is contained in:
Sokomine 2024-02-13 03:04:57 +01:00
parent 71e08eac08
commit d52aa2e5cb
5 changed files with 20 additions and 2 deletions

View File

@ -137,7 +137,5 @@ yl_speak_up.add_to_command_help_text = yl_speak_up.add_to_command_help_text..
dofile(modpath .. "chat_commands_in_edit_mode.lua")
-- creating and maintaining quests
dofile(modpath .. "fs/fs_quest_gui.lua")
-- export dialog for cut&paste in .json format
dofile(modpath .. "fs/fs_export.lua")
-- take notes regarding what the NPC is for
dofile(modpath .. "fs/fs_notes.lua")

View File

@ -17,6 +17,11 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
return
end
if(fields.button_export_dialog) then
yl_speak_up.show_fs(player, "export")
return
end
if(fields.edit_skin and fields.edit_skin ~= "") then
yl_speak_up.show_fs(player, "fashion")
return

View File

@ -109,6 +109,9 @@ yl_speak_up.get_fs_export = function(player, param)
local n_id = yl_speak_up.speak_to[pname].n_id
-- generic dialogs are not part of the NPC
local dialog = yl_speak_up.speak_to[pname].dialog
if(not(yl_speak_up.may_edit_npc(player, n_id))) then
return ""
end
local text = ""
if(not(minetest.check_player_privs(pname, {privs=true}))) then
text = "You lack the \"privs\" priv that is required in order to import NPC data."

View File

@ -16,6 +16,11 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
return
end
if(fields.button_export_dialog) then
yl_speak_up.show_fs(player, "export")
return
end
if((not(fields.save_initial_config)
and not(fields.show_nametag)
) or (fields and fields.exit)) then
@ -206,6 +211,10 @@ yl_speak_up.get_fs_initial_config = function(player, n_id, d_id, is_initial_conf
"label[0.2,0.5;",
tmp_text,
"]",
"button[9.0,0.2;1.8,0.9;button_export_dialog;Export]",
"tooltip[button_export_dialog;"..
"Export: Show the dialog in .json format which you can"..
"\n\tcopy and store on your computer.]",
-- name of the npc
"checkbox[2.2,0.9;show_nametag;;",
tostring(tmp_show_nametag),

View File

@ -223,6 +223,9 @@ yl_speak_up.reload = function(modpath, log_entry)
-- only gets loaded if mobs_redo (mobs) exists as mod
dofile(modpath .. "interface_mobs_api.lua")
-- export dialog for cut&paste in .json format
dofile(modpath .. "fs/fs_export.lua")
dofile(modpath .. "editor/edit_mode.lua")
-- initialize and load all registered generic dialogs