Add forcefields, and start building the map.

This commit is contained in:
Signal 2025-11-20 03:15:30 -05:00
parent 5fd67703c0
commit dd73665a23
19 changed files with 511 additions and 15 deletions

View file

@ -25,6 +25,35 @@ function ns.enter_init_state()
ns.play_intro_cutscene()
end
local vix_scene
minetest.register_entity(":artifact:vix_scene", {
initial_properties = {
visual = "mesh",
mesh = "artifact_scene_vix.gltf",
textures = {"artifact_vix.png"}
},
on_activate = function(e)
if state > ns.states.pre_vix then
e.object:remove()
end
e.object:set_armor_groups{immortal = 1}
e.object:set_animation({x=0,y=2}, 0.5, 0.1, true)
vix_scene = e
end,
on_deactivate = function(e)
vix_scene = nil
end,
on_step = function(e)
if e._can_check then
for _, m in pairs(artifact.players) do
if m.pos:distance(e.object:get_pos()) < 15 and m.dir:distance(m.pos:direction(e.object:get_pos())) < 0.2 then
artifact.push_chat_message("Hmm...", "Key", "artifact_key_splash_low.png")
e._can_check = false
end
end
end
end
})
function ns.enter_pre_vix_state()
for _, m in pairs(artifact.players) do
@ -36,20 +65,49 @@ function ns.enter_pre_vix_state()
m.object:set_pos(artifact.origin:offset(0, -73.5, -4))
m:set_spawnpoint(artifact.origin:offset(0, -73.5, -4))
end
minetest.after(5, function()
minetest.add_entity(artifact.origin:offset(-16.5, -72.5, -17), "artifact:vix_scene")
local 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 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
end
end
end
end
end
function ns.enter_main_state()
vix_scene.object:remove()
end
function ns.enter_state(to)
state = to
minetest.log("State changed to "..to..".")
if state == ns.states.init then
ns.enter_init_state()
elseif state == ns.states.pre_vix then
ns.enter_pre_vix_state()
elseif state == ns.states.main then
ns.enter_main_state()
end
db:set_int("state", state)
end

File diff suppressed because one or more lines are too long