Allow mechanisms to be linked, and allow storing links in schematics.

This commit is contained in:
Signal 2025-11-12 00:55:14 -05:00
parent 8f98a7fa2d
commit 8a8fa943c5
9 changed files with 438 additions and 104 deletions

View file

@ -45,6 +45,26 @@ function Promise(fn)
}
end
-- HACK: Lookup table for getting a rotation from a
-- facedir (because Minetest doesn't have any way
-- to get this)
local facedir_rotations = {
-- +Y
[0] = vector.new(0,0,0),
[1] = vector.new(0, math.pi *1.5, 0),
[2] = vector.new(0, math.pi, 0),
[3] = vector.new(0, math.pi *0.5, 0),
-- +Z
[4] = vector.new(math.pi *1.5, 0, 0),
[5] = vector.new(math.pi *1.5, math.pi *1.5, 0),
[6] = vector.new(math.pi *1.5, math.pi, 0),
[7] = vector.new(math.pi *1.5, math.pi *0.5, 0),
}
function artifact.facedir_to_rotation(facedir)
return facedir_rotations[facedir] or minetest.facedir_to_dir(facedir):dir_to_rotation()
end
minetest.register_lbm{
name = ":artifact:on_load",