music
parent
942fc3a379
commit
3f704f8b80
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
local music = false
|
||||||
|
local music_playing = false
|
||||||
|
local music_name = ""
|
||||||
|
local duration = 0
|
||||||
|
local gain = 0
|
||||||
|
|
||||||
|
minetest.register_globalstep(function()
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
local playername = player:get_player_name()
|
||||||
|
local pos = player:getpos()
|
||||||
|
local village_nodes = minetest.find_nodes_in_area({x=pos.x-5, y=pos.y-3, z=pos.z-5}, {x=pos.x+5, y=pos.y+5, z=pos.z+5}, {"stairs:slab_red", "stairs:slab_blue", "farming:straw"})
|
||||||
|
local boss_nodes = minetest.find_nodes_in_area({x=pos.x-5, y=pos.y-3, z=pos.z-5}, {x=pos.x+5, y=pos.y+5, z=pos.z+5}, {"hyrule_mapgen:volvagia_spawn", "hyrule_mapgen:ganon_spawn", "hyrule_mapgen:bongo_spawn", "hyrule_mapgen:dodongo_spawn"})
|
||||||
|
minetest.chat_send_all("boss_nodes:"..#boss_nodes.." village_nodes:"..#village_nodes)
|
||||||
|
|
||||||
|
if #boss_nodes ~= nil and #village_nodes ~= nil then
|
||||||
|
if #boss_nodes > 0 then
|
||||||
|
music = true
|
||||||
|
music_name = "BrassFleece"
|
||||||
|
duration = 105
|
||||||
|
gain = 0.8
|
||||||
|
elseif #village_nodes > 5 and math.random(1, 50) == 1 then
|
||||||
|
music = true
|
||||||
|
music_name = "Villageforest"
|
||||||
|
duration = 93
|
||||||
|
gain = 1
|
||||||
|
elseif math.random(1, 200) == 1 then
|
||||||
|
music = true
|
||||||
|
music_name = "Downtime"
|
||||||
|
duration = 75
|
||||||
|
gain = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if music and not music_playing then
|
||||||
|
minetest.sound_play(music_name, {to_player=playername, gain=gain})
|
||||||
|
music_playing = true
|
||||||
|
music = false
|
||||||
|
minetest.after(duration, function()
|
||||||
|
music_playing = false
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
|
||||||
|
License for Code
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Copyright (C) 2017 D00Med <heiselong@gmx.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
License for Textures, Models
|
||||||
|
---------------------------------------
|
||||||
|
CC BY-SA D00Med (see above)
|
||||||
|
|
||||||
|
Sounds - see /sounds/license.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
CC BY-SA 3.0
|
||||||
|
Sam Labbato https://soundcloud.com/sam-labbato
|
||||||
|
Noah K. https://www.youtube.com/channel/UCu8MTAFrihYO9PxKm-pk_xw
|
Loading…
Reference in New Issue