diff options
author | orwell96 <orwell@bleipb.de> | 2018-01-07 20:52:15 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-01-07 20:52:15 +0100 |
commit | ae88f29481c83532f79dfa55d6ec6eb27e091bb6 (patch) | |
tree | 9da2d964b9ae6c181ab3894b7bf031baa98d4eb8 /advtrains_train_subway | |
parent | 1f26781b6a79135159205231f580beb06e789d4d (diff) | |
download | advtrains-ae88f29481c83532f79dfa55d6ec6eb27e091bb6.tar.gz advtrains-ae88f29481c83532f79dfa55d6ec6eb27e091bb6.tar.bz2 advtrains-ae88f29481c83532f79dfa55d6ec6eb27e091bb6.zip |
Don't use looped sounds on subway
(causes engine bugs with dangling sound handles)
Diffstat (limited to 'advtrains_train_subway')
-rw-r--r-- | advtrains_train_subway/init.lua | 10 | ||||
-rw-r--r-- | advtrains_train_subway/sounds/advtrains_subway_loop.ogg | bin | 19691 -> 33319 bytes |
2 files changed, 7 insertions, 3 deletions
diff --git a/advtrains_train_subway/init.lua b/advtrains_train_subway/init.lua index 2948fb8..b8dfa4b 100644 --- a/advtrains_train_subway/init.lua +++ b/advtrains_train_subway/init.lua @@ -76,7 +76,7 @@ advtrains.register_wagon("subway_wagon", { is_locomotive=true, drops={"default:steelblock 4"}, horn_sound = "advtrains_subway_horn", - custom_on_velocity_change = function(self, velocity, old_velocity) + custom_on_velocity_change = function(self, velocity, old_velocity, dtime) if not velocity or not old_velocity then return end if old_velocity == 0 and velocity > 0 then minetest.sound_play("advtrains_subway_depart", {object = self.object}) @@ -87,13 +87,17 @@ advtrains.register_wagon("subway_wagon", { 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}) + if velocity > 0 and (self.sound_loop_tmr or 0)<=0 then + self.sound_loop_handle = minetest.sound_play({name="advtrains_subway_loop", gain=0.3}, {object = self.object}) + self.sound_loop_tmr=3 + elseif velocity>0 then + self.sound_loop_tmr = self.sound_loop_tmr - dtime elseif velocity==0 then if self.sound_loop_handle then minetest.sound_stop(self.sound_loop_handle) self.sound_loop_handle = nil end + self.sound_loop_tmr=0 end end, }, S("Subway Passenger Wagon"), "advtrains_subway_wagon_inv.png") diff --git a/advtrains_train_subway/sounds/advtrains_subway_loop.ogg b/advtrains_train_subway/sounds/advtrains_subway_loop.ogg Binary files differindex 1a7021a..2543cc2 100644 --- a/advtrains_train_subway/sounds/advtrains_subway_loop.ogg +++ b/advtrains_train_subway/sounds/advtrains_subway_loop.ogg |