diff options
author | cheapie <no-email-for-you@example.com> | 2024-04-24 18:35:56 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-04-24 18:35:56 -0500 |
commit | 67449e63495dea49a16b3b3ac6eb39a20107f616 (patch) | |
tree | 7e46134bda3b2f38683c235a9d26f8acbf39b3ed | |
parent | 2a8d68aa28714df2fcd68e8d970e1f79e75eb0fe (diff) | |
download | celevator-67449e63495dea49a16b3b3ac6eb39a20107f616.tar celevator-67449e63495dea49a16b3b3ac6eb39a20107f616.tar.gz celevator-67449e63495dea49a16b3b3ac6eb39a20107f616.tar.bz2 celevator-67449e63495dea49a16b3b3ac6eb39a20107f616.tar.xz celevator-67449e63495dea49a16b3b3ac6eb39a20107f616.zip |
Add door open/close sounds
-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 |