aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--advtrains/advtrains/atc.lua4
-rw-r--r--advtrains/advtrains/trainlogic.lua8
2 files changed, 8 insertions, 4 deletions
diff --git a/advtrains/advtrains/atc.lua b/advtrains/advtrains/atc.lua
index ece7075..2a4d226 100644
--- a/advtrains/advtrains/atc.lua
+++ b/advtrains/advtrains/atc.lua
@@ -23,11 +23,11 @@ end
function atc.send_command(pos)
local pts=minetest.pos_to_string(pos)
if atc.controllers[pts] then
- atprint("Called send_command at "..pts)
+ --atprint("Called send_command at "..pts)
local train_id = advtrains.detector.on_node[pts]
if train_id then
if advtrains.trains[train_id] then
- atprint("send_command inside if: "..sid(train_id))
+ --atprint("send_command inside if: "..sid(train_id))
atc.train_reset_command(train_id)
local arrowconn=atc.controllers[pts].arrowconn
local train=advtrains.trains[train_id]
diff --git a/advtrains/advtrains/trainlogic.lua b/advtrains/advtrains/trainlogic.lua
index c9c7403..5bedfec 100644
--- a/advtrains/advtrains/trainlogic.lua
+++ b/advtrains/advtrains/trainlogic.lua
@@ -474,7 +474,7 @@ function advtrains.update_trainpart_properties(train_id, invert_flipstate)
for i, w_id in ipairs(train.trainparts) do
local wagon=nil
for aoid,iwagon in pairs(minetest.luaentities) do
- if iwagon.is_wagon and iwagon.initialized and iwagon.unique_id==w_id then
+ if iwagon.is_wagon and iwagon.unique_id==w_id then
if wagon then
--duplicate
atprint("update_trainpart_properties: Removing duplicate wagon with id="..aoid)
@@ -488,7 +488,11 @@ function advtrains.update_trainpart_properties(train_id, invert_flipstate)
if advtrains.wagon_save[w_id] then
--spawn a new and initialize it with the properties from wagon_save
wagon=minetest.env:add_entity(train.last_pos, advtrains.wagon_save[w_id].entity_name):get_luaentity()
- wagon:init_from_wagon_save(w_id)
+ if not wagon then
+ minetest.chat_send_all("[advtrains] Warning: Wagon "..advtrains.wagon_save[w_id].entity_name.." does not exist. Make sure all required modules are loaded!")
+ else
+ wagon:init_from_wagon_save(w_id)
+ end
end
end
if wagon then