diff options
author | orwell96 <orwell@bleipb.de> | 2020-07-12 20:37:51 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2020-07-12 20:37:51 +0200 |
commit | 19509acf56aef4b6e5f45023ee5603e95822fe69 (patch) | |
tree | 7cd79532ce7a6ab6a53d7917fc28a42a686a6afc /advtrains/trainlogic.lua | |
parent | 74bf177cc850164a0a6c13a634e7da6410f9f73a (diff) | |
download | advtrains-19509acf56aef4b6e5f45023ee5603e95822fe69.tar.gz advtrains-19509acf56aef4b6e5f45023ee5603e95822fe69.tar.bz2 advtrains-19509acf56aef4b6e5f45023ee5603e95822fe69.zip |
Add workaround to unload wagons that are too far away from players
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r-- | advtrains/trainlogic.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index 6155768..3e57db2 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -851,7 +851,7 @@ function advtrains.update_trainpart_properties(train_id, invert_flipstate) end -local ablkrng = minetest.settings:get("active_block_range")*16 +local ablkrng = advtrains.wagon_load_range -- This function checks whether entities need to be spawned for certain wagons, and spawns them. -- Called from train_step_*(), not required to check init. function advtrains.spawn_wagons(train_id) @@ -862,7 +862,7 @@ function advtrains.spawn_wagons(train_id) local data = advtrains.wagons[w_id] if data then if data.train_id ~= train_id then - atwarn("Train",train_id,"Wagon #",1,": Saved train ID",data.train_id,"did not match!") + atwarn("Train",train_id,"Wagon #",i,": Saved train ID",data.train_id,"did not match!") data.train_id = train_id end if not advtrains.wagon_objects[w_id] or not advtrains.wagon_objects[w_id]:getyaw() then @@ -878,6 +878,7 @@ function advtrains.spawn_wagons(train_id) end if spawn then + --atdebug("wagon",w_id,"spawning") local wt = advtrains.get_wagon_prototype(data) local wagon = minetest.add_entity(pos, wt):get_luaentity() wagon:set_id(w_id) |