mirror of
https://cheapiesystems.com/git/digistuff
synced 2024-08-19 20:44:11 +02:00
Miscellaneous touchscreen and noteblock work
* Noteblock sound list updated * Noteblocks now support pitch control * Touchscreens can now optionally use the "real coordinates" system
This commit is contained in:
parent
8384563085
commit
69a9304751
26
nbsounds.lua
26
nbsounds.lua
@ -29,9 +29,10 @@ local valid_sounds = {
|
|||||||
crash = "mesecons_noteblock_crash",
|
crash = "mesecons_noteblock_crash",
|
||||||
litecrash = "mesecons_noteblock_litecrash",
|
litecrash = "mesecons_noteblock_litecrash",
|
||||||
fire = "fire_large",
|
fire = "fire_large",
|
||||||
explosion = "tnt_explode",
|
|
||||||
digistuff_piezo_short = "digistuff_piezo_short_single",
|
digistuff_piezo_short = "digistuff_piezo_short_single",
|
||||||
digistuff_piezo_long = "digistuff_piezo_long_single"
|
digistuff_piezo_long = "digistuff_piezo_long_single",
|
||||||
|
digistuff_piston_extend = "digistuff_piston_extend",
|
||||||
|
digistuff_piston_retract = "digistuff_piston_retract",
|
||||||
}
|
}
|
||||||
|
|
||||||
local mod_sounds = {
|
local mod_sounds = {
|
||||||
@ -54,19 +55,28 @@ local mod_sounds = {
|
|||||||
fake_fire = {
|
fake_fire = {
|
||||||
fake_fire_extinguish = "fire_extinguish"
|
fake_fire_extinguish = "fire_extinguish"
|
||||||
},
|
},
|
||||||
homedecor = {
|
homedecor_doors_and_gates = {
|
||||||
homedecor_book_close = "homedecor_book_close",
|
homedecor_book_close = "homedecor_book_close",
|
||||||
homedecor_doorbell = "homedecor_doorbell",
|
|
||||||
homedecor_door_close = "homedecor_door_close",
|
homedecor_door_close = "homedecor_door_close",
|
||||||
homedecor_door_open = "homedecor_door_open",
|
homedecor_door_open = "homedecor_door_open",
|
||||||
homedecor_faucet = "homedecor_faucet",
|
|
||||||
homedecor_gate = "homedecor_gate_open_close",
|
homedecor_gate = "homedecor_gate_open_close",
|
||||||
|
},
|
||||||
|
homedecor_bathroom = {
|
||||||
homedecor_shower = "homedecor_shower",
|
homedecor_shower = "homedecor_shower",
|
||||||
homedecor_telephone = "homedecor_telephone_ringing",
|
|
||||||
homedecor_toilet = "homedecor_toilet_flush",
|
homedecor_toilet = "homedecor_toilet_flush",
|
||||||
homedecor_trash = "homedecor_trash_all",
|
},
|
||||||
|
homedecor_common = {
|
||||||
|
homedecor_faucet = "homedecor_faucet",
|
||||||
|
},
|
||||||
|
homedecor_electrical = {
|
||||||
|
homedecor_doorbell = "homedecor_doorbell",
|
||||||
|
},
|
||||||
|
homedecor_gastronomy = {
|
||||||
homedecor_insert_coin = "insert_coin",
|
homedecor_insert_coin = "insert_coin",
|
||||||
homedecor_toaster = "toaster"
|
homedecor_toaster = "toaster",
|
||||||
|
},
|
||||||
|
homedecor_trash_cans = {
|
||||||
|
homedecor_trash = "homedecor_trash_all",
|
||||||
},
|
},
|
||||||
infrastructure = {
|
infrastructure = {
|
||||||
infrastructure_emergency_phone = "infrastructure_emergency_phone"
|
infrastructure_emergency_phone = "infrastructure_emergency_phone"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
if not minetest.get_modpath("mesecons_noteblock") then
|
if not minetest.get_modpath("mesecons_noteblock") then
|
||||||
minetest.log("error","mesecons_noteblock is not installed - digilines noteblock will not be available!")
|
minetest.log("warning","mesecons_noteblock is not installed - digilines noteblock will not be available!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,12 +51,23 @@ minetest.register_node("digistuff:noteblock", {
|
|||||||
if sound then minetest.sound_play(sound,{pos=pos}) end
|
if sound then minetest.sound_play(sound,{pos=pos}) end
|
||||||
elseif type(msg) == "table" then
|
elseif type(msg) == "table" then
|
||||||
if type(msg.sound) ~= "string" then return end
|
if type(msg.sound) ~= "string" then return end
|
||||||
|
for _,i in ipairs({"pitch","speed","volume","gain",}) do
|
||||||
|
if type(msg[i]) == "string" then
|
||||||
|
msg[i] = tonumber(msg[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
local sound = validnbsounds[msg.sound]
|
local sound = validnbsounds[msg.sound]
|
||||||
|
if not msg.volume then msg.volume = msg.gain end
|
||||||
local volume = 1
|
local volume = 1
|
||||||
if type(msg.volume) == "number" then
|
if type(msg.volume) == "number" then
|
||||||
volume = math.max(0,math.min(1,msg.volume))
|
volume = math.max(0,math.min(1,msg.volume))
|
||||||
end
|
end
|
||||||
if sound then minetest.sound_play({name=sound,gain=volume},{pos=pos}) end
|
if not msg.pitch then msg.pitch = msg.speed end
|
||||||
|
local pitch = 1
|
||||||
|
if type(msg.pitch) == "number" then
|
||||||
|
pitch = math.max(0.05,math.min(10,msg.pitch))
|
||||||
|
end
|
||||||
|
if sound then minetest.sound_play({name = sound,gain = volume,},{pos = pos,pitch = pitch,},true) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
@ -2,6 +2,9 @@ digistuff.update_ts_formspec = function (pos)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local fs = "size[10,8]"..
|
local fs = "size[10,8]"..
|
||||||
"background[0,0;0,0;digistuff_ts_bg.png;true]"
|
"background[0,0;0,0;digistuff_ts_bg.png;true]"
|
||||||
|
if meta:get_int("realcoordinates") > 0 then
|
||||||
|
fs = fs.."real_coordinates[true]"
|
||||||
|
end
|
||||||
if meta:get_int("init") == 0 then
|
if meta:get_int("init") == 0 then
|
||||||
fs = fs.."field[3.75,3;3,1;channel;Channel;]"..
|
fs = fs.."field[3.75,3;3,1;channel;Channel;]"..
|
||||||
"button_exit[4,3.75;2,1;save;Save]"
|
"button_exit[4,3.75;2,1;save;Save]"
|
||||||
@ -80,6 +83,8 @@ end
|
|||||||
digistuff.process_command = function (meta, data, msg)
|
digistuff.process_command = function (meta, data, msg)
|
||||||
if msg.command == "clear" then
|
if msg.command == "clear" then
|
||||||
data = {}
|
data = {}
|
||||||
|
elseif msg.command == "realcoordinates" then
|
||||||
|
meta:set_int("realcoordinates",msg.enabled and 1 or 0)
|
||||||
elseif msg.command == "addimage" then
|
elseif msg.command == "addimage" then
|
||||||
for _,i in pairs({"X","Y","W","H"}) do
|
for _,i in pairs({"X","Y","W","H"}) do
|
||||||
if not msg[i] or type(msg[i]) ~= "number" then
|
if not msg[i] or type(msg[i]) ~= "number" then
|
||||||
|
Loading…
Reference in New Issue
Block a user