From 176ee0627ebc397c60650fc5b059829788fe3cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Thu, 29 Dec 2016 00:27:07 +0100 Subject: Added privilege to remove trains --- trainlogic.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'trainlogic.lua') diff --git a/trainlogic.lua b/trainlogic.lua index 5e3936f..94dcb69 100644 --- a/trainlogic.lua +++ b/trainlogic.lua @@ -325,10 +325,12 @@ function advtrains.train_step(id, train, dtime) if found_uids[w_id] then --print(w_id.." still loaded") elseif advtrains.wagon_save[w_id] then - --print(w_id.." not loaded, but save available") - --spawn a new and initialize it with the properties from wagon_save - local le=minetest.env:add_entity(ori_pos, advtrains.wagon_save[w_id].entity_name):get_luaentity() - le:init_from_wagon_save(w_id) + --print(w_id.." not loaded, but save available") + --spawn a new and initialize it with the properties from wagon_save + local le=minetest.add_entity(ori_pos, advtrains.wagon_save[w_id].entity_name):get_luaentity() + if le then -- Don't crash if traintype has been removed + le:init_from_wagon_save(w_id) + end else print(w_id.." not loaded and no save available") --what the hell... -- cgit v1.2.3