Make bullet particle velocity a function of step/time
This commit is contained in:
parent
2a68881248
commit
efe82e3e52
1 changed files with 4 additions and 2 deletions
|
@ -368,14 +368,16 @@ local function fire_weapon(player, itemstack, spec, extended)
|
||||||
local interval = spec.tool_caps.full_punch_interval
|
local interval = spec.tool_caps.full_punch_interval
|
||||||
shots[spec.user] = minetest.get_us_time() / 1000000 + interval
|
shots[spec.user] = minetest.get_us_time() / 1000000 + interval
|
||||||
minetest.sound_play(spec.sound, {object=player})
|
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)
|
local directions = get_directions(dir, spec)
|
||||||
for _, d in pairs(directions) do
|
for _, d in pairs(directions) do
|
||||||
if spec.bullet_image then
|
if spec.bullet_image then
|
||||||
minetest.add_particle({
|
minetest.add_particle({
|
||||||
pos = pos,
|
pos = pos,
|
||||||
velocity = v3d.multiply(d, 30),
|
velocity = v3d.multiply(d, speed),
|
||||||
acceleration = {x=0, y=0, z=0},
|
acceleration = {x=0, y=0, z=0},
|
||||||
expirationtime = 0.5,
|
expirationtime = time,
|
||||||
size = 0.25,
|
size = 0.25,
|
||||||
texture = spec.bullet_image,
|
texture = spec.bullet_image,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue