Fix a bug with state restoration.
This commit is contained in:
parent
9096c33a48
commit
85817a33b8
1 changed files with 34 additions and 27 deletions
|
|
@ -92,24 +92,9 @@ minetest.register_entity(":artifact:vix_scene", {
|
|||
end
|
||||
})
|
||||
|
||||
function ns.enter_pre_vix_state()
|
||||
for _, m in pairs(artifact.players) do
|
||||
m:add_health_bar()
|
||||
m.object:hud_set_flags {
|
||||
crosshair = true,
|
||||
wielditem = true,
|
||||
}
|
||||
m.object:set_pos(artifact.origin:offset(0, -73.5, -4))
|
||||
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()
|
||||
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 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
|
||||
|
|
@ -134,7 +119,25 @@ function ns.enter_pre_vix_state()
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ns.enter_pre_vix_state()
|
||||
for _, m in pairs(artifact.players) do
|
||||
m:add_health_bar()
|
||||
m.object:hud_set_flags {
|
||||
crosshair = true,
|
||||
wielditem = true,
|
||||
}
|
||||
m.object:set_pos(artifact.origin:offset(0, -73.5, -4))
|
||||
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")
|
||||
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 = pre_vix_on_whacked
|
||||
end
|
||||
|
||||
function ns.enter_main_state()
|
||||
|
|
@ -984,6 +987,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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue