forked from your-land-mirror/yl_speak_up
made the old fashion formspec fashion_extended for wielded items
This commit is contained in:
parent
fe4eb48822
commit
42e16d0e8b
@ -27,7 +27,6 @@ yl_speak_up.talk_after_spawn = true
|
|||||||
yl_speak_up.mesh_data = {}
|
yl_speak_up.mesh_data = {}
|
||||||
yl_speak_up.mesh_data["error"] = {
|
yl_speak_up.mesh_data["error"] = {
|
||||||
texture_index = 1,
|
texture_index = 1,
|
||||||
-- TODO: actually handle that and call the right formspec
|
|
||||||
can_show_wielded_items = false,
|
can_show_wielded_items = false,
|
||||||
skin_preview = yl_speak_up.skin_preview_normal,
|
skin_preview = yl_speak_up.skin_preview_normal,
|
||||||
}
|
}
|
||||||
@ -65,7 +64,7 @@ yl_speak_up.mob_skins["mobs_npc:trader"] = {
|
|||||||
|
|
||||||
-- this here uses 64 x 64 textures:
|
-- this here uses 64 x 64 textures:
|
||||||
yl_speak_up.mob_skins["yl_speak_up:human"] = {
|
yl_speak_up.mob_skins["yl_speak_up:human"] = {
|
||||||
"yl_speak_up_main_default.png"}
|
"yl_speak_up_main_default.png", "some_skin.png", "2022_06_28_the-lonley-lumberjack-20494635.png"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,6 +328,13 @@ yl_speak_up.input_fashion = function(player, formname, fields)
|
|||||||
local mesh = yl_speak_up.get_mesh(pname)
|
local mesh = yl_speak_up.get_mesh(pname)
|
||||||
local texture_index = yl_speak_up.mesh_data[mesh].texture_index
|
local texture_index = yl_speak_up.mesh_data[mesh].texture_index
|
||||||
|
|
||||||
|
-- show extra formspec with wielded item configuration and cape setup
|
||||||
|
if(fields.button_config_wielded_items
|
||||||
|
and yl_speak_up.mesh_data[mesh].can_show_wielded_items) then
|
||||||
|
yl_speak_up.show_fs(player, "fashion_extended")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- which skins are available? this depends on mob_type
|
-- which skins are available? this depends on mob_type
|
||||||
local mob_type = yl_speak_up.get_mob_type(pname)
|
local mob_type = yl_speak_up.get_mob_type(pname)
|
||||||
local skins = yl_speak_up.mob_skins[mob_type]
|
local skins = yl_speak_up.mob_skins[mob_type]
|
||||||
@ -392,9 +399,9 @@ yl_speak_up.input_fashion = function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- TODO: make use of this somehow
|
-- set what the NPC shall wield and which cape to wear
|
||||||
yl_speak_up.input_fashion_extended = function(player, formname, fields)
|
yl_speak_up.input_fashion_extended = function(player, formname, fields)
|
||||||
if formname ~= "yl_speak_up:fashion" then
|
if formname ~= "yl_speak_up:fashion_extended" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -412,14 +419,7 @@ yl_speak_up.input_fashion_extended = function(player, formname, fields)
|
|||||||
-- catch ESC as well
|
-- catch ESC as well
|
||||||
if(not(fields) or (fields.quit or fields.button_cancel or fields.button_exit)) then
|
if(not(fields) or (fields.quit or fields.button_cancel or fields.button_exit)) then
|
||||||
yl_speak_up.fashion_wield_give_items_back(player, pname)
|
yl_speak_up.fashion_wield_give_items_back(player, pname)
|
||||||
yl_speak_up.show_fs(player, "talk", {n_id = yl_speak_up.speak_to[pname].n_id,
|
yl_speak_up.show_fs(player, "fashion")
|
||||||
d_id = yl_speak_up.speak_to[pname].d_id})
|
|
||||||
return
|
|
||||||
|
|
||||||
-- normal skins for NPC - without wielded items or capes etc.
|
|
||||||
-- TODO add a back button to get back to the normal formspec
|
|
||||||
elseif(true) then
|
|
||||||
yl_speak_up.input_fashion_normal(player, formname, fields)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
elseif(fields.button_wield_left
|
elseif(fields.button_wield_left
|
||||||
@ -606,6 +606,13 @@ yl_speak_up.get_fs_fashion = function(pname)
|
|||||||
"The NPC will wear the skin he wore before you started changing it.",
|
"The NPC will wear the skin he wore before you started changing it.",
|
||||||
"On a second throught - Keep your old skin. It was fine.",
|
"On a second throught - Keep your old skin. It was fine.",
|
||||||
(skin ~= old_texture), nil, nil, nil)
|
(skin ~= old_texture), nil, nil, nil)
|
||||||
|
h = yl_speak_up.add_edit_button_fs_talkdialog(formspec, h,
|
||||||
|
"button_config_wielded_items",
|
||||||
|
"What shall the NPC wield, and which cape shall he wear?",
|
||||||
|
"I'll tell you what you shall wield.",
|
||||||
|
(yl_speak_up.mesh_data[mesh].can_show_wielded_items),
|
||||||
|
"You don't know how to show wielded items. Thus, we can't configure them.",
|
||||||
|
nil, nil)
|
||||||
return yl_speak_up.show_fs_decorated(pname, true, h,
|
return yl_speak_up.show_fs_decorated(pname, true, h,
|
||||||
"",
|
"",
|
||||||
left_window,
|
left_window,
|
||||||
|
@ -22,6 +22,9 @@ minetest.register_on_player_receive_fields( function(player, formname, fields)
|
|||||||
elseif formname == "yl_speak_up:fashion" then
|
elseif formname == "yl_speak_up:fashion" then
|
||||||
yl_speak_up.input_fashion(player, formname, fields)
|
yl_speak_up.input_fashion(player, formname, fields)
|
||||||
return true
|
return true
|
||||||
|
elseif formname == "yl_speak_up:fashion_extended" then
|
||||||
|
yl_speak_up.input_fashion_extended(player, formname, fields)
|
||||||
|
return true
|
||||||
-- handled in fs_properties.lua
|
-- handled in fs_properties.lua
|
||||||
elseif formname == "yl_speak_up:properties" then
|
elseif formname == "yl_speak_up:properties" then
|
||||||
yl_speak_up.input_properties(player, formname, fields)
|
yl_speak_up.input_properties(player, formname, fields)
|
||||||
@ -252,6 +255,10 @@ yl_speak_up.show_fs = function(player, fs_name, param)
|
|||||||
yl_speak_up.show_fs_ver(pname, "yl_speak_up:fashion",
|
yl_speak_up.show_fs_ver(pname, "yl_speak_up:fashion",
|
||||||
yl_speak_up.get_fs_fashion(pname))
|
yl_speak_up.get_fs_fashion(pname))
|
||||||
|
|
||||||
|
elseif(fs_name == "fashion_extended") then
|
||||||
|
yl_speak_up.show_fs_ver(pname, "yl_speak_up:fashion_extended",
|
||||||
|
yl_speak_up.get_fs_fashion_extended(pname))
|
||||||
|
|
||||||
elseif(fs_name == "properties") then
|
elseif(fs_name == "properties") then
|
||||||
if(not(param)) then
|
if(not(param)) then
|
||||||
param = {}
|
param = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user