Add the rest of the game.

This commit is contained in:
Signal 2025-11-29 17:24:33 -05:00
parent dd73665a23
commit 9096c33a48
49 changed files with 855 additions and 57 deletions

View file

@ -42,6 +42,15 @@ function ns.apply_vix(m)
end
function ns._swap_character(m)
-- If Key was pointing at something Vix shouldn't be able to interact with,
-- but Vix is also pointing at it, then remove the interaction marker since
-- it would be misleading.
if m.pointed_obj and m.interaction_marker and (not m.pointed_obj._can_interact or m.pointed_obj:_can_interact(m)) then
m.object:hud_remove(m.interaction_marker)
m.interaction_marker = nil
m.interaction_start = nil
end
if m.character == "vix" then
artifact.sidekick.character = "vix"
m:set_character("key")
@ -52,6 +61,17 @@ function ns._swap_character(m)
ns.apply_vix(m)
end
-- If Vix was pointing at something whackable, and the player then switches
-- to Key who is pointing at the same thing, we should show the whack icon.
if m.character == "key" and m.pointed_node and minetest.registered_nodes[m.pointed_node.node_under.name].groups.whackable then
m.whack_hud = m.object:hud_add {
type = "image_waypoint",
world_pos = m.pointed_node.under,
scale = {x=3,y=3},
text = "artifact_icon_whack.png"
}
end
-- We don't need to have the sidekick entity during testing.
if artifact.sidekick.pos or not artifact.debug then
-- `m.pos` includes eye_height, and we don't want that here.
@ -124,6 +144,10 @@ function ns.swap_character(m)
duration = 0.3
}
}
artifact.play_sound {
name = "artifact_character_swap",
to_player = m.name
}
minetest.after(0.3, function()
ns._swap_character(m)
fade:animate {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,005 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -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