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

@ -59,6 +59,11 @@ minetest.register_entity(":artifact:color_swapper_display", {
e._no_interact = true
e.object:set_animation({x=7,y=8}, 1, 1, false)
m:set_color(e.color)
artifact.play_sound {
name = "artifact_color_swap",
pos = e.object:get_pos(),
range = 8,
}
minetest.after(1, function()
if not e._active then return end
e.object:set_animation({x=0,y=6}, 1, 1, true)
@ -227,10 +232,11 @@ minetest.register_entity(":artifact:color_target_display", {
if m.color == e.color then
e._no_interact = true
m:set_color(nil)
local receivers = minetest.deserialize(minetest.get_meta(e.object:get_pos():round()):get("receivers") or "return nil")
if receivers then
artifact.dispatch_event(receivers, {type = "pulse"})
end
artifact.play_sound {
name = "artifact_color_use",
pos = e.object:get_pos(),
range = 8,
}
-- Update the entity's texture every globalstep, because that's the only way to do a texture animation.
local progress = 0
local delay = 0
@ -241,6 +247,10 @@ minetest.register_entity(":artifact:color_target_display", {
if progress >= 255 then
dir = false
minetest.after(1, update)
local receivers = minetest.deserialize(minetest.get_meta(e.object:get_pos():round()):get("receivers") or "return nil")
if receivers then
artifact.dispatch_event(receivers, {type = "pulse"})
end
return
end
else
@ -303,6 +313,7 @@ artifact.register_node("color_target", {
paramtype = "light",
paramtype2 = "facedir",
groups = {call_on_load = 1},
sounds = artifact.sounds.metal,
on_construct = target_onload,
on_load = target_onload,
on_destruct = function(pos)

View file

@ -73,7 +73,7 @@ minetest.register_entity(":artifact:door", {
if e._locked then
e._no_interact = true
end
if e.inverted then e:invert() end
if e.inverted or nm:get("inverted") == "true" then e:invert() end
doors[e.object:get_pos():round():to_string()] = e
end,
on_deactivate = function(e)
@ -200,6 +200,10 @@ minetest.register_entity(":artifact:door", {
texture = "artifact_door_wood.png^[sheet:2x8:0,3",
time = 0.1
}
artifact.play_sound {
name = "artifact_door_break",
pos = pos
}
return true
end
end

View file

@ -268,6 +268,7 @@ artifact.register_node("forcefield_generator", {
1, 0.5, 0.5
}
},
sounds = artifact.sounds.metal,
on_construct = onload,
on_load = onload,
on_rightclick = artifact.debug and function(pos)
@ -284,8 +285,12 @@ artifact.register_node("forcefield_generator", {
local node = minetest.get_node(pos)
node.name = "forcefield_generator_off"
minetest.after(0, function()
minetest.set_node(pos, node)
minetest.set_node(pos, node)
end)
artifact.play_sound {
name = "artifact_forcefield_generator_destruct",
pos = pos,
}
minetest.add_particlespawner {
pos = pos,
vel = vector.zero(),
@ -338,6 +343,7 @@ artifact.register_node("forcefield_generator_off", {
1, 0.5, 0.5
}
},
sounds = artifact.sounds.metal,
on_impact = artifact.debug and function(pos)
local node = minetest.get_node(pos)
node.name = "forcefield_generator"

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