aboutsummaryrefslogtreecommitdiff
path: root/wagons.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-10-26 15:44:35 +0200
committerorwell96 <mono96.mml@gmail.com>2016-10-26 15:44:35 +0200
commitf6576b6a6a133069a6e3f734c1cc7d236ad79676 (patch)
tree03492cb021ee308958021b0fc0fef00746761597 /wagons.lua
parent6a406505ea1c12e8bce7836b245042abb83c3f8c (diff)
downloadadvtrains-f6576b6a6a133069a6e3f734c1cc7d236ad79676.tar.gz
advtrains-f6576b6a6a133069a6e3f734c1cc7d236ad79676.tar.bz2
advtrains-f6576b6a6a133069a6e3f734c1cc7d236ad79676.zip
fix crash on getting on wagon, caused by nonexistant table
Diffstat (limited to 'wagons.lua')
-rw-r--r--wagons.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/wagons.lua b/wagons.lua
index 1966ebe..044ef5c 100644
--- a/wagons.lua
+++ b/wagons.lua
@@ -193,6 +193,9 @@ function wagon:on_step(dtime)
elseif not self.initialized then
self.initialized=true
end
+ if not self.seatp then
+ self.seatp={}
+ end
--re-attach driver if he got lost
--if not self.driver and self.driver_name then
@@ -213,9 +216,6 @@ function wagon:on_step(dtime)
--driver control
for seatno, seat in ipairs(self.seats) do
if seat.driving_ctrl_access then
- if not self.seatp then
- self.seatp={}
- end
local driver=self.seatp[seatno] and minetest.get_player_by_name(self.seatp[seatno])
if driver and driver:get_player_control_bits()~=self.old_player_control_bits then
local pc=driver:get_player_control()