Merge pull request #6 from pandorabox-io/fix-resource-duplication

prevent negative numbers from being entered, results in lots of free …
master
ChimneySwift 2019-02-03 15:12:28 +10:00 committed by GitHub
commit 63168732cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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