diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..2cec86e --- /dev/null +++ b/depends.txt @@ -0,0 +1,2 @@ +default +digilines diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..7c6a0d4 --- /dev/null +++ b/init.lua @@ -0,0 +1,57 @@ +local function t21_digiline_receive(pos, node, channel, msg) + print(pos,node,channel,msg) +end + +minetest.register_node("test3d:t21", { + description = "T21 Execution Node", + tiles = { + { + image="t21.png", + animation={ + type = "vertical_frames", + aspect_w=16, + aspect_h=16, + length=18, + length=1.8, + }, + }, + }, + on_punch = function(pos, _, _, _) + local meta=minetest.get_meta(pos) + local cbeep = meta:get_int("test3d_running") +-- print("cbeep ",cbeep) + local nbeep=1 + if cbeep==1 then + nbeep=0 + else + nbeep=1 + end + meta:set_int("test3d_running",nbeep) + end, + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + digiline = { + receptor = {}, + effector = { + action = t21_digiline_receive + } + } +}) +minetest.register_abm({ + nodenames={"test3d:t21"}, + interval=1, + chance=1, + action = function(pos) + local node = minetest.get_node_or_nil(pos) + local meta = minetest.get_meta(pos) + local beepState = meta:get_int("test3d_running") + if beepState == nil then beepState=1 end +-- print(beepState) + if beepState == 1 then + minetest.sound_play("default_break_glass",{ + pos=pos, + max_hear_distance=100 + }) + end + end, +}) +print("Test3D loaded.") diff --git a/textures/t21.png b/textures/t21.png new file mode 100644 index 0000000..e5bfed3 Binary files /dev/null and b/textures/t21.png differ