Add multi-signal doors, basic device deployment, and a target trigger.
This commit is contained in:
parent
1b2199705b
commit
9acd605c86
35 changed files with 660 additions and 75 deletions
|
|
@ -19,9 +19,18 @@ minetest.register_entity(":artifact:lever_display", {
|
|||
e.object:remove()
|
||||
return
|
||||
end
|
||||
e._name = ""..math.random()
|
||||
e.object:set_armor_groups{immortal = 1}
|
||||
extend(e, minetest.deserialize(data) or {})
|
||||
if not e.rotation then e.rotation = vector.zero() end
|
||||
|
||||
e.object:set_properties {
|
||||
selectionbox = artifact.rotate_selectionbox({
|
||||
-3/16, -0.5, -4/16,
|
||||
3/16, -3/16, 4/16
|
||||
}, e.rotation)
|
||||
}
|
||||
|
||||
levers[e.object:get_pos():round():to_string()] = e
|
||||
end,
|
||||
on_deactivte = function(e)
|
||||
|
|
@ -108,7 +117,6 @@ artifact.register_node("lever", {
|
|||
end,
|
||||
on_load = function(pos)
|
||||
local m = minetest.get_meta(pos)
|
||||
-- Dynamically initialize doors that were mapgen'd in.
|
||||
if not m:contains("initialized") then
|
||||
m:set_string("initialized", "true")
|
||||
local rot = artifact.facedir_to_rotation(minetest.get_node(pos).param2)
|
||||
|
|
@ -127,3 +135,39 @@ artifact.register_node("lever", {
|
|||
return true
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
artifact.register_node("target", {
|
||||
tiles = {"artifact_target.png"},
|
||||
on_impact = function(pos)
|
||||
local receivers = minetest.deserialize(minetest.get_meta(pos):get("receivers") or "return nil")
|
||||
if receivers then
|
||||
artifact.dispatch_event(receivers, {type = "pulse"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
artifact.register_node("target_off", {
|
||||
tiles = {"artifact_target_off.png"},
|
||||
on_impact = function(pos)
|
||||
local receivers = minetest.deserialize(minetest.get_meta(pos):get("receivers") or "return nil")
|
||||
if receivers then
|
||||
artifact.dispatch_event(receivers, {type = "on"})
|
||||
end
|
||||
minetest.swap_node(pos, {name = "target_on"})
|
||||
end
|
||||
})
|
||||
|
||||
artifact.register_node("target_on", {
|
||||
tiles = {"artifact_target_on.png"},
|
||||
on_impact = function(pos)
|
||||
local receivers = minetest.deserialize(minetest.get_meta(pos):get("receivers") or "return nil")
|
||||
if receivers then
|
||||
artifact.dispatch_event(receivers, {type = "off"})
|
||||
end
|
||||
minetest.swap_node(pos, {name = "target_off"})
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue