From 474fa1bfb8af0cf55c4d3c265779df24c783416a Mon Sep 17 00:00:00 2001 From: OgelGames Date: Sat, 23 Jan 2021 22:33:53 +1100 Subject: [PATCH] add formspec to filter --- filter.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/filter.lua b/filter.lua index 5b2ed2c..b4416e5 100644 --- a/filter.lua +++ b/filter.lua @@ -17,6 +17,15 @@ minetest.register_node("digicontrol:filter", { paramtype2 = "facedir", is_ground_content = false, groups = {digicontrol = 1, dig_immediate = 2}, + on_construct = function(pos) + minetest.get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, _, fields, sender) + if minetest.is_protected(pos, sender:get_player_name()) then return end + if fields.channel then + minetest.get_meta(pos):set_string("channel", fields.channel) + end + end, digiline = { semiconductor = { rules = function(node, pos, from, channel)