Limit entity speed to 250m/s.
authorAuke Kok <sofar@foo-projects.org>
Wed, 30 Mar 2016 06:09:47 +0000 (23:09 -0700)
committerparamat <mat.gregory@virginmedia.com>
Sat, 16 Apr 2016 18:27:16 +0000 (19:27 +0100)
Let's just call it "terminal" velocity.

mods/tnt/init.lua

index bb1f144b68c075fe9de1bc6e59eebffba27f8c37..f465620142a6c70903e12617d19079f42765d8cb 100644 (file)
@@ -120,6 +120,12 @@ local function calc_velocity(pos1, pos2, old_vel, power)
 
        -- Add old velocity
        vel = vector.add(vel, old_vel)
+
+       -- Limit to terminal velocity
+       dist = vector.length(vel)
+       if dist > 250 then
+               vel = vector.divide(vel, dist / 250)
+       end
        return vel
 end