diff options
-rw-r--r-- | doors.lua | 24 | ||||
-rw-r--r-- | sounds/celevator_door_close.ogg | bin | 0 -> 54709 bytes | |||
-rw-r--r-- | sounds/celevator_door_open.ogg | bin | 0 -> 40696 bytes | |||
-rw-r--r-- | sounds/celevator_door_reverse.ogg | bin | 0 -> 17991 bytes |
4 files changed, 24 insertions, 0 deletions
@@ -516,12 +516,31 @@ function celevator.doors.caropen(pos) time = 0, opendir = vector.rotate_around_axis(fdir,vector.new(0,1,0),-math.pi/2), } + minetest.sound_play("celevator_door_open",{ + pos = pos, + gain = 0.4, + max_hear_distance = 10 + },true) celevator.doors.erefs[hash] = erefs celevator.storage:set_string("cardoors_moving",minetest.serialize(cardoors_moving)) local meta = celevator.get_meta(pos) meta:set_string("doordata",minetest.serialize(cardoors_moving[hash])) meta:set_string("doorstate","opening") elseif cardoors_moving[hash].direction == "close" then + if cardoors_moving[hash].soundhandle then + minetest.sound_stop(cardoors_moving[hash].soundhandle) + end + minetest.sound_play("celevator_door_reverse",{ + pos = pos, + gain = 1, + max_hear_distance = 10 + },true) + minetest.sound_play("celevator_door_open",{ + pos = pos, + gain = 0.4, + start_time = math.max(0,2.75-cardoors_moving[hash].time), + max_hear_distance = 10 + },true) cardoors_moving[hash].direction = "open" cardoors_moving[hash].time = math.pi-cardoors_moving[hash].time celevator.storage:set_string("cardoors_moving",minetest.serialize(cardoors_moving)) @@ -552,6 +571,11 @@ function celevator.doors.carclose(pos) erefs[i]:set_pos(vector.add(erefs[i]:get_pos(),soffset)) end celevator.doors.erefs[hash] = erefs + data.soundhandle = minetest.sound_play("celevator_door_close",{ + pos = pos, + gain = 0.3, + max_hear_distance = 10 + }) cardoors_moving[hash] = data celevator.storage:set_string("cardoors_moving",minetest.serialize(cardoors_moving)) end diff --git a/sounds/celevator_door_close.ogg b/sounds/celevator_door_close.ogg Binary files differnew file mode 100644 index 0000000..d4153c5 --- /dev/null +++ b/sounds/celevator_door_close.ogg diff --git a/sounds/celevator_door_open.ogg b/sounds/celevator_door_open.ogg Binary files differnew file mode 100644 index 0000000..0070be5 --- /dev/null +++ b/sounds/celevator_door_open.ogg diff --git a/sounds/celevator_door_reverse.ogg b/sounds/celevator_door_reverse.ogg Binary files differnew file mode 100644 index 0000000..4f93391 --- /dev/null +++ b/sounds/celevator_door_reverse.ogg |