Added ambient sounds.

master
Nathan Salapat 2020-09-05 20:59:36 -05:00
parent 3da439b815
commit 61ec69cbf9
15 changed files with 95 additions and 6 deletions

View File

@ -29,7 +29,7 @@ local add_schem = function(place_on, fill_ratio, biomes, y_min, y_max, schematic
end
add_schem({"default:sand", "default:dirt_with_grass"}, 0.005, {"grassland", "grassland_dunes"}, 1, 100,
add_schem({"default:sand", "default:dirt_with_grass"}, 0.003, {"grassland", "grassland_dunes"}, 1, 100,
epic_trees.bananatree, 1)
add_schem({"default:sand", "default:dirt_with_grass"}, 0.005, {"grassland", "grassland_dunes"}, 1, 100,
add_schem({"default:sand", "default:dirt_with_grass"}, 0.003, {"grassland", "grassland_dunes"}, 1, 100,
epic_trees.orangetree, 1)

View File

@ -52,14 +52,14 @@ for i in ipairs(letters) do
groups = {dig_immediate = 2, attached_node = 1},
on_rightclick = function(pos, node, clicker)
local player_name = clicker:get_player_name()
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(user, 'protection_bypass') then
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(clicker, 'protection_bypass') then
return
end
minetest.swap_node(pos, {name = node.name, param2 = node.param2+8})
end,
on_punch = function(pos, node, puncher, pointed_thing)
local player_name = puncher:get_player_name()
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(user, 'protection_bypass') then
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(puncher, 'protection_bypass') then
return
end
minetest.swap_node(pos, {name = node.name, param2 = node.param2-8})

23
mods/sounds/credits.txt Normal file
View File

@ -0,0 +1,23 @@
ocean_beach from https://freesound.org/people/blimp66/sounds/407430/
Licensed as Creative Commons Attribution.
jungle from https://freesound.org/people/aurelien.leveque/sounds/417635/
Licensed as Creative Commons 0
grassland from https://freesound.org/people/dsebeste/sounds/351609/
Licensed as Creative Commons 0
woods from 349035__craftcrest__spring-in-the-woods-front
Licensed as Creative Commons Attribution
desert from https://freesound.org/people/bruno.auzet/sounds/528081/
Licensed as Creative Commons 0
icesheet from https://freesound.org/people/DBlover/sounds/405601/
Licensed as Creative Commons 0
coniferous_forest from https://freesound.org/people/chris_dagorne/sounds/181359/
Licensed as Creative Commons 0
Savanna from https://freesound.org/people/reinsamba/sounds/58230/
Licensed as Creative Commons Attribution

62
mods/sounds/init.lua Normal file
View File

@ -0,0 +1,62 @@
sounds = {}
minetest.register_node('sounds:test', {
description = 'biome test',
tiles = {'letters_station.png'},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = {
type = 'fixed',
fixed = {-.5, -.5, -.5, .5, .5, .5}},
collision_box = {
type = 'fixed',
fixed = {-.5, -.5, -.5, .5, .5, .5}},
groups = {oddly_breakable_by_hand=2, choppy=3, not_in_creative_inventory=1},
on_punch = function(pos, node, puncher, pointed_thing)
local player_name = puncher:get_player_name()
local biome_data = minetest.get_biome_data(pos)
local biome_id = biome_data.biome
local biome_name = minetest.get_biome_name(biome_id)
minetest.chat_send_player(player_name, 'You are in a '..biome_name..' biome.')
sounds.play_sound(puncher)
end
})
function sounds.random_player()
local key = #(minetest.get_connected_players())
local people = minetest.get_connected_players()
local person = math.random(1, key)
local name = people[person] --userdata
sounds.play_sound(name)
end
function sounds.play_sound(player)
local pos = player:get_pos()
if pos.y > -20 and pos.y < 500 then
local player_name = player:get_player_name()
local biome_data = minetest.get_biome_data(pos)
local biome_id = biome_data.biome
local biome_name = minetest.get_biome_name(biome_id)
print ('biome_name is '..biome_name)
if biome_name == 'grassland_ocean' or biome_name == 'snowy_grassland_ocean'
or biome_name == 'savanna_ocean' or biome_name == 'taiga_ocean' then
minetest.sound_play('ocean_beach', {to_player = player_name, gain = .5})
elseif biome_name == 'rainforest' then
minetest.sound_play('rainforest', {to_player = player_name, gain = .75})
elseif biome_name == 'grassland' then
minetest.sound_play('grassland', {to_player = player_name, gain = .75})
elseif biome_name == 'deciduous_forest' then
minetest.sound_play('deciduous_forest', {to_player = player_name, gain = .75})
elseif biome_name == 'coniferous_forest' then
minetest.sound_play('coniferous_forest', {to_player = player_name, gain = .75})
elseif biome_name == 'desert' or biome_name == 'sandstone_desert' then
minetest.sound_play('desert', {to_player = player_name, gain = .75})
elseif biome_name == 'icesheet' then
minetest.sound_play('icesheet', {to_player = player_name, gain = .75})
elseif biome_name == 'savanna' then
minetest.sound_play('savanna', {to_player = player_name, gain = .7})
elseif biome_name == 'tundra' then
minetest.sound_play('tundra', {to_player = player_name, gain = .7})
end
end
end

1
mods/sounds/mod.conf Normal file
View File

@ -0,0 +1 @@
name = sounds

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,7 @@
local news = {
'9/5/20',
'Added some abmbient sounds for different biomes.',
'',
'8/28/20',
'Added letters mod, you can now make names on buildings.',
'',

View File

@ -127,7 +127,7 @@ mobs:spawn({
max_height = 7000,
})
mobs:register_egg('viron:viron_mob', 'Viron', 'viron_viron_egg.png', 1)
--mobs:register_egg('viron:viron_mob', 'Viron', 'viron_viron_egg.png', 1)
--Queen
@ -253,7 +253,7 @@ mobs:spawn({
max_height = 7000,
})
mobs:register_egg('viron:viron_queen', 'Viron Queen', 'viron_viron_egg.png', 1)
--mobs:register_egg('viron:viron_queen', 'Viron Queen', 'viron_viron_egg.png', 1)
------------------------------Larve-----------------------------------------