Skip to content

Commit

Permalink
remove the trace, we'll add it back as a projectile parameter later
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxionary committed Feb 1, 2024
1 parent 9434b7a commit 73c0695
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
37 changes: 0 additions & 37 deletions api/shoot.lua
Expand Up @@ -32,43 +32,6 @@ function ballistics.shoot(entity_name, pos, velocity, acceleration, source_obj,
ent._source_player_name = source_obj:get_player_name()
end
ent._target_obj = target_obj
if ballistics.settings.show_estimated_path then
local cast = ballistics.ballistic_cast({
pos = pos,
velocity = velocity,
acceleration = acceleration,
drag = (ent._parameters.drag or {}).coefficient,
dt = 0.01,
objects = false,
liquids = false,
on_step = function(pos_)
minetest.add_particlespawner({
amount = 1,
time = 0.1,
texture = "ballistics_arrow_particle.png^[colorize:red:127",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 1,
},
glow = 1,
minvel = { x = 0, y = 0, z = 0 },
maxvel = { x = 0, y = 0, z = 0 },
minacc = { x = 0, y = 0, z = 0 },
maxacc = { x = 0, y = 0, z = 0 },
minexptime = 10,
maxexptime = 10,
minsize = 2,
maxsize = 2,
minpos = pos_,
maxpos = pos_,
})
end,
})
cast()
end

return obj
end

Expand Down
2 changes: 0 additions & 2 deletions settingtypes.txt
@@ -1,2 +0,0 @@
# if true, show the path we expect the projectile to follow using red particles
ballistics:show_estimated_path (show estimated path) bool true
37 changes: 37 additions & 0 deletions util.lua
Expand Up @@ -45,3 +45,40 @@ function ballistics.util.replace(self, pos0)
return true
end
end

function ballistics.util.show_path(pos, velocity, acceleration, drag)
local cast = ballistics.ballistic_cast({
pos = pos,
velocity = velocity,
acceleration = acceleration,
drag = drag,
dt = 0.01,
objects = false,
liquids = false,
on_step = function(pos_)
minetest.add_particlespawner({
amount = 1,
time = 0.1,
texture = "ballistics_arrow_particle.png^[colorize:red:127",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 1,
},
glow = 1,
minvel = { x = 0, y = 0, z = 0 },
maxvel = { x = 0, y = 0, z = 0 },
minacc = { x = 0, y = 0, z = 0 },
maxacc = { x = 0, y = 0, z = 0 },
minexptime = 10,
maxexptime = 10,
minsize = 2,
maxsize = 2,
minpos = pos_,
maxpos = pos_,
})
end,
})
cast()
end

0 comments on commit 73c0695

Please sign in to comment.