forked from Sokomine/yl_speak_up
		
	fixed trade as an action (which shall work diffrently than trade from trade list)
This commit is contained in:
		
							parent
							
								
									35761ac779
								
							
						
					
					
						commit
						712f19656e
					
				| @ -779,6 +779,24 @@ yl_speak_up.get_fs_trade_simple = function(player, trade_id) | ||||
| 			" Current stock: "..tostring(stock_pay).. | ||||
| 			" (max: "..tostring(trade.max_storage).. | ||||
| 			"). Perhaps later?" | ||||
| 	-- trade as an action | ||||
| 	elseif(not(trade.trade_is_trade_list)) then | ||||
| 		if(trade_inv:contains_item("pay", trade.player_gives)) then | ||||
| 		-- all good so far; move the price stack to the pay slot | ||||
| 			-- move price item to the price slot | ||||
| 			local stack = player_inv:remove_item("main", trade.player_gives) | ||||
| 			trade_inv:add_item("pay", stack) | ||||
| 			trade_possible_msg = "Please take your purchase!" | ||||
| 			can_trade = true | ||||
| 		elseif(trade_inv:is_empty("pay")) then | ||||
| 			trade_possible_msg = "Please insert the right payment in the pay slot\n".. | ||||
| 				"and then take your purchase." | ||||
| 			can_trade = false | ||||
| 		else | ||||
| 			trade_possible_msg = "This is not what "..minetest.formspec_escape(trade.npc_name).. | ||||
| 				" wants.\nPlease insert the right payment!" | ||||
| 			can_trade = false | ||||
| 		end | ||||
| 	-- can the player pay? | ||||
| 	elseif(not(player_inv:contains_item("main", trade.player_gives))) then | ||||
| 		-- both slots will remain empty | ||||
| @ -789,11 +807,6 @@ yl_speak_up.get_fs_trade_simple = function(player, trade_id) | ||||
| 		-- (the slot may already contain the right things; we'll find that out later on) | ||||
| 		trade_possible_msg = "This is not what "..minetest.formspec_escape(trade.npc_name).. | ||||
| 			" wants.\nPlease insert the right payment!" | ||||
| 	-- all good so far; move the price stack to the pay slot | ||||
| --	else | ||||
| --		-- move price item to the price slot | ||||
| --		local stack = player_inv:remove_item("main", trade.player_gives) | ||||
| --		trade_inv:add_item("pay", stack) | ||||
| 	else | ||||
| 		trade_possible_msg = "Please insert the right payment in the pay slot\n".. | ||||
| 			"or click on \"buy\".".. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user