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_characters/init.lua b/mods/artifact_characters/init.lua index 2a1129e..df9c522 100644 --- a/mods/artifact_characters/init.lua +++ b/mods/artifact_characters/init.lua @@ -34,7 +34,9 @@ function ns.apply_vix(m) m.eye_height = 1.5 -- Switch hand appearance. m.inv:set_stack("main", 1, ItemStack("input_"..m.character)) - m.object:hud_change(m.healthbar, "text", "artifact_heart_vix.png") + if m.healthbar then + m.object:hud_change(m.healthbar, "text", "artifact_heart_vix.png") + end if m.blackrod then m.blackrod:remove() m.blackrod = nil 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 3012733..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 @@ -92,6 +95,34 @@ minetest.register_entity(":artifact:vix_scene", { end }) + +local help +local function pre_vix_on_whacked(type, target) + local checkpoint = db:get("checkpoint:pre_vix") + if checkpoint == "begin" then -- We're still in the start closet. + if type == "object" then + help:cancel() + vix_scene._can_check = true + end + db:set_string("checkpoint:pre_vix", "in_room") + elseif checkpoint == "in_room" then -- We're actually in the room. + if type == "node" and target.node_under.name:find "forcefield_generator" then + local num = db:get_int("checkpoint:pre_vix_fields_broken") +1 + db:set_int("checkpoint:pre_vix_fields_broken", num) + if num == 1 then -- Key breaks his first generator. + minetest.after(1, function() + artifact.push_chat_message("Hehe.", "Key", "artifact_key_splash_low.png") + end) + 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() + ns.play_vix_scene() + end) + end + end + end +end function ns.enter_pre_vix_state() for _, m in pairs(artifact.players) do m:add_health_bar() @@ -103,38 +134,13 @@ function ns.enter_pre_vix_state() m:set_spawnpoint(artifact.origin:offset(0, -73.5, -4)) end minetest.add_entity(artifact.origin:offset(-16.5, -72.5, -17), "artifact:vix_scene") - local help = minetest.after(15, function() + help = minetest.after(15, function() for _, m in pairs(artifact.players) do artifact.show_help_message(m, "Certain nodes can be broken by punching them with the blackrod.", "info") end end) db:set_string("checkpoint:pre_vix", "begin") - artifact.on_whacked = function(type, target) - local checkpoint = db:get("checkpoint:pre_vix") - if checkpoint == "begin" then -- We're still in the start closet. - if type == "object" then - help:cancel() - vix_scene._can_check = true - end - db:set_string("checkpoint:pre_vix", "in_room") - elseif checkpoint == "in_room" then -- We're actually in the room. - if type == "node" and target.node_under.name:find "forcefield_generator" then - local num = db:get_int("checkpoint:pre_vix_fields_broken") +1 - db:set_int("checkpoint:pre_vix_fields_broken", num) - if num == 1 then -- Key breaks his first generator. - minetest.after(1, function() - artifact.push_chat_message("Hehe.", "Key", "artifact_key_splash_low.png") - end) - 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() - ns.play_vix_scene() - end) - end - end - end - end + artifact.on_whacked = pre_vix_on_whacked end function ns.enter_main_state() @@ -260,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 { @@ -984,6 +990,10 @@ minetest.register_on_joinplayer(function(p) } end + if state == ns.states.pre_vix then + artifact.on_whacked = pre_vix_on_whacked + end + if state == ns.states.pre_vix and db:get_int("checkpoint:pre_vix_fields_broken") >= 5 then -- If the player left during the scene for some reason, start it over when they join back. ns.play_vix_scene() diff --git a/originals/artifact_splash.jpeg b/originals/artifact_splash.jpeg deleted file mode 100644 index ebbe45e..0000000 Binary files a/originals/artifact_splash.jpeg and /dev/null differ diff --git a/originals/artifact_splash.mp4 b/originals/artifact_splash.mp4 deleted file mode 100644 index 6f54509..0000000 Binary files a/originals/artifact_splash.mp4 and /dev/null differ diff --git a/originals/artifact_splash_2.jpeg b/originals/artifact_splash_2.jpeg deleted file mode 100644 index 5992a31..0000000 Binary files a/originals/artifact_splash_2.jpeg and /dev/null differ diff --git a/originals/artifact_splash_2.mp4 b/originals/artifact_splash_2.mp4 deleted file mode 100644 index 891fe27..0000000 Binary files a/originals/artifact_splash_2.mp4 and /dev/null differ diff --git a/originals/artifact_splash_3.jpeg b/originals/artifact_splash_3.jpeg deleted file mode 100644 index f4250de..0000000 Binary files a/originals/artifact_splash_3.jpeg and /dev/null differ