Skip to content

Commit

Permalink
Limit entity speed to 250m/s.
Browse files Browse the repository at this point in the history
Let's just call it "terminal" velocity.
  • Loading branch information
sofar authored and paramat committed Apr 16, 2016
1 parent e6cef57 commit 8114c3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mods/tnt/init.lua
Expand Up @@ -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

Expand Down

0 comments on commit 8114c3d

Please sign in to comment.