aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_subway/init.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-12-17 13:21:56 +0100
committerGitHub <noreply@github.com>2017-12-17 13:21:56 +0100
commitae3452a39c1da11860c44b2a3fe6dc98c7420e90 (patch)
tree25c23612b44ab31bb6ba418a96a5c4bf895c59c5 /advtrains_train_subway/init.lua
parent875eb90acbc07636a02d28f8002e369b631eb961 (diff)
downloadadvtrains-ae3452a39c1da11860c44b2a3fe6dc98c7420e90.tar.gz
advtrains-ae3452a39c1da11860c44b2a3fe6dc98c7420e90.tar.bz2
advtrains-ae3452a39c1da11860c44b2a3fe6dc98c7420e90.zip
Try to fix occasional crash when placing wagons
Diffstat (limited to 'advtrains_train_subway/init.lua')
-rw-r--r--advtrains_train_subway/init.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/advtrains_train_subway/init.lua b/advtrains_train_subway/init.lua
index f8e5e3b..9dd6f28 100644
--- a/advtrains_train_subway/init.lua
+++ b/advtrains_train_subway/init.lua
@@ -77,6 +77,7 @@ advtrains.register_wagon("subway_wagon", {
drops={"default:steelblock 4"},
horn_sound = "advtrains_subway_horn",
custom_on_velocity_change = function(self, velocity, old_velocity)
+ 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})
end