Add the intro cutscene, a start to the map, and various other things.

This commit is contained in:
Signal 2025-11-16 02:48:08 -05:00
parent d0c0a3ebb6
commit 1b2199705b
46 changed files with 1401 additions and 91 deletions

View file

@ -0,0 +1,99 @@
local ns = artifact
minetest.register_entity(":artifact:burst", {
initial_properties = {
visual = "sprite",
textures = {"blank.png"},
pointable = false,
physical = true,
collide_with_objects = false,
collisionbox = {
-0.2, -0.2, -0.2,
0.2, 0.2, 0.2
},
static_save = false,
},
on_activate = function(e, rot)
e.object:set_armor_groups{immortal = 1}
end,
on_deactivate = function(e)
for _, x in ipairs(e._particles) do
minetest.delete_particlespawner(x)
end
end,
on_step = function(e, dtime, movement)
if movement.collides then
minetest.add_particlespawner {
pos = e.object:get_pos(),
radius = 0.1,
texture = {
name = "artifact_light.png",
alpha_tween = {1, 0}
},
glow = 8,
size_tween = {
{min = 2, max = 3},
{min = 4, max = 5}
},
attract = {
kind = "point",
strength = {
min = -50,
max = -20,
},
origin = e.object:get_pos()
},
amount = 25,
exptime = 0.5,
drag = 1,
time = 0.1,
}
e.object:remove()
end
end,
impulse = function(e, vel)
-- The documentation said that `vel` is relative to the parent entity...
-- I guess the documentation is wrong?
local rot = vel:normalize():dir_to_rotation()
local min, max = vector.sort(vector.new(-1,-1,-1):rotate(rot), vector.new(1,1,0):rotate(rot))
e._particles = {
-- Tail
minetest.add_particlespawner {
attached = e.object,
pos = {
min = vector.new(-1,-1,-1) *0.2,
max = vector.new(1,1,1) *0.2
},
vel = {
min = min,
max = max
},
texture = {
name = "artifact_light.png",
alpha_tween = {1, 0}
},
size = 0.4,
glow = 10,
amount = 450,
time = 0
},
-- Head
minetest.add_particlespawner {
attached = e.object,
pos = vector.zero(),
vel = vel,
texture = "[fill:16x16:0,0:#fff",
size = 3,
glow = 14,
amount = 150,
time = 0,
exptime = 0.1
}
}
e.object:set_velocity(vel)
end
})
function ns.do_shoot(m)
minetest.add_entity(m.pos +m.dir, "artifact:burst", tostring(m.yaw)):get_luaentity():impulse(m.dir *30)
end