2018-12-01 09:06:00 -05:00
|
|
|
digistuff.sounds_playing = {}
|
|
|
|
|
|
|
|
minetest.register_node("digistuff:piezo", {
|
|
|
|
description = "Digilines Piezoelectric Beeper",
|
|
|
|
groups = {cracky=3},
|
|
|
|
on_construct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("formspec","field[channel;Channel;${channel}")
|
|
|
|
end,
|
|
|
|
on_destruct = function(pos)
|
|
|
|
local pos_hash = minetest.hash_node_position(pos)
|
|
|
|
if digistuff.sounds_playing[pos_hash] then
|
|
|
|
minetest.sound_stop(digistuff.sounds_playing[pos_hash])
|
|
|
|
digistuff.sounds_playing[pos_hash] = nil
|
|
|
|
end
|
|
|
|
end,
|
update biome_lib, bonemeal, digidisplay, digistuff, dreambuilder hotbar,
farming redo, roads, maptools, mesecons, moretrees, pipeworks,
rgblightstone, signs_lib, technic (except I kept it back from that
broken commit), unifiedmesecons, and worldedit
removed the inventory sorter mod
added my two dreambuilder management scripts (look in
dreambuilder_mp_extras)
2020-04-30 02:41:17 -04:00
|
|
|
_digistuff_channelcopier_fieldname = "channel",
|
2018-12-01 09:06:00 -05:00
|
|
|
tiles = {
|
|
|
|
"digistuff_piezo_top.png",
|
|
|
|
"digistuff_piezo_sides.png",
|
|
|
|
"digistuff_piezo_sides.png",
|
|
|
|
"digistuff_piezo_sides.png",
|
|
|
|
"digistuff_piezo_sides.png",
|
|
|
|
"digistuff_piezo_sides.png"
|
|
|
|
},
|
|
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
|
|
local name = sender:get_player_name()
|
|
|
|
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
|
|
|
|
minetest.record_protection_violation(pos,name)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
if fields.channel then meta:set_string("channel",fields.channel) end
|
|
|
|
end,
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
digiline =
|
2018-12-01 09:06:00 -05:00
|
|
|
{
|
|
|
|
receptor = {},
|
|
|
|
effector = {
|
|
|
|
action = function(pos,node,channel,msg)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local setchan = meta:get_string("channel")
|
|
|
|
if channel ~= setchan then return end
|
|
|
|
if msg == "shortbeep" then
|
|
|
|
local pos_hash = minetest.hash_node_position(pos)
|
|
|
|
if digistuff.sounds_playing[pos_hash] then
|
|
|
|
minetest.sound_stop(digistuff.sounds_playing[pos_hash])
|
|
|
|
digistuff.sounds_playing[pos_hash] = nil
|
|
|
|
end
|
|
|
|
minetest.sound_play({name = "digistuff_piezo_short_single",gain = 0.2},{pos = pos,max_hear_distance = 16})
|
|
|
|
elseif msg == "longbeep" then
|
|
|
|
local pos_hash = minetest.hash_node_position(pos)
|
|
|
|
if digistuff.sounds_playing[pos_hash] then
|
|
|
|
minetest.sound_stop(digistuff.sounds_playing[pos_hash])
|
|
|
|
digistuff.sounds_playing[pos_hash] = nil
|
|
|
|
end
|
|
|
|
minetest.sound_play({name = "digistuff_piezo_long_single",gain = 0.2},{pos = pos,max_hear_distance = 16})
|
|
|
|
elseif msg == "fastrepeat" then
|
|
|
|
local pos_hash = minetest.hash_node_position(pos)
|
|
|
|
if digistuff.sounds_playing[pos_hash] then
|
|
|
|
minetest.sound_stop(digistuff.sounds_playing[pos_hash])
|
|
|
|
digistuff.sounds_playing[pos_hash] = nil
|
|
|
|
end
|
|
|
|
digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_fast_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true})
|
|
|
|
elseif msg == "slowrepeat" then
|
|
|
|
local pos_hash = minetest.hash_node_position(pos)
|
|
|
|
if digistuff.sounds_playing[pos_hash] then
|
|
|
|
minetest.sound_stop(digistuff.sounds_playing[pos_hash])
|
|
|
|
digistuff.sounds_playing[pos_hash] = nil
|
|
|
|
end
|
|
|
|
digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_slow_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true})
|
|
|
|
elseif msg == "stop" then
|
|
|
|
local pos_hash = minetest.hash_node_position(pos)
|
|
|
|
if digistuff.sounds_playing[pos_hash] then
|
|
|
|
minetest.sound_stop(digistuff.sounds_playing[pos_hash])
|
|
|
|
digistuff.sounds_playing[pos_hash] = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "digistuff:piezo",
|
|
|
|
recipe = {
|
|
|
|
{"quartz:quartz_crystal_piece","basic_materials:steel_strip"},
|
|
|
|
{"digilines:wire_std_00000000","mesecons_luacontroller:luacontroller0000"},
|
|
|
|
},
|
|
|
|
})
|