prevent negative numbers from being entered, results in lots of free items otherwise

master
Thomas Rudin 2019-01-13 10:57:05 +01:00
parent ed26606935
commit fadb668f23
1 changed files with 2 additions and 0 deletions

View File

@ -1087,6 +1087,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.buy then
local lots = math.floor(tonumber(fields.lot_count) or 1)
-- prevent negative numbers
lots = math.max(lots, 1)
local success, message = make_purchase(pos, player, lots)
if success then
-- Add to vendor logs