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 82817a1cb4
10 changed files with 438 additions and 104 deletions

View file

@ -18,7 +18,7 @@ Player = setmetatable({
m.character = m.meta:get("character") or "key"
m.inv = p:get_inventory()
m.inv:set_stack("main", 1, ItemStack("input"))
m.inv:set_stack("main", 1, ItemStack("input_"..m.character))
-- Generic black sky, since the whole game takes place underground.
p:set_sky{
@ -219,7 +219,7 @@ Player = setmetatable({
-- MARK: Radial menu handling
if ctl.place and not m.ctl.place and wi:get_name() == "artifact:input" then
if ctl.place and not m.ctl.place and wi:get_name():find "artifact:input" and (not m.pointed_obj or m.pointed_obj._no_interact) then
artifact.show_radial_menu(m, {
name = "construct",
"test",
@ -228,7 +228,7 @@ Player = setmetatable({
"test4",
"test5"
})
elseif m._menu and not (ctl.place and wi:get_name() == "artifact:input") then
elseif m._menu and not (ctl.place and wi:get_name():find "artifact:input") or (m.pointed_obj and not m.pointed_obj._no_interact) then
artifact.dismiss_radial_menu(m, "construct")
elseif m._menu then
local dx = m.yaw -yaw
@ -324,17 +324,36 @@ Player = setmetatable({
end
})
artifact.register_craftitem("input", {
inventory_image = "artifact_rmb_100.png",
range = 0,
on_drop = function(s, p, pos)
local m = artifact.players[p:get_player_name()]
if artifact.debug or artifat.story.state > artifact.story.states.pre_vix then
artifact.swap_character(m)
local _hand = minetest.registered_items[""]
function artifact.register_input(name)
artifact.register_node("input_"..name, {
inventory_image = "artifact_rmb_100.png",
description = "",
paramtype = "light",
drawtype = "mesh",
mesh = "artifact_hand.gltf",
tiles = {"artifact_"..name..".png"},
use_texture_alpha = "opaque",
visual_scale = 1,
wield_scale = vector.new(2,2,2),
node_placement_prediction = "",
on_construct = function(pos)
minetest.remove_node(pos)
end,
drop = "",
range = 0,
on_drop = function(s, p, pos)
local m = artifact.players[p:get_player_name()]
if artifact.debug or artifat.story.state > artifact.story.states.pre_vix then
artifact.swap_character(m)
end
return s
end
return s
end
})
})
end
artifact.register_input "key"
artifact.register_input "vix"
minetest.register_globalstep(function()

View file

@ -38,7 +38,7 @@ end
function ns.dismiss_radial_menu(m, name)
-- This is in case we only want to close a specific menu while leaving others intact.
if name and m._menu.name ~= name then return end
if name and (not m._menu or m._menu.name ~= name) then return end
for _, x in ipairs(m._menu) do
x:remove(m)
end