From a7ed39131c30de90e251558668b76c6878b87eab Mon Sep 17 00:00:00 2001 From: Signal Date: Mon, 1 Dec 2025 19:07:49 -0500 Subject: [PATCH] Fix another crash. --- mods/artifact_base/init.lua | 2 +- mods/artifact_player/init.lua | 3 ++- mods/artifact_story/init.lua | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mods/artifact_base/init.lua b/mods/artifact_base/init.lua index bb10b34..da53728 100644 --- a/mods/artifact_base/init.lua +++ b/mods/artifact_base/init.lua @@ -60,7 +60,7 @@ function artifact.play_sound(def) --def.gain = nil if def.pos then 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 def.to_player = m.name def.gain = (def.gain or 1) *(1 -math.sqrt(dist /(def.range or 32))) diff --git a/mods/artifact_player/init.lua b/mods/artifact_player/init.lua index e411f2a..b14c8ed 100644 --- a/mods/artifact_player/init.lua +++ b/mods/artifact_player/init.lua @@ -10,7 +10,8 @@ Player = setmetatable({ local m = setmetatable({ object = p, pitch = 0, - yaw = 0 + yaw = 0, + pos = p:get_pos() }, {__index = Player}) m.name = p:get_player_name() diff --git a/mods/artifact_story/init.lua b/mods/artifact_story/init.lua index a33af98..ce2ce11 100644 --- a/mods/artifact_story/init.lua +++ b/mods/artifact_story/init.lua @@ -64,6 +64,9 @@ minetest.register_entity(":artifact:vix_scene", { end, on_deactivate = function(e) vix_scene = nil + if e.particles then + minetest.delete_particlespawner(e.particles) + end end, on_step = function(e) if e._can_check then @@ -110,7 +113,7 @@ local function pre_vix_on_whacked(type, target) minetest.after(1, function() artifact.push_chat_message("Hehe.", "Key", "artifact_key_splash_low.png") end) - elseif num == 5 then -- All generators are down. + elseif num >= 5 then -- All generators are down. vix_scene._can_check = nil -- Wait just a bit, so the player can look up. minetest.after(0.5, function() @@ -263,7 +266,7 @@ artifact.register_node("stasis_beacon", { paramtype = "light" }) --- The 'cutscene' playerd after the player frees Vix. +-- The 'cutscene' played after the player frees Vix. function ns.play_vix_scene() -- Kaboom. minetest.add_particle {