diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2016-12-29 00:27:07 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2016-12-29 00:27:07 +0100 |
commit | 176ee0627ebc397c60650fc5b059829788fe3cdc (patch) | |
tree | 2608687c638bd8a7f24f38a812c95e63e22e0213 /trainlogic.lua | |
parent | b4b4936b15127b48f527eccdcee0a5de82a2a2fb (diff) | |
download | advtrains-176ee0627ebc397c60650fc5b059829788fe3cdc.tar.gz advtrains-176ee0627ebc397c60650fc5b059829788fe3cdc.tar.bz2 advtrains-176ee0627ebc397c60650fc5b059829788fe3cdc.zip |
Added privilege to remove trains
Diffstat (limited to 'trainlogic.lua')
-rw-r--r-- | trainlogic.lua | 10 |
1 files changed, 6 insertions, 4 deletions
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... |