42 lines
1.4 KiB
Lua
42 lines
1.4 KiB
Lua
minetest.register_on_joinplayer(function(player)
|
|
player:set_physics_override({speed = 2})
|
|
--player:set_sky({r=0, g=0, b=0}, "plain", {})
|
|
|
|
-- play music in loop without position
|
|
--minetest.sound_play("amogus_incomming", {
|
|
-- to_player = player:get_player_name(),
|
|
-- loop = true,
|
|
-- gain = 1
|
|
--})
|
|
end)
|
|
|
|
amogus_general = { }
|
|
|
|
---- SOUNDS CONFIGURATION ----
|
|
sounds_config = {
|
|
-- format: {sound name, number of sounds to ramdomly choose from}
|
|
-- so for example if sound name is "test" and the number of sounds is 3, file names that will be randomly chosen are: "test1", "test2", "test3"
|
|
{"amogus_sound", 3},
|
|
}
|
|
|
|
|
|
-- randomized amogus sounds
|
|
function amogus_general.play_random_sound(sound_name, pos, gain, max_hear_distance, pitch)
|
|
-- get number of sounds from config
|
|
local number_of_sounds = nil
|
|
for i = 1, #sounds_config do
|
|
if sounds_config[i][1] == sound_name then
|
|
number_of_sounds = sounds_config[i][2]
|
|
break
|
|
end
|
|
end
|
|
|
|
assert(number_of_sounds ~= nil, "amogus_general.play_random_sound: sound with name '"..sound_name.."' is not found in sounds_config in mod amogus_general in init.lua")
|
|
|
|
minetest.sound_play(sound_name..math.random(number_of_sounds), {
|
|
pos = pos,
|
|
gain = gain,
|
|
max_hear_distance = max_hear_distance,
|
|
pitch = pitch
|
|
})
|
|
end |