TNT: Fix bug with huge stacks
authortenplus1 <tenplus1@users.noreply.github.com>
Wed, 3 Aug 2016 08:10:09 +0000 (09:10 +0100)
committerparamat <mat.gregory@virginmedia.com>
Thu, 4 Aug 2016 02:21:55 +0000 (03:21 +0100)
This fixes the TNT bug that can crash game when blowing up a container
which holds huge stacks above the norm... e.g. give yourself 65535 snow,
place in chest, blow up, stalled!

mods/tnt/init.lua

index c5aa95c9193678a60e1138b5bcf81eefe300785a..2e82c4edc0ffe519f0720dfae5c271139ed69d97 100644 (file)
@@ -47,7 +47,7 @@ end
 local function eject_drops(drops, pos, radius)
        local drop_pos = vector.new(pos)
        for _, item in pairs(drops) do
-               local count = item:get_count()
+               local count = math.min(item:get_count(), 99)
                while count > 0 do
                        local take = math.max(1,math.min(radius * radius,
                                        count,