Compare commits
5 Commits
807d4ca724
...
4191aaf9a6
Author | SHA1 | Date |
---|---|---|
BuckarooBanzay | 4191aaf9a6 | |
BuckarooBanzay | 75348a580b | |
BuckarooBanzay | 87738918ab | |
BuckarooBanzay | b9a5d135f1 | |
Thomas Rudin | 9b1d5c3903 |
|
@ -0,0 +1,17 @@
|
|||
name: luacheck
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: apt
|
||||
run: sudo apt-get install -y luarocks
|
||||
- name: luacheck install
|
||||
run: luarocks install --local luacheck
|
||||
- name: luacheck run
|
||||
run: $HOME/.luarocks/bin/luacheck ./
|
|
@ -10,6 +10,9 @@ read_globals = {
|
|||
|
||||
-- Minetest
|
||||
"minetest",
|
||||
"vector", "ItemStack"
|
||||
"vector", "ItemStack",
|
||||
|
||||
-- mods
|
||||
"digilines"
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
default?
|
||||
doors?
|
||||
mesecons?
|
||||
technic?
|
||||
ambience?
|
||||
mobs_monster?
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
soundblock.digiline_rules = {
|
||||
-- digilines.rules.default
|
||||
{x= 1,y= 0,z= 0},{x=-1,y= 0,z= 0}, -- along x side
|
||||
{x= 0,y= 0,z= 1},{x= 0,y= 0,z=-1}, -- along z side
|
||||
{x= 1,y= 1,z= 0},{x=-1,y= 1,z= 0}, -- 1 node above along x diagonal
|
||||
{x= 0,y= 1,z= 1},{x= 0,y= 1,z=-1}, -- 1 node above along z diagonal
|
||||
{x= 1,y=-1,z= 0},{x=-1,y=-1,z= 0}, -- 1 node below along x diagonal
|
||||
{x= 0,y=-1,z= 1},{x= 0,y=-1,z=-1}, -- 1 node below along z diagonal
|
||||
{x= 0,y= 1,z= 0},{x= 0,y=-1,z= 0}, -- along y above and below
|
||||
}
|
||||
|
||||
function soundblock.digiline_effector(pos, _, channel, msg)
|
||||
local msgt = type(msg)
|
||||
if msgt ~= "table" then
|
||||
return
|
||||
end
|
||||
|
||||
if channel ~= "soundblock" then
|
||||
return
|
||||
end
|
||||
|
||||
if msg.command == "play" then
|
||||
-- default position
|
||||
|
||||
local playpos = pos
|
||||
if msg.pos then
|
||||
-- relative position offset
|
||||
playpos = vector.add(pos, {
|
||||
x = tonumber(msg.pos.x) or 0,
|
||||
y = tonumber(msg.pos.y) or 0,
|
||||
z = tonumber(msg.pos.z) or 0
|
||||
})
|
||||
end
|
||||
|
||||
minetest.sound_play(msg.name, {
|
||||
pos = playpos,
|
||||
gain = math.min(10, tonumber(msg.gain) or 1),
|
||||
max_hear_distance = math.min(32, tonumber(msg.hear_distance) or 10)
|
||||
})
|
||||
end
|
||||
end
|
10
form.lua
10
form.lua
|
@ -91,10 +91,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
|
||||
if fields.toggle_state then
|
||||
if state == "on" then
|
||||
state = "mesecons"
|
||||
timer:stop()
|
||||
|
||||
elseif state == "mesecons" then
|
||||
state = "off"
|
||||
timer:stop()
|
||||
|
||||
|
@ -129,9 +125,5 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end
|
||||
end
|
||||
|
||||
if state == "on" then
|
||||
timer:start(0)
|
||||
end
|
||||
|
||||
|
||||
timer:start(0)
|
||||
end)
|
||||
|
|
5
init.lua
5
init.lua
|
@ -6,6 +6,7 @@ soundblock = {
|
|||
local MP = minetest.get_modpath("soundblock")
|
||||
dofile(MP.."/api.lua")
|
||||
dofile(MP.."/form.lua")
|
||||
dofile(MP.."/digiline.lua")
|
||||
dofile(MP.."/soundblock.lua")
|
||||
dofile(MP.."/recipe.lua")
|
||||
|
||||
|
@ -13,6 +14,10 @@ if minetest.get_modpath("default") then
|
|||
dofile(MP.."/mods/default.lua")
|
||||
end
|
||||
|
||||
if minetest.get_modpath("horror") then
|
||||
dofile(MP.."/mods/horror.lua")
|
||||
end
|
||||
|
||||
if minetest.get_modpath("doors") then
|
||||
dofile(MP.."/mods/doors.lua")
|
||||
end
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
name = soundblock
|
||||
description = Soundblock
|
||||
optional_depends = default, doors, horror, mesecons, technic, ambience, mobs_monster, digilines
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
for i=1,7 do
|
||||
soundblock.register({
|
||||
filename = "horror_" .. i,
|
||||
key = "horror_" .. i,
|
||||
name = "Horror track " .. i
|
||||
})
|
||||
end
|
||||
|
||||
soundblock.register({
|
||||
filename = "clock",
|
||||
key = "horror_clock",
|
||||
name = "Horror clock"
|
||||
})
|
||||
|
||||
soundblock.register({
|
||||
filename = "clock_strikes_twelve",
|
||||
key = "clock_strikes_twelve",
|
||||
name = "Horror clock strikes twelve"
|
||||
})
|
||||
|
||||
soundblock.register({
|
||||
filename = "Undersea_Garden",
|
||||
key = "Undersea_Garden",
|
||||
name = "Horror undersea garden"
|
||||
})
|
15
readme.md
15
readme.md
|
@ -25,7 +25,22 @@ soundblocks.register({
|
|||
|
||||
```
|
||||
|
||||
# Digiline api
|
||||
|
||||
```lua
|
||||
if event.type == "program" then
|
||||
digiline_send("soundblock", {
|
||||
command = "play",
|
||||
name = "default_grass_footstep.1.ogg",
|
||||
-- relative position (optional)
|
||||
pos = { x=0, y=10, z=0 },
|
||||
-- gain, defaults to 1
|
||||
gain = 1,
|
||||
-- max_hear_distance, defaults to 10
|
||||
hear_distance = 32
|
||||
})
|
||||
end
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
|
|
|
@ -97,13 +97,34 @@ minetest.register_node("soundblock:block", {
|
|||
mesecons = {
|
||||
effector = {
|
||||
action_on = function (pos)
|
||||
execute(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("state", "on")
|
||||
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(0)
|
||||
end,
|
||||
action_off = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("state", "off")
|
||||
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:stop()
|
||||
|
||||
stop_sound(pos)
|
||||
end
|
||||
}
|
||||
},
|
||||
|
||||
digiline = {
|
||||
receptor = {
|
||||
rules = soundblock.digiline_rules,
|
||||
action = function() end
|
||||
},
|
||||
effector = {
|
||||
rules = soundblock.digiline_rules,
|
||||
action = soundblock.digiline_effector
|
||||
}
|
||||
},
|
||||
|
||||
on_rightclick = soundblock.showform
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue