Fix another crash.

This commit is contained in:
Signal 2025-12-01 19:07:49 -05:00
parent c54579e426
commit a7ed39131c
3 changed files with 8 additions and 4 deletions

View file

@ -60,7 +60,7 @@ function artifact.play_sound(def)
--def.gain = nil --def.gain = nil
if def.pos then if def.pos then
for _, m in pairs(artifact.players) do for _, m in pairs(artifact.players) do
local dist = m.pos:distance(def.pos) local dist = vector.distance(m.pos, def.pos)
if dist <= (def.range or 32) and m.name ~= def.exclude_player and not (def.to_player and m.name ~= def.to_player) then if dist <= (def.range or 32) and m.name ~= def.exclude_player and not (def.to_player and m.name ~= def.to_player) then
def.to_player = m.name def.to_player = m.name
def.gain = (def.gain or 1) *(1 -math.sqrt(dist /(def.range or 32))) def.gain = (def.gain or 1) *(1 -math.sqrt(dist /(def.range or 32)))

View file

@ -10,7 +10,8 @@ Player = setmetatable({
local m = setmetatable({ local m = setmetatable({
object = p, object = p,
pitch = 0, pitch = 0,
yaw = 0 yaw = 0,
pos = p:get_pos()
}, {__index = Player}) }, {__index = Player})
m.name = p:get_player_name() m.name = p:get_player_name()

View file

@ -64,6 +64,9 @@ minetest.register_entity(":artifact:vix_scene", {
end, end,
on_deactivate = function(e) on_deactivate = function(e)
vix_scene = nil vix_scene = nil
if e.particles then
minetest.delete_particlespawner(e.particles)
end
end, end,
on_step = function(e) on_step = function(e)
if e._can_check then if e._can_check then
@ -110,7 +113,7 @@ local function pre_vix_on_whacked(type, target)
minetest.after(1, function() minetest.after(1, function()
artifact.push_chat_message("Hehe.", "Key", "artifact_key_splash_low.png") artifact.push_chat_message("Hehe.", "Key", "artifact_key_splash_low.png")
end) end)
elseif num == 5 then -- All generators are down. elseif num >= 5 then -- All generators are down.
vix_scene._can_check = nil vix_scene._can_check = nil
-- Wait just a bit, so the player can look up. -- Wait just a bit, so the player can look up.
minetest.after(0.5, function() minetest.after(0.5, function()
@ -263,7 +266,7 @@ artifact.register_node("stasis_beacon", {
paramtype = "light" paramtype = "light"
}) })
-- The 'cutscene' playerd after the player frees Vix. -- The 'cutscene' played after the player frees Vix.
function ns.play_vix_scene() function ns.play_vix_scene()
-- Kaboom. -- Kaboom.
minetest.add_particle { minetest.add_particle {