Add the rest of the game.
This commit is contained in:
parent
dd73665a23
commit
e3431d8de9
49 changed files with 855 additions and 57 deletions
|
|
@ -13,26 +13,28 @@ minetest.register_entity(":artifact:burst", {
|
|||
},
|
||||
static_save = false,
|
||||
},
|
||||
on_activate = function(e, rot)
|
||||
on_activate = function(e)
|
||||
e.object:set_armor_groups{immortal = 1}
|
||||
end,
|
||||
on_deactivate = function(e)
|
||||
for _, x in ipairs(e._particles) do
|
||||
for _, x in ipairs(e._particles or {}) do
|
||||
minetest.delete_particlespawner(x)
|
||||
end
|
||||
end,
|
||||
on_step = function(e, dtime, movement)
|
||||
-- Minetest's collision is rather bad, but we also shouldn't collide with players,
|
||||
-- hence we must implement our own rudimentary collision detection.
|
||||
-- In this case, any intersection on the segment betwee our last position and our
|
||||
-- In this case, any intersection on the segment between our last position and our
|
||||
-- current one should be considered a collision and result in detonation (and
|
||||
-- at the exact intersection point, if available).
|
||||
local collision
|
||||
for x in minetest.raycast(e.old_pos or e.object:get_pos(), e.object:get_pos(), true, true, {nodes = {}, objects = {playser = false}}) do
|
||||
collision = x
|
||||
break
|
||||
if not e._critical then
|
||||
for x in minetest.raycast(e.old_pos or e.object:get_pos(), e.object:get_pos(), true, true, {nodes = {}, objects = {playser = false}}) do
|
||||
collision = x
|
||||
break
|
||||
end
|
||||
end
|
||||
if collision or movement.collides then
|
||||
if collision or movement and movement.collides then
|
||||
if collision then
|
||||
e.object:set_pos(collision.intersection_point)
|
||||
end
|
||||
|
|
@ -61,6 +63,10 @@ minetest.register_entity(":artifact:burst", {
|
|||
drag = 1,
|
||||
time = 0.1,
|
||||
}
|
||||
artifact.play_sound {
|
||||
name = "artifact_burst_impact",
|
||||
pos = e.object:get_pos()
|
||||
}
|
||||
e.object:remove()
|
||||
if movement and movement.collisions[1] and movement.collisions[1].type == "node" then
|
||||
local pos = movement.collisions[1].node_pos
|
||||
|
|
@ -116,6 +122,10 @@ minetest.register_entity(":artifact:burst", {
|
|||
end
|
||||
})
|
||||
|
||||
function ns.do_shoot(m)
|
||||
minetest.add_entity(m.pos +m.dir, "artifact:burst", tostring(m.yaw)):get_luaentity():impulse(m.dir *30)
|
||||
function ns.do_shoot(m, dir)
|
||||
artifact.play_sound {
|
||||
name = "artifact_burst_fire",
|
||||
pos = dir and m or m.pos
|
||||
}
|
||||
minetest.add_entity(dir and m +dir or m.pos +m.dir, "artifact:burst"):get_luaentity():impulse((dir or m.dir) *30)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue