tests: include sounds.node groups
This commit is contained in:
parent
bcc5886411
commit
3cc59cae3c
3
TODO.txt
3
TODO.txt
@ -6,8 +6,11 @@ TODO:
|
|||||||
- create SoundGroup instances for all cached mod sounds
|
- create SoundGroup instances for all cached mod sounds
|
||||||
- fix "node_dug_meta" & "node_place_metal" are the same
|
- fix "node_dug_meta" & "node_place_metal" are the same
|
||||||
- add localization support
|
- add localization support
|
||||||
|
- create sounds.glass group
|
||||||
- tests:
|
- tests:
|
||||||
- add sounds.node groups
|
- add sounds.node groups
|
||||||
|
- note number of sounds for random sounds
|
||||||
|
- fix wrong sound selected when changing groups (example: select #2, switch to group with one sound, switch to group with two sounds, press play)
|
||||||
- add more sounds:
|
- add more sounds:
|
||||||
- hit/damage
|
- hit/damage
|
||||||
- add sounds from:
|
- add sounds from:
|
||||||
|
39
tests.lua
39
tests.lua
@ -39,6 +39,18 @@ local get_tests_fs = function(pname)
|
|||||||
table.insert(groups_list, k)
|
table.insert(groups_list, k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for nk in pairs(sounds.node) do
|
||||||
|
if type(sounds.node[nk]) == "SoundGroup" then
|
||||||
|
table.insert(groups_list, "node." .. nk)
|
||||||
|
end
|
||||||
|
for nnk in pairs(sounds.node[nk]) do
|
||||||
|
if type(sounds.node[nk][nnk]) == "SoundGroup" then
|
||||||
|
table.insert(groups_list, "node." .. nk .. "." .. nnk)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
table.sort(groups_list)
|
table.sort(groups_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -55,8 +67,19 @@ local get_tests_fs = function(pname)
|
|||||||
fs = fs .. g .. "]"
|
fs = fs .. g .. "]"
|
||||||
.. "textlist[8.75,4;" .. fs_w-(5.5*2) .. "," .. fs_h-4.25 .. ";gsounds;"
|
.. "textlist[8.75,4;" .. fs_w-(5.5*2) .. "," .. fs_h-4.25 .. ";gsounds;"
|
||||||
|
|
||||||
if player_cache[pname] and player_cache[pname].selected_group then
|
if p_cache.selected_group then
|
||||||
local s_group = sounds[groups_list[player_cache[pname].selected_group]]
|
--local s_group = sounds[groups_list[player_cache[pname].selected_group]]
|
||||||
|
local group_name = groups_list[p_cache.selected_group]
|
||||||
|
local s_group
|
||||||
|
if string.find(group_name, ".") then
|
||||||
|
s_group = sounds
|
||||||
|
for _, subgroup in ipairs(group_name:split(".")) do
|
||||||
|
s_group = s_group[subgroup]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
s_group = sounds[group_name]
|
||||||
|
end
|
||||||
|
|
||||||
local s = ""
|
local s = ""
|
||||||
local s_added = 0
|
local s_added = 0
|
||||||
for _, s_name in ipairs(s_group) do
|
for _, s_name in ipairs(s_group) do
|
||||||
@ -161,7 +184,17 @@ core.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
if p_cache then
|
if p_cache then
|
||||||
local selected_group = p_cache.selected_group
|
local selected_group = p_cache.selected_group
|
||||||
if selected_group then
|
if selected_group then
|
||||||
local sound_group = sounds[groups_list[selected_group]]
|
local group_name = groups_list[selected_group]
|
||||||
|
local sound_group
|
||||||
|
if string.find(group_name, ".") then
|
||||||
|
sound_group = sounds
|
||||||
|
for _, subgroup in ipairs(group_name:split(".")) do
|
||||||
|
sound_group = sound_group[subgroup]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sound_group = sounds[sound_group]
|
||||||
|
end
|
||||||
|
|
||||||
if type(sound_group) == "SoundGroup" then
|
if type(sound_group) == "SoundGroup" then
|
||||||
local s_idx = p_cache.selected_sound or 1
|
local s_idx = p_cache.selected_sound or 1
|
||||||
local s_count = sound_group:count()
|
local s_count = sound_group:count()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user