51 lines
1.8 KiB
Lua
51 lines
1.8 KiB
Lua
|
|
minetest.register_craft({
|
|
output = "railcarts:digicontrol 12",
|
|
recipe = {
|
|
{"default:steel_ingot", "digilines:wire_std_00000000", "default:steel_ingot"},
|
|
{"default:steel_ingot", "default:stick", "default:steel_ingot"},
|
|
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
|
|
}
|
|
})
|
|
|
|
minetest.register_node("railcarts:digicontrol", {
|
|
description = "Digital Control Rail",
|
|
drawtype = "raillike",
|
|
tiles = {"railcarts_pa_carts_rail_digi.png",
|
|
"railcarts_pa_carts_rail_curved_digi.png",
|
|
"railcarts_pa_carts_rail_t_junction_digi.png",
|
|
"railcarts_pa_carts_rail_crossing_digi.png"},
|
|
inventory_image = "railcarts_pa_carts_rail_digi.png",
|
|
wield_image = "railcarts_pa_carts_rail_digi.png",
|
|
paramtype = "light",
|
|
is_ground_content = true,
|
|
walkable = false,
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
|
},
|
|
groups = {bendy=2,snappy=1,dig_immediate=2,attached_node=1,rail=1,connect_to_raillike=1},
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
|
meta:set_string("infotext", "none")
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string("channel", fields.channel)
|
|
end,
|
|
digiline =
|
|
{
|
|
receptor = {},
|
|
effector = {
|
|
action = function(pos, node, channel, msg)
|
|
local setchan = minetest.get_meta(pos):get_string("channel")
|
|
if setchan ~= channel then return end
|
|
local meta = minetest.env:get_meta(pos)
|
|
meta:set_string("infotext", msg)
|
|
end
|
|
},
|
|
},
|
|
})
|
|
|