mirror of
https://github.com/mt-mods/xcompat.git
synced 2024-12-22 09:00:17 +01:00
merge sound api core into sound api
This commit is contained in:
commit
837f4ad1ed
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "sound_api_core"]
|
||||
path = sound_api_core
|
||||
url = https://github.com/mt-mods/sound_api_core.git
|
@ -1 +0,0 @@
|
||||
Subproject commit 39c02a99de4c00bae20d20534aa80d8aaa37eb88
|
5
sound_api_core/.luacheckrc
Normal file
5
sound_api_core/.luacheckrc
Normal file
@ -0,0 +1,5 @@
|
||||
read_globals = {
|
||||
"minetest", "mcl_sounds", "default", "ks_sounds",
|
||||
"nodes_nature", "fl_stone", "fl_topsoil", "fl_trees",
|
||||
"hades_sounds", "rp_sounds",
|
||||
}
|
19
sound_api_core/LICENSE
Normal file
19
sound_api_core/LICENSE
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
MIT Copyright 2021 wsor4035
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
297
sound_api_core/init.lua
Normal file
297
sound_api_core/init.lua
Normal file
@ -0,0 +1,297 @@
|
||||
local sound_api = {}
|
||||
|
||||
--convert some games for api usage
|
||||
|
||||
--ks_sounds conversion
|
||||
--currently loggy and bedrock are ignored
|
||||
local ks = {}
|
||||
|
||||
function ks.node_sound_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or ks_sounds.generalnode_sounds.footstep
|
||||
table.dug = table.dug or ks_sounds.generalnode_sounds.dug
|
||||
table.dig = table.dig or ks_sounds.generalnode_sounds.dig
|
||||
table.place = table.place or ks_sounds.generalnode_sounds.place
|
||||
return table
|
||||
end
|
||||
|
||||
function ks.node_sound_wood_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or ks_sounds.woodennode_sounds.footstep
|
||||
table.dug = table.dug or ks_sounds.woodennode_sounds.dug
|
||||
table.dig = table.dig or ks_sounds.woodennode_sounds.dig
|
||||
table.place = table.place or ks_sounds.woodennode_sounds.place
|
||||
ks.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ks.node_sound_leaves_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or ks_sounds.leafynode_sounds.footstep
|
||||
table.dug = table.dug or ks_sounds.leafynode_sounds.dug
|
||||
table.dig = table.dig or ks_sounds.leafynode_sounds.dig
|
||||
table.place = table.place or ks_sounds.leafynode_sounds.place
|
||||
ks.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function ks.node_sound_snow_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or ks_sounds.snowynode_sounds.footstep
|
||||
table.dug = table.dug or ks_sounds.snowynode_sounds.dug
|
||||
table.dig = table.dig or ks_sounds.snowynode_sounds.dig
|
||||
table.place = table.place or ks_sounds.snowynode_sounds.place
|
||||
ks.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
|
||||
--api
|
||||
function sound_api.node_sound_default(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_defaults(table)
|
||||
elseif minetest.get_modpath("ks_sounds") then
|
||||
return ks.node_sound_default(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_default(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_stone_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_stone_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_stone_defaults(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_stone_defaults(table)
|
||||
elseif minetest.get_modpath("fl_stone") then
|
||||
return fl_stone.sounds.stone(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_stone_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_stone_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_dirt_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_dirt_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_dirt_defaults(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_dirt_defaults(table)
|
||||
--s/dirt/grass
|
||||
elseif minetest.get_modpath("fl_topsoil") then
|
||||
return fl_topsoil.sounds.grass(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_dirt_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_dirt_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
--return dirt as some games use dirt vs grass
|
||||
function sound_api.node_sound_grass_defaults(table)
|
||||
if minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_grass_defaults(table)
|
||||
else
|
||||
return sound_api.node_sound_dirt_defaults(table)
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_sand_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_sand_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_sand_defaults(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_sand_defaults(table)
|
||||
elseif minetest.get_modpath("fl_stone") then
|
||||
return fl_stone.sounds.sand(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_sand_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_sand_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_gravel_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_gravel_defaults(table)
|
||||
--s/gravel/sand
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_sand_defaults(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_gravel_defaults(table)
|
||||
elseif minetest.get_modpath("fl_topsoil") then
|
||||
return fl_topsoil.sounds.gravel(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_gravel_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_wood_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_wood_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_wood_defaults(table)
|
||||
elseif minetest.get_modpath("ks_sounds") then
|
||||
return ks.node_sound_wood_default(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_wood_defaults(table)
|
||||
elseif minetest.get_modpath("fl_trees") then
|
||||
return fl_trees.sounds.wood(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_wood_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_wood_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_leaves_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_leaves_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_leaves_defaults(table)
|
||||
elseif minetest.get_modpath("ks_sounds") then
|
||||
return ks.node_sound_leaves_default(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_leaves_defaults(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_leaves_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_leaves_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_glass_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_glass_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_glass_defaults(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_glass_defaults(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_glass_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_glass_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function sound_api.node_sound_ice_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_ice_defaults(table)
|
||||
--s/ice/glass
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_glass_defaults(table)
|
||||
--s/ice/glass
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_glass_defaults(table)
|
||||
--s/ice/glass
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_glass_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_metal_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_metal_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_metal_defaults(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_metal_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_water_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_water_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_water_defaults(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_water_defaults(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_water_defaults(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_water_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_lava_defaults(table)
|
||||
--s/lava/water
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_water_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_lava_defaults(table)
|
||||
--s/lava/water
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_water_defaults(table)
|
||||
elseif minetest.get_modpath("hades_sounds") then
|
||||
return hades_sounds.node_sound_lava_defaults(table)
|
||||
--s/lava/water
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_water_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_snow_defaults(table)
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_snow_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_snow_defaults(table)
|
||||
elseif minetest.get_modpath("ks_sounds") then
|
||||
return ks.node_sound_snow_default(table)
|
||||
elseif minetest.get_modpath("nodes_nature") then
|
||||
return nodes_nature.node_sound_snow_defaults(table)
|
||||
elseif minetest.get_modpath("fl_topsoil") then
|
||||
return fl_topsoil.sounds.snow(table)
|
||||
elseif minetest.get_modpath("rp_sounds") then
|
||||
return rp_sounds.node_sound_snow_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
function sound_api.node_sound_wool_defaults(table)
|
||||
--s/wool/default
|
||||
if minetest.get_modpath("default") then
|
||||
return default.node_sound_defaults(table)
|
||||
elseif minetest.get_modpath("mcl_sounds") then
|
||||
return mcl_sounds.node_sound_wool_defaults(table)
|
||||
else
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
return sound_api
|
Loading…
Reference in New Issue
Block a user