summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2024-04-24 18:35:56 -0500
committercheapie <no-email-for-you@example.com>2024-04-24 18:35:56 -0500
commit67449e63495dea49a16b3b3ac6eb39a20107f616 (patch)
tree7e46134bda3b2f38683c235a9d26f8acbf39b3ed
parent2a8d68aa28714df2fcd68e8d970e1f79e75eb0fe (diff)
downloadcelevator-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.lua24
-rw-r--r--sounds/celevator_door_close.oggbin0 -> 54709 bytes
-rw-r--r--sounds/celevator_door_open.oggbin0 -> 40696 bytes
-rw-r--r--sounds/celevator_door_reverse.oggbin0 -> 17991 bytes
4 files changed, 24 insertions, 0 deletions
diff --git a/doors.lua b/doors.lua
index f4c20c9..26e95b1 100644
--- a/doors.lua
+++ b/doors.lua
@@ -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
new file mode 100644
index 0000000..d4153c5
--- /dev/null
+++ b/sounds/celevator_door_close.ogg
Binary files differ
diff --git a/sounds/celevator_door_open.ogg b/sounds/celevator_door_open.ogg
new file mode 100644
index 0000000..0070be5
--- /dev/null
+++ b/sounds/celevator_door_open.ogg
Binary files differ
diff --git a/sounds/celevator_door_reverse.ogg b/sounds/celevator_door_reverse.ogg
new file mode 100644
index 0000000..4f93391
--- /dev/null
+++ b/sounds/celevator_door_reverse.ogg
Binary files differ