SussyCraft/mods/amogus_general/init.lua

52 lines
1.5 KiB
Lua
Raw Normal View History

2023-01-09 02:35:45 +01:00
minetest.register_on_joinplayer(function(player)
player:set_physics_override({speed = 2})
--player:set_sky({r=0, g=0, b=0}, "plain", {})
2023-02-01 19:28:51 +01:00
-- play music in loop without position
2023-02-12 16:07:35 +01:00
if true then
minetest.sound_play("amogus_incomming", {
to_player = player:get_player_name(),
loop = true,
gain = 1
})
end
end)
2023-02-12 16:07:35 +01:00
minetest.register_on_joinplayer(function(player)
2023-02-12 16:07:35 +01:00
player:set_lighting({
shadows = {intensity = 0.5}
})
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},
{"sus_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