added random sounds and some little changes (little as you, little sussy baka)

This commit is contained in:
2023-01-31 22:14:39 +01:00
parent 97601cfe24
commit bc21a51a77
8 changed files with 91 additions and 38 deletions

View File

@@ -1,4 +1,35 @@
minetest.register_on_joinplayer(function(player)
player:set_physics_override({speed = 2})
--player:set_sky({r=0, g=0, b=0}, "plain", {})
end)
player:set_physics_override({speed = 2})
--player:set_sky({r=0, g=0, b=0}, "plain", {})
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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.