call the right formspec on trade inventory actions
This commit is contained in:
		
							parent
							
								
									6fc01ab754
								
							
						
					
					
						commit
						b1a6b6f628
					
				@ -499,7 +499,8 @@ minetest.register_on_joinplayer(function(player, last_login)
 | 
			
		||||
			if(listname == "pay") then
 | 
			
		||||
				local pname = player:get_player_name()
 | 
			
		||||
				-- show formspec with updated information (perhaps sale is now possible)
 | 
			
		||||
				minetest.show_formspec(pname, "yl_speak_up:talk", yl_speak_up.get_fs_trade_simple(player))
 | 
			
		||||
				minetest.show_formspec(pname, "yl_speak_up:do_trade_simple",
 | 
			
		||||
					yl_speak_up.get_fs_trade_simple(player))
 | 
			
		||||
			end
 | 
			
		||||
		end,
 | 
			
		||||
	        on_take = function(inv, listname, index, stack, player)
 | 
			
		||||
@ -508,12 +509,14 @@ minetest.register_on_joinplayer(function(player, last_login)
 | 
			
		||||
			if(listname == "pay") then
 | 
			
		||||
				local pname = player:get_player_name()
 | 
			
		||||
				-- show formspec with updated information (perhaps sale is now possible)
 | 
			
		||||
				minetest.show_formspec(pname, "yl_speak_up:talk", yl_speak_up.get_fs_trade_simple(player))
 | 
			
		||||
				minetest.show_formspec(pname, "yl_speak_up:do_trade_simple",
 | 
			
		||||
					yl_speak_up.get_fs_trade_simple(player))
 | 
			
		||||
			elseif(listname == "buy") then
 | 
			
		||||
				yl_speak_up.do_trade_simple(player, stack:get_count())
 | 
			
		||||
				-- information may require an update (NPC might now be out of stock), or
 | 
			
		||||
				-- the player can do the trade a second time
 | 
			
		||||
				minetest.show_formspec(pname, "yl_speak_up:talk", yl_speak_up.get_fs_trade_simple(player))
 | 
			
		||||
				minetest.show_formspec(pname, "yl_speak_up:do_trade_simple",
 | 
			
		||||
					yl_speak_up.get_fs_trade_simple(player))
 | 
			
		||||
			end
 | 
			
		||||
		end,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user