32 lines
824 B
Lua
32 lines
824 B
Lua
artifact.story = {
|
|
states = enum { -- We use an enum for this so that we can use relational operators to determine if the current state is before or after a target state.
|
|
"loading", -- For mapgen
|
|
"init", -- For the opening cutscene
|
|
"pre_vix", -- The player doesn't have Vix yet
|
|
"main", -- The main game state. Progress is managed by checkpoints here.
|
|
"end", -- The game is over.
|
|
}
|
|
}
|
|
local ns = artifact.story
|
|
local db = minetest.get_mod_storage()
|
|
|
|
local state = db:get_int("state") -- Defaults to zero, i.e. "loading".
|
|
|
|
function ns.set_state(to)
|
|
state = to
|
|
db:set_int("state", state)
|
|
end
|
|
|
|
function ns.get_state()
|
|
return state
|
|
end
|
|
|
|
function ns.before_state(target)
|
|
|
|
end
|
|
|
|
minetest.register_globalstep(function()
|
|
if state == "init" then
|
|
|
|
end
|
|
end)
|