Add the rest of the game.

This commit is contained in:
Signal 2025-11-29 17:24:33 -05:00
parent dd73665a23
commit e3431d8de9
49 changed files with 855 additions and 57 deletions

View file

@ -1,5 +1,6 @@
local large_doors = {}
artifact.large_doors = large_doors
minetest.register_entity(":artifact:large_door_display", {
initial_properties = {
@ -49,7 +50,7 @@ minetest.register_entity(":artifact:large_door_display", {
if nm:contains("locks") then
e.locks = minetest.deserialize(nm:get_string("locks"))
end
if e.locks then
e:set_locks(e.locks)
end
@ -99,6 +100,23 @@ minetest.register_entity(":artifact:large_door_display", {
local pos = e.object:get_pos():round()
minetest.get_meta(pos):set_string("open", "true")
artifact.play_sound {
name = "artifact_large_door_open",
pos = e.object:get_pos(),
range = 10,
}
local m = minetest.get_meta(pos)
local on_open = m:get("on_open")
if not artifact.debug and on_open then
if on_open == "play_final_scene" then
artifact.story.play_final_scene()
elseif on_open == "play_end_scene" then
artifact.story.play_end_scene()
end
m:set_string("on_open", "")
end
minetest.after(0.75, function()
e._animating = nil
end)
@ -110,6 +128,13 @@ minetest.register_entity(":artifact:large_door_display", {
e.object:set_animation({x=1,y=2}, 1.25, 0.1, false)
local pos = e.object:get_pos():round()
minetest.get_meta(pos):set_string("open", "false")
artifact.play_sound {
name = "artifact_large_door_close",
pos = e.object:get_pos(),
range = 10,
}
minetest.after(0.75, function()
e._animating = nil
end)
@ -185,9 +210,9 @@ local function onload(pos)
if not m:contains("initialized") then
m:set_string("initialized", "true")
local rot = artifact.facedir_to_rotation(minetest.get_node(pos).param2)
local locks = {red = false, blue = false, green = false, "red", "green", "blue"}
local locks = minetest.deserialize(m:get("locks") or "return nil") or {red = false, blue = false, green = false, "red", "green", "blue"}
minetest.add_entity(pos, "artifact:large_door_display", minetest.serialize{locks = locks}):get_luaentity():rotate(rot)
minetest.get_meta(pos):set_string("locks", minetest.serialize(locks))
m:set_string("locks", minetest.serialize(locks))
end
end
@ -204,6 +229,47 @@ local function onsignal(pos, event, channel)
if locks[channel] ~= nil then
locks[channel] = true
end
artifact.play_sound {
name = "artifact_lock_light",
pos = e.object:get_pos(),
range = 10,
}
local idx = table.indexof(locks, channel)
local rot = artifact.facedir_to_rotation(minetest.get_node(pos).param2)
minetest.add_particlespawner {
pos = pos +vector.new(-0.6 +(idx *0.3), 2.25, -0.2):rotate(rot),
vel = {
min = vector.new(-1, 0, -1):rotate(rot),
max = vector.new(1, 2, -0.2):rotate(rot),
},
acc = vector.new(0, -9.81, 0),
texture = {
name = "[fill:1x1:0,0:"..artifact.colors[channel],
alpha_tween = {1, 0}
},
glow = 8,
time = 0.1,
size = 0.25,
amount = 20,
exptime = 0.3
}
minetest.add_particlespawner {
pos = pos +vector.new(-0.6 +(idx *0.3), 2.25, 0.2):rotate(rot),
vel = {
min = vector.new(-1, 0, 0.2):rotate(rot),
max = vector.new(1, 2, 1):rotate(rot),
},
acc = vector.new(0, -8, 0),
texture = {
name = "[fill:1x1:0,0:"..artifact.colors[channel],
alpha_tween = {1, 0}
},
glow = 8,
time = 0.1,
size = 0.25,
amount = 20,
exptime = 0.3
}
e:set_locks(locks)
minetest.get_meta(pos):set_string("locks", minetest.serialize(locks))
else