moved add_trade_simple in editor/ into fs/ subfolder

This commit is contained in:
Sokomine 2024-02-10 00:00:33 +01:00
parent c0c3cae460
commit 7482061868
3 changed files with 32 additions and 33 deletions

View File

@ -148,6 +148,7 @@ yl_speak_up.add_to_command_help_text = yl_speak_up.add_to_command_help_text..
-- -- trade one item(stack) against one other item(stack)
-- dofile(modpath .. "api/api_trade_inv.lua")
dofile(modpath .. "trade_in_edit_mode.lua")
dofile(modpath .. "fs/fs_add_trade_simple_in_edit_mode.lua")
-- dofile(modpath .. "fs/fs_do_trade_simple.lua")
-- handle back button diffrently when editing a trade as an action:
dofile(modpath .. "fs/fs_do_trade_simple_in_edit_mode.lua")

View File

@ -0,0 +1,31 @@
-- override fs/fs_add_trade_simple.lua:
-- (this is kept here as it is trade related and does not change the formspec as such)
local old_input_add_trade_simple = yl_speak_up.input_add_trade_simple
yl_speak_up.input_add_trade_simple = function(player, formname, fields, input_to)
if(not(player)) then
return 0
end
local pname = player:get_player_name()
input_to = "add_trade_simple"
-- are we editing an action of the type trade?
if( yl_speak_up.speak_to[pname][ "tmp_action" ]
and yl_speak_up.speak_to[pname][ "tmp_action" ].what == 3
and yl_speak_up.in_edit_mode(pname)
and yl_speak_up.edit_mode[pname] == n_id) then
input_to = "edit_actions"
end
return old_input_add_trade_simple(player, formname, fields, input_to)
end
yl_speak_up.register_fs("add_trade_simple",
-- the input function is a new one now
yl_speak_up.input_add_trade_simple,
-- the get_fs function stays the same
yl_speak_up.get_fs_add_trade_simple_wrapper,
-- force formspec version 1 (not changed):
1
)

View File

@ -68,36 +68,3 @@ yl_speak_up.delete_trade_simple = function(player, trade_id)
end
return old_delete_trade_simple(player, trade_id)
end
-- override fs/fs_add_trade_simple.lua:
-- (this is kept here as it is trade related and does not change the formspec as such)
local old_input_add_trade_simple = yl_speak_up.input_add_trade_simple
yl_speak_up.input_add_trade_simple = function(player, formname, fields, input_to)
if(not(player)) then
return 0
end
local pname = player:get_player_name()
input_to = "add_trade_simple"
-- are we editing an action of the type trade?
if( yl_speak_up.speak_to[pname][ "tmp_action" ]
and yl_speak_up.speak_to[pname][ "tmp_action" ].what == 3
and yl_speak_up.in_edit_mode(pname)
and yl_speak_up.edit_mode[pname] == n_id) then
input_to = "edit_actions"
end
return old_input_add_trade_simple(player, formname, fields, input_to)
end
yl_speak_up.register_fs("add_trade_simple",
-- the input function is a new one now
yl_speak_up.input_add_trade_simple,
-- the get_fs function stays the same
yl_speak_up.get_fs_add_trade_simple_wrapper,
-- force formspec version 1 (not changed):
1
)