Add color swappers, color swapping, and color targets.

This commit is contained in:
Signal 2025-11-19 11:43:24 -05:00
parent 9acd605c86
commit 5fd67703c0
34 changed files with 688 additions and 29 deletions

View file

@ -54,16 +54,10 @@ minetest.register_entity(":artifact:door", {
}
end
if e.rotation then
e.rotation.y = e.rotation.y +math.pi
e:rotate(e.rotation)
else
e.rotation = vector.zero()
e:rotate(vector.zero())
end
local box = artifact.rotate_selectionbox(e.box_closed_normal, e.rotation)
e.object:set_properties {
selectionbox = box,
collisionbox = box
}
e._name = ""..math.random()
local nm = minetest.get_meta(e.object:get_pos())
@ -147,6 +141,15 @@ minetest.register_entity(":artifact:door", {
get_staticdata = function(e)
return minetest.serialize{type = e.type, _locked = e._locked, rotation = e.rotation, inverted = e.inverted}
end,
on_punch = artifact.debug and function(e)
local nm = minetest.get_meta(e.object:get_pos())
if nm:get_string("locked") == "true" then
e._locked = true
end
if e._locked then
e._no_interact = true
end
end or nil,
unlock = function(e)
if e._locked then
e._locked = false
@ -156,8 +159,10 @@ minetest.register_entity(":artifact:door", {
rotate = function(e, rot)
e.object:set_rotation(rot)
e.rotation = rot
local box = artifact.rotate_selectionbox(e._open and (e.inverted and e.box_open_inverted or e.box_open_normal) or e.box_closed_normal, e.rotation)
e.object:set_properties {
selectionbox = box
selectionbox = box,
collisionbox = box
}
end,
on_whack = function(e)
@ -191,7 +196,7 @@ local function register_basic_door(type)
if not m:contains("initialized") then
m:set_string("initialized", "true")
local rot = artifact.facedir_to_rotation(minetest.get_node(pos).param2)
minetest.add_entity(pos, "artifact:door", minetest.serialize{type = type}):get_luaentity():rotate(rot)
minetest.add_entity(pos, "artifact:door", minetest.serialize{type = type, rotation = rot})
end
end
local function ondestruct(pos, reason)