summaryrefslogtreecommitdiff
path: root/advtrains_train_subway
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
commita152a188a65966a364614cdb0aa2613758c46f67 (patch)
treedff72d3aa22513d0132a21b5ed0ec16804822540 /advtrains_train_subway
parentdcf433b7e761788c88ccc70e7f1c71ea69f9e296 (diff)
downloadbasic_trains-a152a188a65966a364614cdb0aa2613758c46f67.tar.gz
basic_trains-a152a188a65966a364614cdb0aa2613758c46f67.tar.bz2
basic_trains-a152a188a65966a364614cdb0aa2613758c46f67.zip
Try to fix occasional crash when placing wagons
Diffstat (limited to 'advtrains_train_subway')
-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