diff options
-rw-r--r-- | advtrains_train_industrial/init.lua | 1 | ||||
-rw-r--r-- | advtrains_train_industrial/sounds/advtrains_industrial_horn.ogg | bin | 0 -> 24325 bytes | |||
-rw-r--r-- | advtrains_train_japan/init.lua | 1 | ||||
-rw-r--r-- | advtrains_train_japan/sounds/advtrains_japan_horn.ogg | bin | 0 -> 39307 bytes | |||
-rwxr-xr-x | advtrains_train_steam/init.lua | 2 | ||||
-rw-r--r-- | advtrains_train_steam/sounds/advtrains_steam_whistle.ogg | bin | 0 -> 56532 bytes | |||
-rw-r--r-- | advtrains_train_subway/init.lua | 30 | ||||
-rw-r--r-- | advtrains_train_subway/sounds/advtrains_subway_arrive.ogg | bin | 0 -> 22658 bytes | |||
-rw-r--r-- | advtrains_train_subway/sounds/advtrains_subway_dclose.ogg | bin | 0 -> 14298 bytes | |||
-rw-r--r-- | advtrains_train_subway/sounds/advtrains_subway_depart.ogg | bin | 0 -> 39161 bytes | |||
-rw-r--r-- | advtrains_train_subway/sounds/advtrains_subway_dopen.ogg | bin | 0 -> 14307 bytes | |||
-rw-r--r-- | advtrains_train_subway/sounds/advtrains_subway_horn.ogg | bin | 0 -> 14370 bytes | |||
-rw-r--r-- | advtrains_train_subway/sounds/advtrains_subway_loop.ogg | bin | 0 -> 19691 bytes |
13 files changed, 28 insertions, 6 deletions
diff --git a/advtrains_train_industrial/init.lua b/advtrains_train_industrial/init.lua index ebf8d65..42804f3 100644 --- a/advtrains_train_industrial/init.lua +++ b/advtrains_train_industrial/init.lua @@ -39,6 +39,7 @@ advtrains.register_wagon("engine_industrial", { is_locomotive=true, collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, drops={"default:steelblock 4"}, + horn_sound = "advtrains_industrial_horn", }, S("Industrial Train Engine"), "advtrains_engine_industrial_inv.png") advtrains.register_wagon("wagon_tank", { mesh="advtrains_wagon_tank.b3d", diff --git a/advtrains_train_industrial/sounds/advtrains_industrial_horn.ogg b/advtrains_train_industrial/sounds/advtrains_industrial_horn.ogg Binary files differnew file mode 100644 index 0000000..2bc42c2 --- /dev/null +++ b/advtrains_train_industrial/sounds/advtrains_industrial_horn.ogg diff --git a/advtrains_train_japan/init.lua b/advtrains_train_japan/init.lua index 8816db3..6cf6c6d 100644 --- a/advtrains_train_japan/init.lua +++ b/advtrains_train_japan/init.lua @@ -72,6 +72,7 @@ advtrains.register_wagon("engine_japan", { is_locomotive=true, collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, drops={"default:steelblock 4"}, + horn_sound = "advtrains_japan_horn", }, S("Japanese Train Engine"), "advtrains_engine_japan_inv.png") advtrains.register_wagon("wagon_japan", { diff --git a/advtrains_train_japan/sounds/advtrains_japan_horn.ogg b/advtrains_train_japan/sounds/advtrains_japan_horn.ogg Binary files differnew file mode 100644 index 0000000..f7ddb14 --- /dev/null +++ b/advtrains_train_japan/sounds/advtrains_japan_horn.ogg diff --git a/advtrains_train_steam/init.lua b/advtrains_train_steam/init.lua index 37c63a0..b8d9adb 100755 --- a/advtrains_train_steam/init.lua +++ b/advtrains_train_steam/init.lua @@ -71,6 +71,7 @@ advtrains.register_wagon("newlocomotive", { }) end, drops={"default:steelblock 4"}, + horn_sound = "advtrains_steam_whistle", }, S("Steam Engine"), "advtrains_engine_steam_inv.png") advtrains.register_wagon("detailed_steam_engine", { @@ -139,6 +140,7 @@ advtrains.register_wagon("detailed_steam_engine", { }) end, drops={"default:steelblock 4"}, + horn_sound = "advtrains_steam_whistle", }, S("Detailed Steam Engine"), "advtrains_detailed_engine_steam_inv.png") advtrains.register_wagon("wagon_default", { diff --git a/advtrains_train_steam/sounds/advtrains_steam_whistle.ogg b/advtrains_train_steam/sounds/advtrains_steam_whistle.ogg Binary files differnew file mode 100644 index 0000000..42172a2 --- /dev/null +++ b/advtrains_train_steam/sounds/advtrains_steam_whistle.ogg diff --git a/advtrains_train_subway/init.lua b/advtrains_train_subway/init.lua index e3c73c9..f8e5e3b 100644 --- a/advtrains_train_subway/init.lua +++ b/advtrains_train_subway/init.lua @@ -59,11 +59,13 @@ advtrains.register_wagon("subway_wagon", { doors={ open={ [-1]={frames={x=0, y=20}, time=1}, - [1]={frames={x=40, y=60}, time=1} + [1]={frames={x=40, y=60}, time=1}, + sound = "advtrains_subway_dopen", }, close={ [-1]={frames={x=20, y=40}, time=1}, - [1]={frames={x=60, y=80}, time=1} + [1]={frames={x=60, y=80}, time=1}, + sound = "advtrains_subway_dclose", } }, door_entry={-1, 1}, @@ -73,10 +75,26 @@ advtrains.register_wagon("subway_wagon", { collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, is_locomotive=true, drops={"default:steelblock 4"}, - --custom_on_activate = function(self, dtime_s) - -- atprint("subway custom_on_activate") - -- self.object:set_animation({x=1,y=80}, 15, 0, true) - --end, + horn_sound = "advtrains_subway_horn", + custom_on_velocity_change = function(self, velocity, old_velocity) + if old_velocity == 0 and velocity > 0 then + minetest.sound_play("advtrains_subway_depart", {object = self.object}) + end + if velocity < 2 and (old_velocity >= 2 or old_velocity == velocity) and not self.sound_arrive_handle then + self.sound_arrive_handle = minetest.sound_play("advtrains_subway_arrive", {object = self.object}) + elseif (velocity > old_velocity) and self.sound_arrive_handle then + minetest.sound_stop(self.sound_arrive_handle) + self.sound_arrive_handle = nil + end + if velocity > 0 and not self.sound_loop_handle then + self.sound_loop_handle = minetest.sound_play({name="advtrains_subway_loop", gain=0.3}, {object = self.object, loop=true}) + elseif velocity==0 then + if self.sound_loop_handle then + minetest.sound_stop(self.sound_loop_handle) + self.sound_loop_handle = nil + end + end + end, }, S("Subway Passenger Wagon"), "advtrains_subway_wagon_inv.png") --wagons diff --git a/advtrains_train_subway/sounds/advtrains_subway_arrive.ogg b/advtrains_train_subway/sounds/advtrains_subway_arrive.ogg Binary files differnew file mode 100644 index 0000000..71bb90e --- /dev/null +++ b/advtrains_train_subway/sounds/advtrains_subway_arrive.ogg diff --git a/advtrains_train_subway/sounds/advtrains_subway_dclose.ogg b/advtrains_train_subway/sounds/advtrains_subway_dclose.ogg Binary files differnew file mode 100644 index 0000000..ffbc6ed --- /dev/null +++ b/advtrains_train_subway/sounds/advtrains_subway_dclose.ogg diff --git a/advtrains_train_subway/sounds/advtrains_subway_depart.ogg b/advtrains_train_subway/sounds/advtrains_subway_depart.ogg Binary files differnew file mode 100644 index 0000000..aca8cbc --- /dev/null +++ b/advtrains_train_subway/sounds/advtrains_subway_depart.ogg diff --git a/advtrains_train_subway/sounds/advtrains_subway_dopen.ogg b/advtrains_train_subway/sounds/advtrains_subway_dopen.ogg Binary files differnew file mode 100644 index 0000000..f1322df --- /dev/null +++ b/advtrains_train_subway/sounds/advtrains_subway_dopen.ogg diff --git a/advtrains_train_subway/sounds/advtrains_subway_horn.ogg b/advtrains_train_subway/sounds/advtrains_subway_horn.ogg Binary files differnew file mode 100644 index 0000000..f4519a3 --- /dev/null +++ b/advtrains_train_subway/sounds/advtrains_subway_horn.ogg diff --git a/advtrains_train_subway/sounds/advtrains_subway_loop.ogg b/advtrains_train_subway/sounds/advtrains_subway_loop.ogg Binary files differnew file mode 100644 index 0000000..1a7021a --- /dev/null +++ b/advtrains_train_subway/sounds/advtrains_subway_loop.ogg |