enabled sound by default

master
Sokomine 2019-03-09 22:36:55 +01:00
parent 74da8a296e
commit d5cf0ff79c
2 changed files with 11 additions and 7 deletions

View File

@ -119,3 +119,5 @@ travelnet.allow_travel = function( player_name, owner_name, network_name, statio
return true;
end
travelnet.travelnet_sound_enabled = true

View File

@ -820,13 +820,6 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
local target_pos = travelnet.targets[ owner_name ][ station_network ][ fields.target ].pos;
player:moveto( target_pos, false);
if( travelnet.travelnet_sound_enabled ) then
if ( this_node.name == 'travelnet:elevator' ) then
minetest.sound_play("travelnet_bell", {pos = pos, gain = 0.75, max_hear_distance = 10,});
else
minetest.sound_play("travelnet_travel", {pos = target_pos, gain = 0.75, max_hear_distance = 10,})
end
end
if( travelnet.travelnet_effect_enabled ) then
minetest.add_entity( {x=target_pos.x,y=target_pos.y+0.5,z=target_pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns
end
@ -860,6 +853,15 @@ travelnet.rotate_player = function( target_pos, player, tries )
return
end
-- play sound at the target position as well
if( travelnet.travelnet_sound_enabled ) then
if ( node2.name == 'travelnet:elevator' ) then
minetest.sound_play("travelnet_bell", {pos = target_pos, gain = 0.75, max_hear_distance = 10,});
else
minetest.sound_play("travelnet_travel", {pos = target_pos, gain = 0.75, max_hear_distance = 10,});
end
end
-- do this only on servers where the function exists
if( player.set_look_horizontal ) then
-- rotate the player so that he/she can walk straight out of the box