58 lines
1.2 KiB
Lua
58 lines
1.2 KiB
Lua
|
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.")
|