From efe82e3e52b3c59999d90eddf6800d2c78724ea2 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Tue, 2 Apr 2019 15:56:38 +0100 Subject: [PATCH] Make bullet particle velocity a function of step/time --- shooter/api.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shooter/api.lua b/shooter/api.lua index cc883b0..3c39c36 100644 --- a/shooter/api.lua +++ b/shooter/api.lua @@ -368,14 +368,16 @@ local function fire_weapon(player, itemstack, spec, extended) local interval = spec.tool_caps.full_punch_interval shots[spec.user] = minetest.get_us_time() / 1000000 + interval minetest.sound_play(spec.sound, {object=player}) + local speed = spec.step / shooter.config.rounds_update_time + local time = spec.range / speed local directions = get_directions(dir, spec) for _, d in pairs(directions) do if spec.bullet_image then minetest.add_particle({ pos = pos, - velocity = v3d.multiply(d, 30), + velocity = v3d.multiply(d, speed), acceleration = {x=0, y=0, z=0}, - expirationtime = 0.5, + expirationtime = time, size = 0.25, texture = spec.bullet_image, })