From 8b384fb257f144212a17692bd91cf77b94d5c963 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 16 Apr 2016 12:13:13 -0700 Subject: [PATCH] TNT: randomly vary ejecting velocity We add a +/- 0.5 random value to the velocity vector of ejecting nodes. I've spotted a lot of nodes going exactly straight up if blowing up sand above TNT. The extra variation looks less artificial. --- mods/tnt/init.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index b48a56b9..1c92c5e4 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -123,6 +123,13 @@ local function calc_velocity(pos1, pos2, old_vel, power) -- Add old velocity vel = vector.add(vel, old_vel) + -- randomize it a bit + vel = vector.add(vel, { + x = math.random() - 0.5, + y = math.random() - 0.5, + z = math.random() - 0.5, + }) + -- Limit to terminal velocity dist = vector.length(vel) if dist > 250 then -- 2.25.1