diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-01-18 23:22:06 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-01-18 23:22:06 +0100 |
commit | fc67d4531a6cd53f29b14ce9f44da984149d9175 (patch) | |
tree | 5675c23d81f92d327b197d7c4474852f19ba3e52 | |
parent | 0030409dd34f611b90861a528d6735a44dd663f2 (diff) | |
parent | 4bc5163787c6c4c42fd14016c1c5103529d0e239 (diff) | |
download | advtrains-fc67d4531a6cd53f29b14ce9f44da984149d9175.tar.gz advtrains-fc67d4531a6cd53f29b14ce9f44da984149d9175.tar.bz2 advtrains-fc67d4531a6cd53f29b14ce9f44da984149d9175.zip |
Merged priv
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | advtrains.zip | bin | 1488724 -> 4810179 bytes | |||
-rw-r--r-- | advtrains/advtrains.zip | bin | 0 -> 1488724 bytes | |||
-rw-r--r-- | advtrains/advtrains/api_doc.txt | 114 | ||||
-rw-r--r-- | advtrains/advtrains/atc.lua | 274 | ||||
-rw-r--r-- | advtrains/advtrains/couple.lua (renamed from couple.lua) | 16 | ||||
-rw-r--r-- | advtrains/advtrains/crafting.lua (renamed from crafting.lua) | 34 | ||||
-rw-r--r-- | advtrains/advtrains/damage.lua (renamed from damage.lua) | 0 | ||||
-rw-r--r-- | advtrains/advtrains/debugitems.lua (renamed from debugitems.lua) | 10 | ||||
-rw-r--r-- | advtrains/advtrains/depends.txt (renamed from depends.txt) | 0 | ||||
-rw-r--r-- | advtrains/advtrains/description.txt (renamed from description.txt) | 0 | ||||
-rw-r--r-- | advtrains/advtrains/helpers.lua (renamed from helpers.lua) | 59 | ||||
-rw-r--r-- | advtrains/advtrains/init.lua | 180 | ||||
-rw-r--r-- | advtrains/advtrains/lua_atc.lua | 166 | ||||
-rw-r--r-- | advtrains/advtrains/misc_nodes.lua (renamed from misc_nodes.lua) | 2 | ||||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_bumper_st.b3d (renamed from models/advtrains_dtrack_bumper_st.b3d) | bin | 32927 -> 32927 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_bumper_st_30.b3d (renamed from models/advtrains_dtrack_bumper_st_30.b3d) | bin | 48546 -> 48546 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_bumper_st_45.b3d (renamed from models/advtrains_dtrack_bumper_st_45.b3d) | bin | 32926 -> 32926 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_bumper_st_60.b3d (renamed from models/advtrains_dtrack_bumper_st_60.b3d) | bin | 48546 -> 48546 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_cr.b3d (renamed from models/advtrains_dtrack_cr.b3d) | bin | 27540 -> 27540 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_cr_30.b3d (renamed from models/advtrains_dtrack_cr_30.b3d) | bin | 27543 -> 27543 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_cr_45.b3d (renamed from models/advtrains_dtrack_cr_45.b3d) | bin | 23037 -> 23037 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_cr_60.b3d (renamed from models/advtrains_dtrack_cr_60.b3d) | bin | 23037 -> 23037 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_detector_st.b3d (renamed from models/advtrains_dtrack_detector_st.b3d) | bin | 17157 -> 17157 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_detector_st_30.b3d (renamed from models/advtrains_dtrack_detector_st_30.b3d) | bin | 32779 -> 32779 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_detector_st_45.b3d (renamed from models/advtrains_dtrack_detector_st_45.b3d) | bin | 17163 -> 17163 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_detector_st_60.b3d (renamed from models/advtrains_dtrack_detector_st_60.b3d) | bin | 32779 -> 32779 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_st.b3d (renamed from models/advtrains_dtrack_st.b3d) | bin | 15828 -> 15828 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_st_30.b3d (renamed from models/advtrains_dtrack_st_30.b3d) | bin | 31447 -> 31447 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_st_45.b3d (renamed from models/advtrains_dtrack_st_45.b3d) | bin | 15831 -> 15831 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_st_60.b3d (renamed from models/advtrains_dtrack_st_60.b3d) | bin | 31447 -> 31447 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlcr.b3d (renamed from models/advtrains_dtrack_swlcr.b3d) | bin | 36743 -> 36743 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlcr_30.b3d (renamed from models/advtrains_dtrack_swlcr_30.b3d) | bin | 45922 -> 45922 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlcr_45.b3d (renamed from models/advtrains_dtrack_swlcr_45.b3d) | bin | 32112 -> 32112 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlcr_60.b3d (renamed from models/advtrains_dtrack_swlcr_60.b3d) | bin | 44864 -> 44864 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlst.b3d (renamed from models/advtrains_dtrack_swlst.b3d) | bin | 36743 -> 36743 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlst_30.b3d (renamed from models/advtrains_dtrack_swlst_30.b3d) | bin | 45922 -> 45922 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlst_45.b3d (renamed from models/advtrains_dtrack_swlst_45.b3d) | bin | 32112 -> 32112 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swlst_60.b3d (renamed from models/advtrains_dtrack_swlst_60.b3d) | bin | 44864 -> 44864 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrcr.b3d (renamed from models/advtrains_dtrack_swrcr.b3d) | bin | 36743 -> 36743 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrcr_30.b3d (renamed from models/advtrains_dtrack_swrcr_30.b3d) | bin | 44864 -> 44864 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrcr_45.b3d (renamed from models/advtrains_dtrack_swrcr_45.b3d) | bin | 32112 -> 32112 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrcr_60.b3d (renamed from models/advtrains_dtrack_swrcr_60.b3d) | bin | 45922 -> 45922 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrst.b3d (renamed from models/advtrains_dtrack_swrst.b3d) | bin | 36743 -> 36743 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrst_30.b3d (renamed from models/advtrains_dtrack_swrst_30.b3d) | bin | 44864 -> 44864 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrst_45.b3d (renamed from models/advtrains_dtrack_swrst_45.b3d) | bin | 32112 -> 32112 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_swrst_60.b3d (renamed from models/advtrains_dtrack_swrst_60.b3d) | bin | 45922 -> 45922 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_vst1.b3d (renamed from models/advtrains_dtrack_vst1.b3d) | bin | 21495 -> 21495 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_vst1_45.b3d (renamed from models/advtrains_dtrack_vst1_45.b3d) | bin | 20739 -> 20739 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_vst2.b3d (renamed from models/advtrains_dtrack_vst2.b3d) | bin | 25143 -> 25143 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_vst2_45.b3d (renamed from models/advtrains_dtrack_vst2_45.b3d) | bin | 20919 -> 20919 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_vst31.b3d (renamed from models/advtrains_dtrack_vst31.b3d) | bin | 19051 -> 19051 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_vst32.b3d (renamed from models/advtrains_dtrack_vst32.b3d) | bin | 21635 -> 21635 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_dtrack_vst33.b3d (renamed from models/advtrains_dtrack_vst33.b3d) | bin | 28795 -> 28795 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_modernwagon.b3d (renamed from models/advtrains_modernwagon.b3d) | bin | 172028 -> 172028 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_off.b3d (renamed from models/advtrains_retrosignal_off.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_off_30.b3d (renamed from models/advtrains_retrosignal_off_30.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_off_45.b3d (renamed from models/advtrains_retrosignal_off_45.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_off_60.b3d (renamed from models/advtrains_retrosignal_off_60.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_on.b3d (renamed from models/advtrains_retrosignal_on.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_on_30.b3d (renamed from models/advtrains_retrosignal_on_30.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_on_45.b3d (renamed from models/advtrains_retrosignal_on_45.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_retrosignal_on_60.b3d (renamed from models/advtrains_retrosignal_on_60.b3d) | bin | 13093 -> 13093 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_signal.b3d (renamed from models/advtrains_signal.b3d) | bin | 61544 -> 61544 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_signal_30.b3d (renamed from models/advtrains_signal_30.b3d) | bin | 61544 -> 61544 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_signal_45.b3d (renamed from models/advtrains_signal_45.b3d) | bin | 61544 -> 61544 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_signal_60.b3d (renamed from models/advtrains_signal_60.b3d) | bin | 61544 -> 61544 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_track_cr.b3d (renamed from models/advtrains_track_cr.b3d) | bin | 8023 -> 8023 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_track_st.b3d (renamed from models/advtrains_track_st.b3d) | bin | 15831 -> 15831 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/advtrains_track_st_45.b3d (renamed from models/advtrains_track_st_45.b3d) | bin | 8935 -> 8935 bytes | |||
-rw-r--r-- | advtrains/advtrains/models/trackplane.b3d (renamed from models/trackplane.b3d) | bin | 262 -> 262 bytes | |||
-rw-r--r-- | advtrains/advtrains/nodedb.lua | 232 | ||||
-rw-r--r-- | advtrains/advtrains/signals.lua (renamed from signals.lua) | 6 | ||||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_couple.png (renamed from textures/advtrains_couple.png) | bin | 265 -> 265 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_discouple.png (renamed from textures/advtrains_discouple.png) | bin | 307 -> 307 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_atc_placer.png | bin | 0 -> 1259 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_bumper_placer.png (renamed from textures/advtrains_dtrack_bumper_placer.png) | bin | 2213 -> 2213 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_detector_placer.png (renamed from textures/advtrains_dtrack_detector_placer.png) | bin | 1253 -> 1253 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_placer.png | bin | 0 -> 1097 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_rail.png | bin | 0 -> 2814 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_rail_atc.png | bin | 0 -> 2837 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_rail_detector_on.png | bin | 0 -> 2818 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_dtrack_slopeplacer.png (renamed from textures/advtrains_dtrack_slopeplacer.png) | bin | 2415 -> 2415 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_platform.png (renamed from textures/advtrains_platform.png) | bin | 193 -> 193 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_retrosignal.png (renamed from textures/advtrains_retrosignal.png) | bin | 8496 -> 8496 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_retrosignal_inv.png (renamed from textures/advtrains_retrosignal_inv.png) | bin | 2242 -> 2242 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_signal_inv.png (renamed from textures/advtrains_signal_inv.png) | bin | 856 -> 856 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_signal_off.png (renamed from textures/advtrains_signal_off.png) | bin | 5882 -> 5882 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_signal_on.png (renamed from textures/advtrains_signal_on.png) | bin | 5884 -> 5884 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_cr.png (renamed from textures/advtrains_track_cr.png) | bin | 33370 -> 33370 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_cr_45.png (renamed from textures/advtrains_track_cr_45.png) | bin | 33938 -> 33938 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_placer.png (renamed from textures/advtrains_track_placer.png) | bin | 32349 -> 32349 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_st.png (renamed from textures/advtrains_track_st.png) | bin | 20405 -> 20405 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_st_45.png (renamed from textures/advtrains_track_st_45.png) | bin | 39977 -> 39977 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swlcr.png (renamed from textures/advtrains_track_swlcr.png) | bin | 33378 -> 33378 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swlcr_45.png (renamed from textures/advtrains_track_swlcr_45.png) | bin | 45772 -> 45772 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swlst.png (renamed from textures/advtrains_track_swlst.png) | bin | 32321 -> 32321 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swlst_45.png (renamed from textures/advtrains_track_swlst_45.png) | bin | 46408 -> 46408 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swrcr.png (renamed from textures/advtrains_track_swrcr.png) | bin | 33670 -> 33670 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swrcr_45.png (renamed from textures/advtrains_track_swrcr_45.png) | bin | 46865 -> 46865 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swrst.png (renamed from textures/advtrains_track_swrst.png) | bin | 32654 -> 32654 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_track_swrst_45.png (renamed from textures/advtrains_track_swrst_45.png) | bin | 47636 -> 47636 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/advtrains_trackworker.png (renamed from textures/advtrains_trackworker.png) | bin | 328 -> 328 bytes | |||
-rw-r--r-- | advtrains/advtrains/textures/drwho_screwdriver.png (renamed from textures/drwho_screwdriver.png) | bin | 328 -> 328 bytes | |||
-rw-r--r-- | advtrains/advtrains/trackdb_legacy.lua | 27 | ||||
-rw-r--r-- | advtrains/advtrains/trackplacer.lua (renamed from trackplacer.lua) | 41 | ||||
-rw-r--r-- | advtrains/advtrains/tracks.lua (renamed from tracks.lua) | 114 | ||||
-rw-r--r-- | advtrains/advtrains/trainhud.lua (renamed from trainhud.lua) | 8 | ||||
-rw-r--r-- | advtrains/advtrains/trainlogic.lua (renamed from trainlogic.lua) | 504 | ||||
-rw-r--r-- | advtrains/advtrains/wagons.lua (renamed from wagons.lua) | 281 | ||||
-rw-r--r-- | advtrains/advtrains_train_industrial/depends.txt | 1 | ||||
-rw-r--r-- | advtrains/advtrains_train_industrial/init.lua | 67 | ||||
-rw-r--r-- | advtrains/advtrains_train_industrial/models/advtrains_engine_industrial.b3d (renamed from models/advtrains_engine_industrial.b3d) | bin | 143659 -> 143659 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/models/advtrains_wagon_tank.b3d (renamed from models/advtrains_wagon_tank.b3d) | bin | 223975 -> 223975 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/models/advtrains_wagon_wood.b3d (renamed from models/advtrains_wagon_wood.b3d) | bin | 193975 -> 193975 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/textures/advtrains_engine_industrial.png (renamed from textures/advtrains_engine_industrial.png) | bin | 59019 -> 59019 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/textures/advtrains_engine_industrial_inv.png (renamed from textures/advtrains_engine_industrial_inv.png) | bin | 381 -> 381 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/textures/advtrains_wagon_tank.png (renamed from textures/advtrains_wagon_tank.png) | bin | 8975 -> 8975 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/textures/advtrains_wagon_tank_inv.png (renamed from textures/advtrains_wagon_tank_inv.png) | bin | 408 -> 408 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/textures/advtrains_wagon_wood.png (renamed from textures/advtrains_wagon_wood.png) | bin | 5974 -> 5974 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_industrial/textures/advtrains_wagon_wood_inv.png (renamed from textures/advtrains_wagon_wood_inv.png) | bin | 316 -> 316 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_japan/depends.txt | 1 | ||||
-rw-r--r-- | advtrains/advtrains_train_japan/init.lua | 38 | ||||
-rw-r--r-- | advtrains/advtrains_train_japan/models/advtrains_engine_japan.b3d (renamed from models/advtrains_engine_japan.b3d) | bin | 165287 -> 165287 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_japan/models/advtrains_wagon_japan.b3d (renamed from models/advtrains_wagon_japan.b3d) | bin | 171991 -> 171991 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_japan/textures/advtrains_engine_japan.png (renamed from textures/advtrains_engine_japan.png) | bin | 12664 -> 12664 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_japan/textures/advtrains_engine_japan_inv.png (renamed from textures/advtrains_engine_japan_inv.png) | bin | 434 -> 434 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_japan/textures/advtrains_wagon_japan.png (renamed from textures/advtrains_wagon_japan.png) | bin | 11175 -> 11175 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_japan/textures/advtrains_wagon_japan_inv.png (renamed from textures/advtrains_wagon_japan_inv.png) | bin | 400 -> 400 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/depends.txt | 1 | ||||
-rw-r--r-- | advtrains/advtrains_train_steam/init.lua | 196 | ||||
-rw-r--r-- | advtrains/advtrains_train_steam/models/advtrains_detailed_steam_engine.b3d | bin | 0 -> 468002 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/models/advtrains_engine_steam.b3d | bin | 0 -> 437126 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/models/advtrains_passenger_wagon.b3d | bin | 0 -> 341965 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/models/advtrains_wagon.b3d (renamed from models/advtrains_wagon.b3d) | bin | 107352 -> 107352 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/textures/advtrains_detailed_steam_engine.png | bin | 0 -> 61988 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/textures/advtrains_engine_steam.png | bin | 0 -> 31915 bytes | |||
-rw-r--r--[-rwxr-xr-x] | advtrains/advtrains_train_steam/textures/advtrains_engine_steam_inv.png (renamed from textures/advtrains_newlocomotive_inv.png) | bin | 469 -> 469 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/textures/advtrains_wagon.png | bin | 0 -> 42023 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/textures/advtrains_wagon_box.png (renamed from textures/advtrains_wagon_box.png) | bin | 22503 -> 22503 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_steam/textures/advtrains_wagon_box_inv.png (renamed from textures/advtrains_wagon_box_inv.png) | bin | 347 -> 347 bytes | |||
-rw-r--r--[-rwxr-xr-x] | advtrains/advtrains_train_steam/textures/advtrains_wagon_inv.png (renamed from textures/advtrains_wagon_inv.png) | bin | 709 -> 709 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_subway/depends.txt | 1 | ||||
-rw-r--r-- | advtrains/advtrains_train_subway/init.lua | 34 | ||||
-rw-r--r-- | advtrains/advtrains_train_subway/models/advtrains_subway_wagon.b3d | bin | 0 -> 459309 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_subway/textures/advtrains_subway_wagon.png | bin | 0 -> 3618 bytes | |||
-rw-r--r-- | advtrains/advtrains_train_subway/textures/advtrains_subway_wagon_inv.png (renamed from textures/advtrains_subway_train_inv.png) | bin | 900 -> 900 bytes | |||
-rw-r--r-- | advtrains/atc_command.txt | 68 | ||||
-rw-r--r-- | advtrains/license.txt (renamed from license.txt) | 0 | ||||
-rw-r--r-- | advtrains/license_media.txt (renamed from license_media.txt) | 0 | ||||
-rw-r--r-- | advtrains/manual.pdf (renamed from manual.pdf) | bin | 1037362 -> 1037362 bytes | |||
-rw-r--r-- | advtrains/modpack.txt (renamed from models/blender/gleis/licence.txt~) | 0 | ||||
-rw-r--r-- | advtrains/readme.txt (renamed from readme.txt) | 4 | ||||
-rw-r--r-- | advtrains/screenshot.png (renamed from screenshot.png) | bin | 445014 -> 445014 bytes | |||
-rw-r--r-- | assets/AdvTrains_Additions.zip | bin | 0 -> 889352 bytes | |||
-rw-r--r-- | assets/Weichenhebel-CooleLokAnimiert.zip | bin | 0 -> 154594 bytes | |||
-rw-r--r-- | assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend | bin | 0 -> 859028 bytes | |||
-rw-r--r-- | assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend1 | bin | 0 -> 859028 bytes | |||
-rw-r--r-- | assets/advtrains_newlocomotive.xcf (renamed from textures/advtrains_newlocomotive.xcf) | bin | 7462378 -> 7462378 bytes | |||
-rw-r--r-- | assets/advtrains_wagon.png | bin | 0 -> 72273 bytes | |||
-rw-r--r-- | assets/blender/engine-with-animation.blend (renamed from models/blender/engine-with-animation.blend) | bin | 599504 -> 599504 bytes | |||
-rw-r--r-- | assets/blender/engine-with-animation_newtry.blend | bin | 0 -> 638904 bytes | |||
-rw-r--r-- | assets/blender/engine-with-animation_newtry.blend1 | bin | 0 -> 615608 bytes | |||
-rw-r--r-- | assets/blender/gleis/detectorpart.png | bin | 0 -> 857 bytes | |||
-rw-r--r-- | assets/blender/gleis/infos/Grafik_weiche.png (renamed from models/blender/gleis/infos/Grafik_weiche.png) | bin | 361700 -> 361700 bytes | |||
-rw-r--r-- | assets/blender/gleis/infos/breite (renamed from models/blender/gleis/infos/breite) | 0 | ||||
-rw-r--r-- | assets/blender/gleis/licence.txt~ | 0 | ||||
-rw-r--r-- | assets/blender/gleis/rail_my.blend (renamed from models/blender/gleis/rail_my.blend) | bin | 654772 -> 654772 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my.blend1 (renamed from models/blender/gleis/rail_my.blend1) | bin | 674164 -> 674164 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt.blend (renamed from models/blender/gleis/rail_my_rt.blend) | bin | 847060 -> 847060 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt.blend1 (renamed from models/blender/gleis/rail_my_rt.blend1) | bin | 767780 -> 767780 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt_final.blend (renamed from models/blender/gleis/rail_my_rt_final.blend1) | bin | 827052 -> 1015668 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt_final.blend1 (renamed from models/blender/gleis/rail_my_rt_final.blend) | bin | 1094836 -> 1106004 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt_switches.blend (renamed from models/blender/gleis/rail_my_rt_switches.blend) | bin | 2184236 -> 2184236 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt_switches.blend1 (renamed from models/blender/gleis/rail_my_rt_switches.blend1) | bin | 1945588 -> 1945588 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt_switches2.blend (renamed from models/blender/gleis/rail_my_rt_switches2.blend) | bin | 2139340 -> 2139340 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_my_rt_switches2.blend1 (renamed from models/blender/gleis/rail_my_rt_switches2.blend1) | bin | 2172972 -> 2172972 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_together.blend (renamed from models/blender/gleis/rail_together.blend) | bin | 1016920 -> 1016920 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_together.png (renamed from models/blender/gleis/rail_together.png) | bin | 233544 -> 233544 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_together2.png (renamed from models/blender/gleis/rail_together2.png) | bin | 312891 -> 312891 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_together3.png (renamed from models/blender/gleis/rail_together3.png) | bin | 309398 -> 309398 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_verticals.blend (renamed from models/blender/gleis/rail_verticals.blend) | bin | 550748 -> 550748 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_verticals.blend1 (renamed from models/blender/gleis/rail_verticals.blend1) | bin | 574100 -> 574100 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_verticals3.blend (renamed from models/blender/gleis/rail_verticals3.blend) | bin | 591800 -> 591800 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_verticals3.blend1 (renamed from models/blender/gleis/rail_verticals3.blend1) | bin | 554196 -> 554196 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_verticals45.blend (renamed from models/blender/gleis/rail_verticals45.blend) | bin | 547788 -> 547788 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_verticals45.blend1 (renamed from models/blender/gleis/rail_verticals45.blend1) | bin | 547300 -> 547300 bytes | |||
-rw-r--r-- | assets/blender/gleis/rail_verticals45.blend11 (renamed from models/blender/gleis/rail_verticals45.blend11) | bin | 547300 -> 547300 bytes | |||
-rw-r--r-- | assets/blender/gleis/texturen/rail.png (renamed from models/blender/gleis/texturen/rail.png) | bin | 2616 -> 2616 bytes | |||
-rw-r--r-- | assets/blender/gleis/texturen/uv.png (renamed from models/blender/gleis/texturen/uv.png) | bin | 2343 -> 2343 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_loc.blend (renamed from models/blender/industrial/industry_loc.blend) | bin | 652640 -> 652640 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_loc.blend1 (renamed from models/blender/industrial/industry_loc.blend1) | bin | 652640 -> 652640 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_loc.blend11 (renamed from models/blender/industrial/industry_loc.blend11) | bin | 659096 -> 659096 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_oil_ wagong.blend (renamed from models/blender/industrial/industry_oil_ wagong.blend) | bin | 693488 -> 693488 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_oil_ wagong.blend1 (renamed from models/blender/industrial/industry_oil_ wagong.blend1) | bin | 693488 -> 693488 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_tree_wagong.blend (renamed from models/blender/industrial/industry_tree_wagong.blend) | bin | 640056 -> 640056 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_tree_wagong.blend1 (renamed from models/blender/industrial/industry_tree_wagong.blend1) | bin | 640056 -> 640056 bytes | |||
-rw-r--r-- | assets/blender/industrial/industry_tree_wagong.png (renamed from models/blender/industrial/industry_tree_wagong.png) | bin | 316 -> 316 bytes | |||
-rw-r--r-- | assets/blender/locomotive.blend (renamed from models/blender/locomotive.blend) | bin | 459600 -> 459600 bytes | |||
-rw-r--r-- | assets/blender/magnet_track.blend (renamed from models/blender/magnet_track.blend) | bin | 516836 -> 516836 bytes | |||
-rw-r--r-- | assets/blender/mbb/advtrains_wagon_japan.xcf (renamed from models/blender/mbb/advtrains_wagon_japan.xcf) | bin | 814467 -> 814467 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_japanlocomotive.blend (renamed from models/blender/mbb/modern_japanlocomotive.blend) | bin | 715116 -> 715116 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_japanlocomotive.blend1 (renamed from models/blender/mbb/modern_japanlocomotive.blend1) | bin | 715116 -> 715116 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_japanlocomotive.png (renamed from models/blender/mbb/modern_japanlocomotive.png) | bin | 204978 -> 204978 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_japanlocomotive.xcf (renamed from models/blender/mbb/modern_japanlocomotive.xcf) | bin | 957175 -> 957175 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_locomotive.blend (renamed from models/blender/mbb/modern_locomotive.blend) | bin | 732124 -> 732124 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_wagong.blend (renamed from models/blender/mbb/modern_wagong.blend) | bin | 471140 -> 471140 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_wagong.blend1 (renamed from models/blender/mbb/modern_wagong.blend1) | bin | 518316 -> 518316 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_wagong_uv.blend (renamed from models/blender/mbb/modern_wagong_uv.blend) | bin | 571364 -> 571364 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_wagong_uv.blend1 (renamed from models/blender/mbb/modern_wagong_uv.blend1) | bin | 575708 -> 575708 bytes | |||
-rw-r--r-- | assets/blender/mbb/modern_wagong_uv.png (renamed from models/blender/mbb/modern_wagong_uv.png) | bin | 189564 -> 189564 bytes | |||
-rw-r--r-- | assets/blender/mbb/prellbock.blend (renamed from models/blender/mbb/prellbock.blend) | bin | 745176 -> 745176 bytes | |||
-rw-r--r-- | assets/blender/mbb/prellbock.blend1 (renamed from models/blender/mbb/prellbock.blend1) | bin | 485416 -> 485416 bytes | |||
-rw-r--r-- | assets/blender/mbb/prellbock.uv.png (renamed from models/blender/mbb/prellbock.uv.png) | bin | 4034 -> 4034 bytes | |||
-rw-r--r-- | assets/blender/mbb/regio-lokomotive.blend (renamed from models/blender/mbb/regio-lokomotive.blend) | bin | 704160 -> 704160 bytes | |||
-rw-r--r-- | assets/blender/mbb/regio-waron.blend (renamed from models/blender/mbb/regio-waron.blend) | bin | 545620 -> 545620 bytes | |||
-rw-r--r-- | assets/blender/mbb/retrosignal.blend (renamed from models/blender/mbb/retrosignal.blend) | bin | 488920 -> 488920 bytes | |||
-rw-r--r-- | assets/blender/mbb/retrosignal.blend1 (renamed from models/blender/mbb/retrosignal.blend1) | bin | 507800 -> 507800 bytes | |||
-rw-r--r-- | assets/blender/mbb/signal(2)_hoch.blend (renamed from models/blender/mbb/signal(2)_hoch.blend) | bin | 472092 -> 472092 bytes | |||
-rw-r--r-- | assets/blender/mbb/signal(2)_unten.blend (renamed from models/blender/mbb/signal(2)_unten.blend) | bin | 472092 -> 472092 bytes | |||
-rw-r--r-- | assets/blender/mbb/signal.blend (renamed from models/blender/mbb/signal.blend) | bin | 570336 -> 570336 bytes | |||
-rw-r--r-- | assets/blender/mbb/signal.blend1 (renamed from models/blender/mbb/signal.blend1) | bin | 570336 -> 570336 bytes | |||
-rw-r--r-- | assets/blender/mbb/signal.png (renamed from models/blender/mbb/signal.png) | bin | 244314 -> 244314 bytes | |||
-rw-r--r-- | assets/blender/mbb/signal.xcf (renamed from models/blender/mbb/signal.xcf) | bin | 881142 -> 881142 bytes | |||
-rw-r--r-- | assets/blender/mbb/signal2.png (renamed from models/blender/mbb/signal2.png) | bin | 39924 -> 39924 bytes | |||
-rw-r--r-- | assets/blender/mbb/tr-logo.png (renamed from models/blender/mbb/tr-logo.png) | bin | 197 -> 197 bytes | |||
-rw-r--r-- | assets/blender/mbb/weichenhebel1.blend (renamed from models/blender/mbb/weichenhebel1.blend) | bin | 493028 -> 493028 bytes | |||
-rw-r--r-- | assets/blender/mbb/weichenhebel2.blend (renamed from models/blender/mbb/weichenhebel2.blend) | bin | 492996 -> 492996 bytes | |||
-rw-r--r-- | assets/blender/newlocomotive.blend (renamed from models/blender/newlocomotive.blend) | bin | 603376 -> 603376 bytes | |||
-rw-r--r-- | assets/blender/newlocomotive.blend1 (renamed from models/blender/newlocomotive.blend1) | bin | 603376 -> 603376 bytes | |||
-rw-r--r-- | assets/blender/newlocomotive_uvs.png (renamed from models/blender/newlocomotive_uvs.png) | bin | 175030 -> 175030 bytes | |||
-rw-r--r-- | assets/blender/newwagon.blend (renamed from models/blender/newwagon.blend) | bin | 542188 -> 542188 bytes | |||
-rw-r--r-- | assets/blender/newwagon.blend1 (renamed from models/blender/newwagon.blend1) | bin | 550292 -> 550292 bytes | |||
-rw-r--r-- | assets/blender/newwagon.png (renamed from models/blender/newwagon.png) | bin | 108762 -> 108762 bytes | |||
-rw-r--r-- | assets/blender/subway-train.blend (renamed from models/blender/subway-train.blend1) | bin | 538188 -> 518888 bytes | |||
-rw-r--r-- | assets/blender/subway-train.blend1 (renamed from models/blender/subway-train.blend) | bin | 536268 -> 536268 bytes | |||
-rw-r--r-- | assets/blender/subway-train.png (renamed from models/blender/subway-train.png) | bin | 96773 -> 96773 bytes | |||
-rw-r--r-- | assets/blender/subway-train.xcf (renamed from models/blender/subway-train.xcf) | bin | 92558 -> 92558 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate.blend | bin | 0 -> 568668 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate.blend1 | bin | 0 -> 558980 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored.blend | bin | 0 -> 798328 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored.blend1 | bin | 0 -> 863656 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored_solidify.blend | bin | 0 -> 879916 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored_solidify.blend1 | bin | 0 -> 879884 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored_solidify_uv.blend | bin | 0 -> 832204 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored_solidify_uv.blend1 | bin | 0 -> 832396 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored_solidify_uv.png | bin | 0 -> 177111 bytes | |||
-rw-r--r-- | assets/blender/subway-train_animate_mirrored_solidify_uv.xcf | bin | 0 -> 369791 bytes | |||
-rw-r--r-- | assets/blender/trackplane.blend (renamed from models/blender/trackplane.blend) | bin | 462200 -> 462200 bytes | |||
-rw-r--r-- | assets/blender/trackvertical1.blend (renamed from models/blender/trackvertical1.blend) | bin | 453656 -> 453656 bytes | |||
-rw-r--r-- | assets/blender/trackvertical1.blend1 (renamed from models/blender/trackvertical1.blend1) | bin | 453344 -> 453344 bytes | |||
-rw-r--r-- | assets/blender/trackvertical1.png (renamed from models/blender/trackvertical1.png) | bin | 59146 -> 59146 bytes | |||
-rw-r--r-- | assets/blender/trackvertical2.blend (renamed from models/blender/trackvertical2.blend) | bin | 459216 -> 459216 bytes | |||
-rw-r--r-- | assets/blender/trackvertical2.png (renamed from models/blender/trackvertical2.png) | bin | 66755 -> 66755 bytes | |||
-rw-r--r-- | assets/dampflock4.blend | bin | 0 -> 1000628 bytes | |||
-rw-r--r-- | assets/init.lua | 0 | ||||
-rw-r--r-- | assets/larger rails.xcf (renamed from textures/larger rails.xcf) | bin | 1239132 -> 1239132 bytes | |||
-rw-r--r-- | assets/magleves_lockomotive.blend | bin | 0 -> 747680 bytes | |||
-rw-r--r-- | assets/magleves_track.blend | bin | 0 -> 464960 bytes | |||
-rw-r--r-- | assets/magleves_wagon.blend | bin | 0 -> 709904 bytes | |||
-rw-r--r-- | assets/mbbrailtextures/advtrains_dtrack_rail.png | bin | 0 -> 4582 bytes | |||
-rw-r--r-- | assets/mbbrailtextures/advtrains_dtrack_rail_atc.png | bin | 0 -> 4596 bytes | |||
-rw-r--r-- | assets/mbbrailtextures/advtrains_dtrack_rail_detector_on.png | bin | 0 -> 4579 bytes | |||
-rw-r--r-- | assets/oldmodels/locomotive.b3d (renamed from models/oldmodels/locomotive.b3d) | bin | 181112 -> 181112 bytes | |||
-rw-r--r-- | assets/oldmodels/trackvertical1.b3d (renamed from models/oldmodels/trackvertical1.b3d) | bin | 629 -> 629 bytes | |||
-rw-r--r-- | assets/oldmodels/trackvertical2.b3d (renamed from models/oldmodels/trackvertical2.b3d) | bin | 869 -> 869 bytes | |||
-rw-r--r-- | assets/uban_fancy.blend | bin | 0 -> 1020740 bytes | |||
-rw-r--r-- | assets/wagonfancytexture.png | bin | 0 -> 42023 bytes | |||
-rw-r--r-- | assets/wagong_fancy.blend | bin | 0 -> 1044484 bytes | |||
-rw-r--r-- | assets/wagong_fancy.blend1 | bin | 0 -> 1044524 bytes | |||
-rw-r--r-- | atc.lua | 4 | ||||
-rw-r--r-- | init.lua | 42 | ||||
-rw-r--r-- | models/advtrains_engine_steam.b3d | bin | 298687 -> 0 bytes | |||
-rw-r--r-- | models/advtrains_subway_train.b3d | bin | 95856 -> 0 bytes | |||
-rw-r--r-- | modpack.txt | 0 | ||||
-rw-r--r-- | pseudoload.lua | 180 | ||||
-rw-r--r-- | textures/advtrains_dtrack_placer.png | bin | 5831 -> 0 bytes | |||
-rw-r--r-- | textures/advtrains_dtrack_rail.png | bin | 2810 -> 0 bytes | |||
-rw-r--r-- | textures/advtrains_dtrack_rail_detector_on.png | bin | 2844 -> 0 bytes | |||
-rw-r--r-- | textures/advtrains_newlocomotive.png | bin | 31800 -> 0 bytes | |||
-rw-r--r-- | textures/advtrains_subway_train.png | bin | 12002 -> 0 bytes | |||
-rw-r--r-- | textures/advtrains_wagon.png | bin | 35724 -> 0 bytes |
282 files changed, 1798 insertions, 912 deletions
@@ -1,5 +1,4 @@ tarball: clean -# tar czf advtrains.tar.gz textures/*.png models/*.b3d *.lua *.txt - which zip && zip advtrains.zip textures/*.png models/*.b3d *.lua *.txt + which zip && zip -r advtrains.zip advtrains clean: - rm -f advtrains.zip advtrains.tar.gz + rm -f advtrains.zip diff --git a/advtrains.zip b/advtrains.zip Binary files differindex a3dab82..3eafd1a 100644 --- a/advtrains.zip +++ b/advtrains.zip diff --git a/advtrains/advtrains.zip b/advtrains/advtrains.zip Binary files differnew file mode 100644 index 0000000..a3dab82 --- /dev/null +++ b/advtrains/advtrains.zip diff --git a/advtrains/advtrains/api_doc.txt b/advtrains/advtrains/api_doc.txt new file mode 100644 index 0000000..6b1aa2e --- /dev/null +++ b/advtrains/advtrains/api_doc.txt @@ -0,0 +1,114 @@ +Advanced Trains [advtrains] API documentation +-------- +To use the API, mods must depend on 'advtrains'. +All boolean values in definition tables default to 'false' and can be omitted. +### Wagons +Wagons are registered using the function + +advtrains.register_wagon(name, prototype, description, inventory_image) +- 'name' is the internal name of the wagon. It is registered inside the 'advtrains:' namespace. + Example: A wagon with name="engine_tgv" will be registered as "advtrains:engine_tgv". +- 'prototype' is the lua entity prototype. The regular definition keys for luaentites apply. Additional required and optional properties see below. DO NOT define 'on_step', 'on_activate', 'on_punch', 'on_rightclick' and 'get_staticdata' since these will be overridden. Use 'custom_*' instead. +- 'description' is the description of the inventory item that is used to place the wagon. +- 'inventory_image' is the inventory image of said item. + +# Wagon prototype properties +{ + ... all regular luaentity properties (mesh, textures, collisionbox a.s.o)... + drives_on = {default=true}, + ^- used to define the tracktypes (see below) that wagon can drive on. The tracktype identifiers are given as keys, similar to privileges) + max_speed = 10, + ^- optional, default 10: defines the maximum speed this wagon can drive. The maximum speed of a train is determined by the wagon with the lowest max_speed value. + seats = { + { + name="Left front window", + ^- display name of this seat + attach_offset={x=0, y=10, z=0}, + ^- this value is passed to 'set_attach' + view_offset={x=0, y=6, z=0}, + ^- player:set_eye_offset is called with this parameter. + driving_ctrl_access=false, + ^- If the seat is a driver stand, and players sitting here should get access to the train's driving control. + + }, + }, + ^- contains zero or more seat definitions. A seat is a place where a player can be attached when getting on a wagon. + wagon_span=2, + ^- How far this wagon extends from its base position. Is the half of the wagon length. + ^- Used to determine in which distance the other wagons have to be positioned. Will require tweaking. + drops = {"default:steelblock 3"} + ^- List of itemstrings what to drop when the wagon is destroyed + + has_inventory = false + ^- If this wagon has an inventory. The inventory is saved with the wagon. + ^- the following settings are ignored if not. + inventory_list_sizes = { + box=8*6, + }, + ^- List of assignments of type list_name=size. + ^- For every entry, an inventory list is created with the specified size. + get_inventory_formspec = function(self, player_name) + return "<a formspec>" + end, + ^- Function that should return the formspec to be displayed when <player> requests to open the wagon's inventory + ^- Use "list[detached:advtrains_wgn_"..self.unique_id..";<list_name>;<X>,<Y>;<W>,<H>;<Start>]" to display a wagon's inventory list. + + custom_on_step = function(self, dtime) end + ^- optional: Execute custom code on every step + custom_on_activate = function(self, dtime_s) end + ^- optional: Execute custom code on activate. Staticdata does not need to be saved and restored since all properties written in 'self' are preserved over unloads. + update_animation = function(self, velocity) end + ^- optional: Function that is called whenever the train's velocity changes or every 2 seconds. Used to call 'self.object:update_animation()' if needed. + +} + +# Notes on wagons + +- Every wagon has the field 'unique_id' which assigns each wagon a random id. +- All properties written in the lua entity (self) are saved and restored automatically. Minetest's internal staticdata is only used to save the unique_id of the wagon, which serves as a key in an externally saved table. +- Assuming Z Axis as the axis parallel to the tracks and Y Axis as the one pointing into the sky, wagon models should be dimensioned in a way that: + - their origin is centered in X and Z direction + - their origin lies 0.5 units above the bottom of the model + - the overall extent in X and Y direction is <=3 units +- wagon_span is then the distance between the model origin and the Z axis extent. + +### Tracks +Most modders will be satisfied with the built-in tracks. If cog railways, maglev trains and mine trains are added, it is necessary to understand the definition of tracks. Although the tracks API is there, explaining it would require more effort than me creating the wanted definitions myself. Contact me if you need to register your own rails using my registration functions. + +However, it is still possible to register single rails by understanding the node properties of rails. +minetest.register_node(nodename, { + ... usual node definition ... + groups = { + advtrains_track_<tracktype>=1 + ^- this group tells that the node is a track + not_blocking_trains=1, + ^- this group tells that the node should not block trains although it's walkable. + }, + connect1 = 0, + connect2 = 8, + ^- These values tell the direction (horizontal) the rail ends are pointing to. 0 means +Z, then rotation values increase clockwise. For a translation of directions to positions see helpers.lua. + rely1=0,
+ rely2=0, + ^- the Y height of the rail end 1/2. A value of >=1 means that the rail end points to the next y layer at rely-1
+ railheight=0, + ^- the height value of this rail that is saved in the path. usually the median of rely1 and rely2. + + can_dig=function(pos)
+ return not advtrains.is_train_at_pos(pos)
+ end,
+ after_dig_node=function(pos)
+ advtrains.invalidate_all_paths()
+ advtrains.reset_trackdb_position(pos)
+ end,
+ after_place_node=function(pos)
+ advtrains.reset_trackdb_position(pos)
+ end, + ^- the code in these 3 default minetest API functions is required for advtrains to work, however you can add your own code + + advtrains = {
+ on_train_enter=function(pos, train_id) end + ^- called when a train enters the rail + on_train_leave=function(pos, train_id) end + ^- called when a train leaves the rail
+ } +})
\ No newline at end of file diff --git a/advtrains/advtrains/atc.lua b/advtrains/advtrains/atc.lua new file mode 100644 index 0000000..2a4d226 --- /dev/null +++ b/advtrains/advtrains/atc.lua @@ -0,0 +1,274 @@ +--atc.lua +--registers and controls the ATC system + +local atc={} +-- ATC persistence table. advtrains.atc is created by init.lua when it loads the save file. +atc.controllers = {} +function atc.load_data(data) + atc.controllers = data and data.controllers or {} +end +function atc.save_data() + return atc.controllers +end +--contents: {command="...", arrowconn=0-15 where arrow points} + +--call from advtrains.detector subprogram + +function atc.trigger_controller_train_enter(pos, train_id) + atc.send_command(pos) +end + +--general + +function atc.send_command(pos) + local pts=minetest.pos_to_string(pos) + if atc.controllers[pts] then + --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)) + atc.train_reset_command(train_id) + local arrowconn=atc.controllers[pts].arrowconn + local train=advtrains.trains[train_id] + for index, ppos in pairs(train.path) do + if vector.equals(advtrains.round_vector_floor_y(ppos), pos) then + advtrains.trains[train_id].atc_arrow = + vector.equals( + advtrains.dirCoordSet(pos, arrowconn), + advtrains.round_vector_floor_y(train.path[index+train.movedir]) + ) + advtrains.trains[train_id].atc_command=atc.controllers[pts].command + atprint("Sending ATC Command: "..atc.controllers[pts].command) + end + end + end + end + end + return false +end + +function atc.train_reset_command(train_id) + advtrains.trains[train_id].atc_command=nil + advtrains.trains[train_id].atc_delay=0 + advtrains.trains[train_id].atc_brake_target=nil + advtrains.trains[train_id].atc_wait_finish=nil + advtrains.trains[train_id].atc_arrow=nil +end + +--nodes +local idxtrans={static=1, mesecon=2, digiline=3} +local apn_func=function(pos, node) + advtrains.ndb.update(pos, node) + local meta=minetest.get_meta(pos) + if meta then + meta:set_string("infotext", "ATC controller, unconfigured.") + meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta)) + end +end + +advtrains.register_tracks("default", { + nodename_prefix="advtrains:dtrack_atc", + texture_prefix="advtrains_dtrack_atc", + models_prefix="advtrains_dtrack_detector", + models_suffix=".b3d", + shared_texture="advtrains_dtrack_rail_atc.png", + description="ATC controller", + formats={}, + get_additional_definiton = function(def, preset, suffix, rotation) + return { + after_place_node=apn_func, + after_dig_node=function(pos) + advtrains.invalidate_all_paths() + advtrains.ndb.clear(pos) + local pts=minetest.pos_to_string(pos) + atc.controllers[pts]=nil + end, + on_receive_fields = function(pos, formname, fields, player) + if minetest.is_protected(pos, player:get_player_name()) then + minetest.chat_send_player(player:get_player_name(), "This position is protected!") + return + end + local meta=minetest.get_meta(pos) + if meta then + if not fields.save then + --maybe only the dropdown changed + if fields.mode then + meta:set_string("mode", idxtrans[fields.mode]) + meta:set_string("infotext", "ATC controller, mode "..fields.mode.."\n"..( fields.mode=="digiline" and "Channel: "..meta:get_string("channel") or "Command: "..meta:get_string("command") ) ) + meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta)) + end + return + end + meta:set_string("mode", idxtrans[fields.mode]) + meta:set_string("command", fields.command) + meta:set_string("command_on", fields.command_on) + meta:set_string("channel", fields.channel) + meta:set_string("infotext", "ATC controller, mode "..fields.mode.."\n"..( fields.mode=="digiline" and "Channel: "..meta:get_string("channel") or "Command: "..meta:get_string("command") ) ) + meta:set_string("formspec", atc.get_atc_controller_formspec(pos, meta)) + + local pts=minetest.pos_to_string(pos) + local _, conn1=advtrains.get_rail_info_at(pos, advtrains.all_tracktypes) + atc.controllers[pts]={command=fields.command, arrowconn=conn1} + atc.send_command(pos) + end + end, + } + end +}, advtrains.trackpresets.t_30deg_straightonly) + + +function atc.get_atc_controller_formspec(pos, meta) + local mode=tonumber(meta:get_string("mode")) or 1 + local command=meta:get_string("command") + local command_on=meta:get_string("command_on") + local channel=meta:get_string("channel") + local formspec="size[8,6]".. + "dropdown[0,0;3;mode;static,mesecon,digiline;"..mode.."]" + if mode<3 then + formspec=formspec.."field[0.5,1.5;7,1;command;Command;"..minetest.formspec_escape(command).."]" + if tonumber(mode)==2 then + formspec=formspec.."field[0.5,3;7,1;command_on;Command (on);"..minetest.formspec_escape(command_on).."]" + end + else + formspec=formspec.."field[0.5,1.5;7,1;channel;Digiline channel;"..minetest.formspec_escape(channel).."]" + end + return formspec.."button_exit[0.5,4.5;7,1;save;Save]" +end + +--from trainlogic.lua train step +local matchptn={ + ["SM"]=function(id, train) + train.tarvelocity=train.max_speed + return 2 + end, + ["S([0-9]+)"]=function(id, train, match) + train.tarvelocity=tonumber(match) + return #match+1 + end, + ["B([0-9]+)"]=function(id, train, match) + if train.velocity>tonumber(match) then + train.atc_brake_target=tonumber(match) + if train.tarvelocity>train.atc_brake_target then + train.tarvelocity=train.atc_brake_target + end + end + return #match+1 + end, + ["W"]=function(id, train) + train.atc_wait_finish=true + return 1 + end, + ["D([0-9]+)"]=function(id, train, match) + train.atc_delay=tonumber(match) + return #match+1 + end, + ["R"]=function(id, train) + if train.velocity<=0 then + train.movedir=train.movedir*-1 + train.atc_arrow = not train.atc_arrow + else + minetest.chat_send_all("ATC Reverse command warning: didn't reverse train!") + end + return 1 + end, +} + +function atc.execute_atc_command(id, train) + --strip whitespaces + local command=string.match(train.atc_command, "^%s*(.*)$") + + + if string.match(command, "^%s*$") then + train.atc_command=nil + return + end + --conditional statement? + local is_cond, cond_applies + local cond, rest=string.match(command, "^I([%+%-])(.+)$") + if cond then + is_cond=true + if cond=="+" then + cond_applies=train.atc_arrow + end + if cond=="-" then + cond_applies=not train.atc_arrow + end + else + cond, compare, rest=string.match(command, "^I([<>]=?)([0-9]+)(.+)$") + if cond and compare then + is_cond=true + if cond=="<" then + cond_applies=train.velocity<tonumber(compare) + end + if cond==">" then + cond_applies=train.velocity>tonumber(compare) + end + if cond=="<=" then + cond_applies=train.velocity<=tonumber(compare) + end + if cond==">=" then + cond_applies=train.velocity>=tonumber(compare) + end + end + end + if is_cond then + atprint("Evaluating if statement: "..command) + atprint("Cond: "..(cond or "nil")) + atprint("Applies: "..(cond_applies and "true" or "false")) + atprint("Rest: "..rest) + --find end of conditional statement + local nest, pos, elsepos=0, 1 + while nest>=0 do + if pos>#rest then + minetest.chat_send_all("ATC command syntax error: I statement not closed: "..command) + atc.train_reset_command(id) + return + end + local char=string.sub(rest, pos, pos) + if char=="I" then + nest=nest+1 + end + if char==";" then + nest=nest-1 + end + if nest==0 and char=="E" then + elsepos=pos+0 + end + pos=pos+1 + end + if not elsepos then elsepos=pos-1 end + if cond_applies then + command=string.sub(rest, 1, elsepos-1)..string.sub(rest, pos) + else + command=string.sub(rest, elsepos+1, pos-2)..string.sub(rest, pos) + end + atprint("Result: "..command) + train.atc_command=command + atc.execute_atc_command(id, train) + return + else + for pattern, func in pairs(matchptn) do + local match=string.match(command, "^"..pattern) + if match then + local patlen=func(id, train, match) + + atprint("Executing: "..string.sub(command, 1, patlen)) + + train.atc_command=string.sub(command, patlen+1) + if train.atc_delay<=0 and not train.atc_wait_finish then + --continue (recursive, cmds shouldn't get too long, and it's a end-recursion.) + atc.execute_atc_command(id, train) + end + return + end + end + end + minetest.chat_send_all("ATC command parse error: "..command) + atc.train_reset_command(id) +end + + + +--move table to desired place +advtrains.atc=atc diff --git a/couple.lua b/advtrains/advtrains/couple.lua index a846c8b..c0dea84 100644 --- a/couple.lua +++ b/advtrains/advtrains/couple.lua @@ -9,7 +9,6 @@ wagon wagons keep their couple entity minetest-internal id inside the field discouple_id. if it refers to nowhere, they will spawn a new one if player is near ]] -local print=function(t, ...) minetest.log("action", table.concat({t, ...}, " ")) minetest.chat_send_all(table.concat({t, ...}, " ")) end minetest.register_entity("advtrains:discouple", { @@ -32,7 +31,7 @@ minetest.register_entity("advtrains:discouple", { on_punch=function(self, player) --only if player owns at least one wagon next to this local own=player:get_player_name() - if self.wagon.owner and self.wagon.owner~=own then + if self.wagon.owner and self.wagon.owner==own then local train=advtrains.trains[self.wagon.train_id] local nextwgn_id=train.trainparts[self.wagon.pos_in_trainparts-1] for aoi, le in pairs(minetest.luaentities) do @@ -45,8 +44,11 @@ minetest.register_entity("advtrains:discouple", { end end end + advtrains.split_train_at_wagon(self.wagon)--found in trainlogic.lua + self.object:remove() + else + minetest.chat_send_player(own, "You need to own at least one neighboring wagon to destroy this couple.") end - advtrains.split_train_at_wagon(self.wagon)--found in trainlogic.lua end, on_step=function(self, dtime) local t=os.clock() @@ -67,7 +69,7 @@ minetest.register_entity("advtrains:discouple", { self.object:setvelocity(velocityvec) self.updatepct_timer=2 end - printbm("discouple_step", t) + atprintbm("discouple_step", t) end, }) @@ -120,7 +122,7 @@ minetest.register_entity("advtrains:couple", { end, on_step=function(self, dtime) local t=os.clock() - if not self.train_id_1 or not self.train_id_2 then print("wtf no train ids?")return end + if not self.train_id_1 or not self.train_id_2 then atprint("wtf no train ids?")return end local train1=advtrains.trains[self.train_id_1] local train2=advtrains.trains[self.train_id_2] if not train1 or not train2 or not train1.path or not train2.path or not train1.index or not train2.index then @@ -140,7 +142,7 @@ minetest.register_entity("advtrains:couple", { else tp2=advtrains.get_real_index_position(train2.path, advtrains.get_train_end_index(train2)) end - if not tp1 or not tp2 or not (vector.distance(tp1,tp2)<0.5) then + if not tp1 or not tp2 or not (vector.distance(tp1,tp2)<1.5) then self.object:remove() return else @@ -149,6 +151,6 @@ minetest.register_entity("advtrains:couple", { self.object:setpos(pos_median) end end - printbm("couple step", t) + atprintbm("couple step", t) end, }) diff --git a/crafting.lua b/advtrains/advtrains/crafting.lua index dd43512..5ba12ce 100644 --- a/crafting.lua +++ b/advtrains/advtrains/crafting.lua @@ -65,39 +65,7 @@ minetest.register_craft({ }, }) ---wagons -minetest.register_craft({ - output = 'advtrains:newlocomotive', - recipe = { - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - {'default:steelblock', 'dye:black', 'default:steelblock'}, - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - }, -}) -minetest.register_craft({ - output = 'advtrains:wagon_default', - recipe = { - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - {'default:steelblock', 'dye:dark_green', 'default:steelblock'}, - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - }, -}) -minetest.register_craft({ - output = 'advtrains:wagon_box', - recipe = { - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - {'default:steelblock', 'default:junglewood', 'default:steelblock'}, - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - }, -}) -minetest.register_craft({ - output = 'advtrains:subway_wagon', - recipe = { - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - {'default:steelblock', 'dye:yellow', 'default:steelblock'}, - {'default:steelblock', 'default:steelblock', 'default:steelblock'}, - }, -}) + --misc_nodes --crafts for platforms see misc_nodes.lua diff --git a/damage.lua b/advtrains/advtrains/damage.lua index b39fe67..b39fe67 100644 --- a/damage.lua +++ b/advtrains/advtrains/damage.lua diff --git a/debugitems.lua b/advtrains/advtrains/debugitems.lua index b3164ff..dcc95d9 100644 --- a/debugitems.lua +++ b/advtrains/advtrains/debugitems.lua @@ -24,13 +24,5 @@ minetest.register_tool("advtrains:tunnelborer", end end end, ---[[ -^ default: nil -^ Function must return either nil if no item shall be removed from -inventory, or an itemstack to replace the original itemstack. -e.g. itemstack:take_item(); return itemstack -^ Otherwise, the function is free to do what it wants. -^ The default functions handle regular use cases. -]] } -) +) diff --git a/depends.txt b/advtrains/advtrains/depends.txt index 20aa884..20aa884 100644 --- a/depends.txt +++ b/advtrains/advtrains/depends.txt diff --git a/description.txt b/advtrains/advtrains/description.txt index ecc5d58..ecc5d58 100644 --- a/description.txt +++ b/advtrains/advtrains/description.txt diff --git a/helpers.lua b/advtrains/advtrains/helpers.lua index 6a8175f..cc7deb8 100644 --- a/helpers.lua +++ b/advtrains/advtrains/helpers.lua @@ -1,5 +1,4 @@ --advtrains by orwell96, see readme.txt
-local print=function(t) minetest.log("action", t) minetest.chat_send_all(t) end
advtrains.dir_trans_tbl={
[0]={x=0, z=1},
@@ -55,34 +54,29 @@ rely1, rely2 tell to which height the connections are pointed to. 1 means it wil ]]
-function advtrains.conway(midreal, prev, traintype)--in order prev,mid,return
+function advtrains.conway(midreal, prev, drives_on)--in order prev,mid,return
local mid=advtrains.round_vector_floor_y(midreal)
- local drives_on=advtrains.all_traintypes[traintype].drives_on
- if not advtrains.get_rail_info_at(advtrains.round_vector_floor_y(prev), traintype) then
- return nil
- end
-
- local midnode_ok, middir1, middir2, midrely1, midrely2=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(mid), traintype)
+ local midnode_ok, middir1, middir2, midrely1, midrely2=advtrains.get_rail_info_at(mid, drives_on)
if not midnode_ok then
return nil
end
local next, chkdir, chkrely, y_offset
y_offset=0
- --print("[advtrains] in order mid1,mid2",middir1,middir2)
+ --atprint(" in order mid1,mid2",middir1,middir2)
--try if it is dir1
local cor1=advtrains.dirCoordSet(mid, middir2)--<<<<
- if math.floor(cor1.x+0.5)==math.floor(prev.x+0.5) and math.floor(cor1.z+0.5)==math.floor(prev.z+0.5) then--this was previous
+ if cor1.x==prev.x and cor1.z==prev.z then--this was previous
next=advtrains.dirCoordSet(mid, middir1)
if midrely1>=1 then
next.y=next.y+1
- --print("[advtrains]found midrely1 to be >=1: next is now "..(next and minetest.pos_to_string(next) or "nil"))
+ --atprint("found midrely1 to be >=1: next is now "..(next and minetest.pos_to_string(next) or "nil"))
y_offset=1
end
chkdir=middir1
chkrely=midrely1
- --print("[advtrains]dir2 applied next pos:",minetest.pos_to_string(next),"(chkdir is ",chkdir,")")
+ --atprint("dir2 applied next pos:",minetest.pos_to_string(next),"(chkdir is ",chkdir,")")
end
--dir2???
local cor2=advtrains.dirCoordSet(mid, middir1)--<<<<
@@ -90,54 +84,54 @@ function advtrains.conway(midreal, prev, traintype)--in order prev,mid,return next=advtrains.dirCoordSet(mid, middir2)--dir2 wird überprüft, alles gut.
if midrely2>=1 then
next.y=next.y+1
- --print("[advtrains]found midrely2 to be >=1: next is now "..(next and minetest.pos_to_string(next) or "nil"))
+ --atprint("found midrely2 to be >=1: next is now "..(next and minetest.pos_to_string(next) or "nil"))
y_offset=1
end
chkdir=middir2
chkrely=midrely2
- --print("[advtrains] dir2 applied next pos:",minetest.pos_to_string(next),"(chkdir is ",chkdir,")")
+ --atprint(" dir2 applied next pos:",minetest.pos_to_string(next),"(chkdir is ",chkdir,")")
end
- --print("[advtrains]dir applied next pos: "..(next and minetest.pos_to_string(next) or "nil").."(chkdir is "..(chkdir or "nil")..", y-offset "..y_offset..")")
+ --atprint("dir applied next pos: "..(next and minetest.pos_to_string(next) or "nil").."(chkdir is "..(chkdir or "nil")..", y-offset "..y_offset..")")
--is there a next
if not next then
- --print("[advtrains]in conway: no next rail(nil), returning!")
+ atprint("in conway: no next rail(nil), returning!")
return nil
end
- local nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), traintype)
+ local nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), drives_on)
--is it a rail?
if(not nextnode_ok) then
- --print("[advtrains]in conway: next "..minetest.pos_to_string(next).." not a rail, trying one node below!")
+ atprint("in conway: next "..minetest.pos_to_string(next).." not a rail, trying one node below!")
next.y=next.y-1
y_offset=y_offset-1
- nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), traintype)
+ nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), drives_on)
if(not nextnode_ok) then
- --print("[advtrains]in conway: one below "..minetest.pos_to_string(next).." is not a rail either, returning!")
+ atprint("in conway: one below "..minetest.pos_to_string(next).." is not a rail either, returning!")
return nil
end
end
--is this next rail connecting to the mid?
if not ( (((nextdir1+8)%16)==chkdir and nextrely1==chkrely-y_offset) or (((nextdir2+8)%16)==chkdir and nextrely2==chkrely-y_offset) ) then
- --print("[advtrains]in conway: next "..minetest.pos_to_string(next).." not connecting, trying one node below!")
+ atprint("in conway: next "..minetest.pos_to_string(next).." not connecting, trying one node below!")
next.y=next.y-1
y_offset=y_offset-1
- nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), traintype)
+ nextnode_ok, nextdir1, nextdir2, nextrely1, nextrely2, nextrailheight=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(next), drives_on)
if(not nextnode_ok) then
- --print("[advtrains]in conway: (at connecting if check again) one below "..minetest.pos_to_string(next).." is not a rail either, returning!")
+ atprint("in conway: (at connecting if check again) one below "..minetest.pos_to_string(next).." is not a rail either, returning!")
return nil
end
if not ( (((nextdir1+8)%16)==chkdir and nextrely1==chkrely) or (((nextdir2+8)%16)==chkdir and nextrely2==chkrely) ) then
- --print("[advtrains]in conway: one below "..minetest.pos_to_string(next).." rail not connecting, returning!")
- --print("[advtrains] in order mid1,2,next1,2,chkdir "..middir1.." "..middir2.." "..nextdir1.." "..nextdir2.." "..chkdir)
+ atprint("in conway: one below "..minetest.pos_to_string(next).." rail not connecting, returning!")
+ atprint(" in order mid1,2,next1,2,chkdir "..middir1.." "..middir2.." "..nextdir1.." "..nextdir2.." "..chkdir)
return nil
end
end
- --print("[advtrains]conway found rail.")
+ --atprint("conway found rail.")
return vector.add(advtrains.round_vector_floor_y(next), {x=0, y=nextrailheight, z=0}), chkdir
end
--TODO use this
@@ -177,10 +171,10 @@ function advtrains.minAngleDiffRad(r1, r2) end
end
function advtrains.dumppath(path)
- if not path then print("dumppath: no path(nil)") return end
+ if not path then atprint("dumppath: no path(nil)") return end
local min=advtrains.minN(path)
local max=advtrains.maxN(path)
- for i=min, max do print("["..i.."] "..(path[i] and minetest.pos_to_string(path[i]) or "nil")) end
+ for i=min, max do atprint("["..i.."] "..(path[i] and minetest.pos_to_string(path[i]) or "nil")) end
end
function advtrains.merge_tables(a, ...)
@@ -192,18 +186,18 @@ function advtrains.merge_tables(a, ...) end
function advtrains.yaw_from_3_positions(prev, curr, next)
local pts=minetest.pos_to_string
- --print("p3 "..pts(prev)..pts(curr)..pts(next))
+ --atprint("p3 "..pts(prev)..pts(curr)..pts(next))
local prev2curr=math.atan2((curr.x-prev.x), (prev.z-curr.z))
local curr2next=math.atan2((next.x-curr.x), (curr.z-next.z))
- --print("y3 "..(prev2curr*360/(2*math.pi)).." "..(curr2next*360/(2*math.pi)))
+ --atprint("y3 "..(prev2curr*360/(2*math.pi)).." "..(curr2next*360/(2*math.pi)))
return prev2curr+(advtrains.minAngleDiffRad(prev2curr, curr2next)/2)
end
function advtrains.get_wagon_yaw(front, first, second, back, pct)
local pts=minetest.pos_to_string
- --print("p "..pts(front)..pts(first)..pts(second)..pts(back))
+ --atprint("p "..pts(front)..pts(first)..pts(second)..pts(back))
local y2=advtrains.yaw_from_3_positions(second, first, front)
local y1=advtrains.yaw_from_3_positions(back, second, first)
- --print("y "..(y1*360/(2*math.pi)).." "..(y2*360/(2*math.pi)))
+ --atprint("y "..(y1*360/(2*math.pi)).." "..(y2*360/(2*math.pi)))
return y1+advtrains.minAngleDiffRad(y1, y2)*pct
end
function advtrains.get_real_index_position(path, index)
@@ -247,3 +241,4 @@ function advtrains.deserialize_inventory(sers, inv) end
return false
end
+
diff --git a/advtrains/advtrains/init.lua b/advtrains/advtrains/init.lua new file mode 100644 index 0000000..c8c4b56 --- /dev/null +++ b/advtrains/advtrains/init.lua @@ -0,0 +1,180 @@ +--advtrains + +advtrains = {trains={}, wagon_save={}} + +advtrains.modpath = minetest.get_modpath("advtrains") + +local function print_concat_table(a) + local str="" + local stra="" + for i=1,50 do + t=a[i] + if t==nil then + stra=stra.."nil " + else + str=str..stra + stra="" + if type(t)=="table" then + if t.x and t.y and t.z then + str=str..minetest.pos_to_string(t) + else + str=str..dump(t) + end + elseif type(t)=="boolean" then + if t then + str=str.."true" + else + str=str.."false" + end + else + str=str..t + end + str=str.." " + end + end + return str +end +--atprint=function() end +atprint=function(t, ...) minetest.log("action", "[advtrains]"..print_concat_table({t, ...})) minetest.chat_send_all("[advtrains]"..print_concat_table({t, ...})) end +sid=function(id) return string.sub(id, -4) end + +dofile(advtrains.modpath.."/helpers.lua"); +dofile(advtrains.modpath.."/debugitems.lua"); + +advtrains.meseconrules = +{{x=0, y=0, z=-1}, + {x=1, y=0, z=0}, + {x=-1, y=0, z=0}, + {x=0, y=0, z=1}, + {x=1, y=1, z=0}, + {x=1, y=-1, z=0}, + {x=-1, y=1, z=0}, + {x=-1, y=-1, z=0}, + {x=0, y=1, z=1}, + {x=0, y=-1, z=1}, + {x=0, y=1, z=-1}, + {x=0, y=-1, z=-1}, + {x=0, y=-2, z=0}} + +dofile(advtrains.modpath.."/trainlogic.lua") +dofile(advtrains.modpath.."/trainhud.lua") +dofile(advtrains.modpath.."/trackplacer.lua") +dofile(advtrains.modpath.."/tracks.lua") +dofile(advtrains.modpath.."/atc.lua") +dofile(advtrains.modpath.."/wagons.lua") + +dofile(advtrains.modpath.."/trackdb_legacy.lua") +dofile(advtrains.modpath.."/nodedb.lua") +dofile(advtrains.modpath.."/couple.lua") +dofile(advtrains.modpath.."/damage.lua") + +dofile(advtrains.modpath.."/signals.lua") +dofile(advtrains.modpath.."/misc_nodes.lua") +dofile(advtrains.modpath.."/crafting.lua") + +--load/save + +advtrains.fpath=minetest.get_worldpath().."/advtrains" +local file, err = io.open(advtrains.fpath, "r") +if not file then + minetest.log("error", " Failed to read advtrains save data from file "..advtrains.fpath..": "..(err or "Unknown Error")) +else + local tbl = minetest.deserialize(file:read("*a")) + if type(tbl) == "table" then + if tbl.version then + --congrats, we have the new save format. + advtrains.trains = tbl.trains + advtrains.wagon_save = tbl.wagon_save + advtrains.ndb.load_data(tbl.ndb) + advtrains.atc.load_data(tbl.atc) + --advtrains.latc.load_data(tbl.latc) + else + --oh no, its the old one... + advtrains.trains=tbl + --load ATC + advtrains.fpath_atc=minetest.get_worldpath().."/advtrains_atc" + local file, err = io.open(advtrains.fpath_atc, "r") + if not file then + local er=err or "Unknown Error" + atprint("Failed loading advtrains atc save file "..er) + else + local tbl = minetest.deserialize(file:read("*a")) + if type(tbl) == "table" then + advtrains.atc.controllers=tbl.controllers + end + file:close() + end + --load wagon saves + advtrains.fpath_ws=minetest.get_worldpath().."/advtrains_wagon_save" + local file, err = io.open(advtrains.fpath_ws, "r") + if not file then + local er=err or "Unknown Error" + atprint("Failed loading advtrains save file "..er) + else + local tbl = minetest.deserialize(file:read("*a")) + if type(tbl) == "table" then + advtrains.wagon_save=tbl + end + file:close() + end + end + else + minetest.log("error", " Failed to deserialize advtrains save data: Not a table!") + end + file:close() +end + +advtrains.save = function() + --atprint("saving") + advtrains.invalidate_all_paths() + + -- update wagon saves + for _,wagon in pairs(minetest.luaentities) do + if wagon.is_wagon and wagon.initialized then + wagon:get_staticdata() + end + end + --cross out userdata + for w_id, data in pairs(advtrains.wagon_save) do + data.name=nil + data.object=nil + if data.driver then + data.driver_name=data.driver:get_player_name() + data.driver=nil + else + data.driver_name=nil + end + if data.discouple then + data.discouple.object:remove() + data.discouple=nil + end + end + + --versions: + -- 1 - Initial new save format. + local save_tbl={ + trains = advtrains.trains, + wagon_save = advtrains.wagon_save, + atc = advtrains.atc.save_data(), + --latc = advtrains.latc.save_data(), + ndb = advtrains.ndb.save_data(), + version = 1, + } + local datastr = minetest.serialize(save_tbl) + if not datastr then + minetest.log("error", " Failed to serialize advtrains save data!") + return + end + local file, err = io.open(advtrains.fpath, "w") + if err then + minetest.log("error", " Failed to write advtrains save data to file "..advtrains.fpath..": "..(err or "Unknown Error")) + return + end + file:write(datastr) + file:close() +end +minetest.register_on_shutdown(advtrains.save) + + + + diff --git a/advtrains/advtrains/lua_atc.lua b/advtrains/advtrains/lua_atc.lua new file mode 100644 index 0000000..313d70d --- /dev/null +++ b/advtrains/advtrains/lua_atc.lua @@ -0,0 +1,166 @@ +------------- +--LUA ATC controllers + +local latc={} + +function latc.load_data(data) +end +function latc.save_data() + return stuff +end + +latc.data +latc.env_cdata +latc.init_code="" +latc.step_code="" + +advtrains.fpath_latc=minetest.get_worldpath().."/advtrains_latc" +local file, err = io.open(advtrains.fpath_atc, "r") +if not file then + local er=err or "Unknown Error" + atprint("Failed loading advtrains latc save file "..er) +else + local tbl = minetest.deserialize(file:read("*a")) + if type(tbl) == "table" then + atc.controllers=tbl.controllers + end + file:close() +end +function latc.save() + + local datastr = minetest.serialize({controllers = atc.controllers}) + if not datastr then + minetest.log("error", " Failed to serialize latc data!") + return + end + local file, err = io.open(advtrains.fpath_atc, "w") + if err then + return err + end + file:write(datastr) + file:close() +end + +--Privilege +--Only trusted players should be enabled to build stuff which can break the server. +--If I later decide to have multiple environments ('data' tables), I better store an owner for every controller for future reference. + +minetest.register_privilege("advtrains_lua_atc", { description = "Player can place and modify LUA ATC components. Grant with care! Allows to execute bad LUA code.", give_to_singleplayer = false, default= false }) + +--Environment +--Code from mesecons_luacontroller (credit goes to Jeija and mesecons contributors) + +local safe_globals = { + "assert", "error", "ipairs", "next", "pairs", "select", + "tonumber", "tostring", "type", "unpack", "_VERSION" +} +local function safe_print(param) + print(dump(param)) +end + +local function safe_date() + return(os.date("*t",os.time())) +end + +-- string.rep(str, n) with a high value for n can be used to DoS +-- the server. Therefore, limit max. length of generated string. +local function safe_string_rep(str, n) + if #str * n > mesecon.setting("luacontroller_string_rep_max", 64000) then + debug.sethook() -- Clear hook + error("string.rep: string length overflow", 2) + end + + return string.rep(str, n) +end + +-- string.find with a pattern can be used to DoS the server. +-- Therefore, limit string.find to patternless matching. +local function safe_string_find(...) + if (select(4, ...)) ~= true then + debug.sethook() -- Clear hook + error("string.find: 'plain' (fourth parameter) must always be true in a LuaController") + end + + return string.find(...) +end + +latc.static_env = { + print = safe_print, + string = { + byte = string.byte, + char = string.char, + format = string.format, + len = string.len, + lower = string.lower, + upper = string.upper, + rep = safe_string_rep, + reverse = string.reverse, + sub = string.sub, + find = safe_string_find, + }, + math = { + abs = math.abs, + acos = math.acos, + asin = math.asin, + atan = math.atan, + atan2 = math.atan2, + ceil = math.ceil, + cos = math.cos, + cosh = math.cosh, + deg = math.deg, + exp = math.exp, + floor = math.floor, + fmod = math.fmod, + frexp = math.frexp, + huge = math.huge, + ldexp = math.ldexp, + log = math.log, + log10 = math.log10, + max = math.max, + min = math.min, + modf = math.modf, + pi = math.pi, + pow = math.pow, + rad = math.rad, + random = math.random, + sin = math.sin, + sinh = math.sinh, + sqrt = math.sqrt, + tan = math.tan, + tanh = math.tanh, + }, + table = { + concat = table.concat, + insert = table.insert, + maxn = table.maxn, + remove = table.remove, + sort = table.sort, + }, + os = { + clock = os.clock, + difftime = os.difftime, + time = os.time, + datetable = safe_date, + }, +} +latc.static_env._G = env + +for _, name in pairs(safe_globals) do + latc.static_env[name] = _G[name] +end + + +--The environment all code calls get is a proxy table with a metatable. +--When an index is read: +-- Look in static_env +-- Look in volatile_env (user_written functions and userdata) +-- Look in saved_env (everything that's not a function or userdata) +--when an index is written: +-- If in static_env, do not allow +-- if function or userdata, volatile_env +-- if table, see below +-- else, save in saved_env + + + +advtrains.latc=latc diff --git a/misc_nodes.lua b/advtrains/advtrains/misc_nodes.lua index 93829f0..70b18fb 100644 --- a/misc_nodes.lua +++ b/advtrains/advtrains/misc_nodes.lua @@ -3,7 +3,7 @@ function advtrains.register_platform(preset) local ndef=minetest.registered_nodes[preset] if not ndef then - minetest.log("warning", "[advtrains] register_platform couldn't find preset node "..preset) + minetest.log("warning", " register_platform couldn't find preset node "..preset) return end local btex=ndef.tiles diff --git a/models/advtrains_dtrack_bumper_st.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st.b3d Binary files differindex a6d9745..a6d9745 100644 --- a/models/advtrains_dtrack_bumper_st.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_bumper_st.b3d diff --git a/models/advtrains_dtrack_bumper_st_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_30.b3d Binary files differindex 5f5b3f4..5f5b3f4 100644 --- a/models/advtrains_dtrack_bumper_st_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_30.b3d diff --git a/models/advtrains_dtrack_bumper_st_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_45.b3d Binary files differindex f13ae75..f13ae75 100644 --- a/models/advtrains_dtrack_bumper_st_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_45.b3d diff --git a/models/advtrains_dtrack_bumper_st_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_60.b3d Binary files differindex 59a2285..59a2285 100644 --- a/models/advtrains_dtrack_bumper_st_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_bumper_st_60.b3d diff --git a/models/advtrains_dtrack_cr.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr.b3d Binary files differindex 159717e..159717e 100644 --- a/models/advtrains_dtrack_cr.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_cr.b3d diff --git a/models/advtrains_dtrack_cr_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr_30.b3d Binary files differindex 09cdb1f..09cdb1f 100644 --- a/models/advtrains_dtrack_cr_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_cr_30.b3d diff --git a/models/advtrains_dtrack_cr_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr_45.b3d Binary files differindex 176da81..176da81 100644 --- a/models/advtrains_dtrack_cr_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_cr_45.b3d diff --git a/models/advtrains_dtrack_cr_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_cr_60.b3d Binary files differindex 00313c8..00313c8 100644 --- a/models/advtrains_dtrack_cr_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_cr_60.b3d diff --git a/models/advtrains_dtrack_detector_st.b3d b/advtrains/advtrains/models/advtrains_dtrack_detector_st.b3d Binary files differindex 893c8cd..6762bc3 100644 --- a/models/advtrains_dtrack_detector_st.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_detector_st.b3d diff --git a/models/advtrains_dtrack_detector_st_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_detector_st_30.b3d Binary files differindex 2e59e93..f2d5991 100644 --- a/models/advtrains_dtrack_detector_st_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_detector_st_30.b3d diff --git a/models/advtrains_dtrack_detector_st_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_detector_st_45.b3d Binary files differindex c73166f..9ecb4a6 100644 --- a/models/advtrains_dtrack_detector_st_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_detector_st_45.b3d diff --git a/models/advtrains_dtrack_detector_st_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_detector_st_60.b3d Binary files differindex b6bc9af..bd102cb 100644 --- a/models/advtrains_dtrack_detector_st_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_detector_st_60.b3d diff --git a/models/advtrains_dtrack_st.b3d b/advtrains/advtrains/models/advtrains_dtrack_st.b3d Binary files differindex f3e2753..f3e2753 100644 --- a/models/advtrains_dtrack_st.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_st.b3d diff --git a/models/advtrains_dtrack_st_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_st_30.b3d Binary files differindex 7a35c8d..7a35c8d 100644 --- a/models/advtrains_dtrack_st_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_st_30.b3d diff --git a/models/advtrains_dtrack_st_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_st_45.b3d Binary files differindex b2a1702..b2a1702 100644 --- a/models/advtrains_dtrack_st_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_st_45.b3d diff --git a/models/advtrains_dtrack_st_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_st_60.b3d Binary files differindex 0a59f77..0a59f77 100644 --- a/models/advtrains_dtrack_st_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_st_60.b3d diff --git a/models/advtrains_dtrack_swlcr.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr.b3d Binary files differindex 1adc23f..1adc23f 100644 --- a/models/advtrains_dtrack_swlcr.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlcr.b3d diff --git a/models/advtrains_dtrack_swlcr_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr_30.b3d Binary files differindex 7d8373b..7d8373b 100644 --- a/models/advtrains_dtrack_swlcr_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlcr_30.b3d diff --git a/models/advtrains_dtrack_swlcr_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr_45.b3d Binary files differindex 9679b9e..9679b9e 100644 --- a/models/advtrains_dtrack_swlcr_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlcr_45.b3d diff --git a/models/advtrains_dtrack_swlcr_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlcr_60.b3d Binary files differindex 3efc924..3efc924 100644 --- a/models/advtrains_dtrack_swlcr_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlcr_60.b3d diff --git a/models/advtrains_dtrack_swlst.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst.b3d Binary files differindex 93841a4..93841a4 100644 --- a/models/advtrains_dtrack_swlst.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlst.b3d diff --git a/models/advtrains_dtrack_swlst_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst_30.b3d Binary files differindex e9a90c7..e9a90c7 100644 --- a/models/advtrains_dtrack_swlst_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlst_30.b3d diff --git a/models/advtrains_dtrack_swlst_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst_45.b3d Binary files differindex 49c707c..49c707c 100644 --- a/models/advtrains_dtrack_swlst_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlst_45.b3d diff --git a/models/advtrains_dtrack_swlst_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swlst_60.b3d Binary files differindex c9a6ffe..c9a6ffe 100644 --- a/models/advtrains_dtrack_swlst_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swlst_60.b3d diff --git a/models/advtrains_dtrack_swrcr.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr.b3d Binary files differindex ee29b62..ee29b62 100644 --- a/models/advtrains_dtrack_swrcr.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrcr.b3d diff --git a/models/advtrains_dtrack_swrcr_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr_30.b3d Binary files differindex ba065e1..ba065e1 100644 --- a/models/advtrains_dtrack_swrcr_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrcr_30.b3d diff --git a/models/advtrains_dtrack_swrcr_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr_45.b3d Binary files differindex 7f9dc43..7f9dc43 100644 --- a/models/advtrains_dtrack_swrcr_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrcr_45.b3d diff --git a/models/advtrains_dtrack_swrcr_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrcr_60.b3d Binary files differindex b8ffa61..b8ffa61 100644 --- a/models/advtrains_dtrack_swrcr_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrcr_60.b3d diff --git a/models/advtrains_dtrack_swrst.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst.b3d Binary files differindex 0b3e7ad..0b3e7ad 100644 --- a/models/advtrains_dtrack_swrst.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrst.b3d diff --git a/models/advtrains_dtrack_swrst_30.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst_30.b3d Binary files differindex 4aea19b..4aea19b 100644 --- a/models/advtrains_dtrack_swrst_30.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrst_30.b3d diff --git a/models/advtrains_dtrack_swrst_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst_45.b3d Binary files differindex 4182fe5..4182fe5 100644 --- a/models/advtrains_dtrack_swrst_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrst_45.b3d diff --git a/models/advtrains_dtrack_swrst_60.b3d b/advtrains/advtrains/models/advtrains_dtrack_swrst_60.b3d Binary files differindex 6d2c891..6d2c891 100644 --- a/models/advtrains_dtrack_swrst_60.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_swrst_60.b3d diff --git a/models/advtrains_dtrack_vst1.b3d b/advtrains/advtrains/models/advtrains_dtrack_vst1.b3d Binary files differindex c9d7427..c9d7427 100644 --- a/models/advtrains_dtrack_vst1.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_vst1.b3d diff --git a/models/advtrains_dtrack_vst1_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_vst1_45.b3d Binary files differindex 14d438c..14d438c 100644 --- a/models/advtrains_dtrack_vst1_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_vst1_45.b3d diff --git a/models/advtrains_dtrack_vst2.b3d b/advtrains/advtrains/models/advtrains_dtrack_vst2.b3d Binary files differindex c128650..c128650 100644 --- a/models/advtrains_dtrack_vst2.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_vst2.b3d diff --git a/models/advtrains_dtrack_vst2_45.b3d b/advtrains/advtrains/models/advtrains_dtrack_vst2_45.b3d Binary files differindex 263276d..263276d 100644 --- a/models/advtrains_dtrack_vst2_45.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_vst2_45.b3d diff --git a/models/advtrains_dtrack_vst31.b3d b/advtrains/advtrains/models/advtrains_dtrack_vst31.b3d Binary files differindex df0f383..df0f383 100644 --- a/models/advtrains_dtrack_vst31.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_vst31.b3d diff --git a/models/advtrains_dtrack_vst32.b3d b/advtrains/advtrains/models/advtrains_dtrack_vst32.b3d Binary files differindex 01d2978..01d2978 100644 --- a/models/advtrains_dtrack_vst32.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_vst32.b3d diff --git a/models/advtrains_dtrack_vst33.b3d b/advtrains/advtrains/models/advtrains_dtrack_vst33.b3d Binary files differindex 7fe418d..7fe418d 100644 --- a/models/advtrains_dtrack_vst33.b3d +++ b/advtrains/advtrains/models/advtrains_dtrack_vst33.b3d diff --git a/models/advtrains_modernwagon.b3d b/advtrains/advtrains/models/advtrains_modernwagon.b3d Binary files differindex aacddca..aacddca 100644 --- a/models/advtrains_modernwagon.b3d +++ b/advtrains/advtrains/models/advtrains_modernwagon.b3d diff --git a/models/advtrains_retrosignal_off.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off.b3d Binary files differindex 3d231dd..3d231dd 100644 --- a/models/advtrains_retrosignal_off.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_off.b3d diff --git a/models/advtrains_retrosignal_off_30.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off_30.b3d Binary files differindex da258e1..da258e1 100644 --- a/models/advtrains_retrosignal_off_30.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_off_30.b3d diff --git a/models/advtrains_retrosignal_off_45.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off_45.b3d Binary files differindex 338224a..338224a 100644 --- a/models/advtrains_retrosignal_off_45.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_off_45.b3d diff --git a/models/advtrains_retrosignal_off_60.b3d b/advtrains/advtrains/models/advtrains_retrosignal_off_60.b3d Binary files differindex c560ca1..c560ca1 100644 --- a/models/advtrains_retrosignal_off_60.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_off_60.b3d diff --git a/models/advtrains_retrosignal_on.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on.b3d Binary files differindex 3d19439..3d19439 100644 --- a/models/advtrains_retrosignal_on.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_on.b3d diff --git a/models/advtrains_retrosignal_on_30.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on_30.b3d Binary files differindex 98f8a92..98f8a92 100644 --- a/models/advtrains_retrosignal_on_30.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_on_30.b3d diff --git a/models/advtrains_retrosignal_on_45.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on_45.b3d Binary files differindex 414e121..414e121 100644 --- a/models/advtrains_retrosignal_on_45.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_on_45.b3d diff --git a/models/advtrains_retrosignal_on_60.b3d b/advtrains/advtrains/models/advtrains_retrosignal_on_60.b3d Binary files differindex a51529a..a51529a 100644 --- a/models/advtrains_retrosignal_on_60.b3d +++ b/advtrains/advtrains/models/advtrains_retrosignal_on_60.b3d diff --git a/models/advtrains_signal.b3d b/advtrains/advtrains/models/advtrains_signal.b3d Binary files differindex 7f69560..7f69560 100644 --- a/models/advtrains_signal.b3d +++ b/advtrains/advtrains/models/advtrains_signal.b3d diff --git a/models/advtrains_signal_30.b3d b/advtrains/advtrains/models/advtrains_signal_30.b3d Binary files differindex 0b949a7..0b949a7 100644 --- a/models/advtrains_signal_30.b3d +++ b/advtrains/advtrains/models/advtrains_signal_30.b3d diff --git a/models/advtrains_signal_45.b3d b/advtrains/advtrains/models/advtrains_signal_45.b3d Binary files differindex ccaebf4..ccaebf4 100644 --- a/models/advtrains_signal_45.b3d +++ b/advtrains/advtrains/models/advtrains_signal_45.b3d diff --git a/models/advtrains_signal_60.b3d b/advtrains/advtrains/models/advtrains_signal_60.b3d Binary files differindex cf41e6d..cf41e6d 100644 --- a/models/advtrains_signal_60.b3d +++ b/advtrains/advtrains/models/advtrains_signal_60.b3d diff --git a/models/advtrains_track_cr.b3d b/advtrains/advtrains/models/advtrains_track_cr.b3d Binary files differindex b0f5e4b..b0f5e4b 100644 --- a/models/advtrains_track_cr.b3d +++ b/advtrains/advtrains/models/advtrains_track_cr.b3d diff --git a/models/advtrains_track_st.b3d b/advtrains/advtrains/models/advtrains_track_st.b3d Binary files differindex 10b5d90..10b5d90 100644 --- a/models/advtrains_track_st.b3d +++ b/advtrains/advtrains/models/advtrains_track_st.b3d diff --git a/models/advtrains_track_st_45.b3d b/advtrains/advtrains/models/advtrains_track_st_45.b3d Binary files differindex 32505a1..32505a1 100644 --- a/models/advtrains_track_st_45.b3d +++ b/advtrains/advtrains/models/advtrains_track_st_45.b3d diff --git a/models/trackplane.b3d b/advtrains/advtrains/models/trackplane.b3d Binary files differindex b4728c3..b4728c3 100644 --- a/models/trackplane.b3d +++ b/advtrains/advtrains/models/trackplane.b3d diff --git a/advtrains/advtrains/nodedb.lua b/advtrains/advtrains/nodedb.lua new file mode 100644 index 0000000..0e1d836 --- /dev/null +++ b/advtrains/advtrains/nodedb.lua @@ -0,0 +1,232 @@ +--nodedb.lua +--database of all nodes that have 'save_in_nodedb' field set to true in node definition + + + +--serialization format: +--(6byte poshash) (2byte contentid) +--contentid := (14bit nodeid, 2bit param2) + +local function hash_to_bytes(x) + local aH = math.floor(x / 1099511627776) % 256; + local aL = math.floor(x / 4294967296) % 256; + local bH = math.floor(x / 16777216) % 256; + local bL = math.floor(x / 65536) % 256; + local cH = math.floor(x / 256) % 256; + local cL = math.floor(x ) % 256; + return(string.char(aH, aL, bH, bL, cH, cL)); +end +local function cid_to_bytes(x) + local cH = math.floor(x / 256) % 256; + local cL = math.floor(x ) % 256; + return(string.char(cH, cL)); +end +local function bytes_to_hash(bytes) + local t={string.byte(bytes,1,-1)} + local n = + t[1] * 1099511627776 + + t[2] * 4294967296 + + t[3] * 16777216 + + t[4] * 65536 + + t[5] * 256 + + t[6] + return n +end +local function bytes_to_cid(bytes) + local t={string.byte(bytes,1,-1)} + local n = + t[1] * 256 + + t[2] + return n +end +local function l2b(x) + return x%4 +end +local function u14b(x) + return math.floor(x/4) +end +local ndb={} + +--local variables for performance +local ndb_nodeids={} +local ndb_nodes={} + +--load +--nodeids get loaded by advtrains init.lua and passed here +function ndb.load_data(data) + ndb_nodeids = data and data.nodeids or {} +end + +local path=minetest.get_worldpath().."/advtrains_ndb" + +local file, err = io.open(path, "r") +if not file then + atprint("load ndb failed: ", err or "Unknown Error") +else + local cnt=0 + local hst=file:read(6) + local cid=file:read(2) + while hst and #hst==6 and cid and #cid==2 do + ndb_nodes[bytes_to_hash(hst)]=bytes_to_cid(cid) + cnt=cnt+1 + hst=file:read(6) + cid=file:read(2) + end + atprint("nodedb: read", cnt, "nodes.") + file:close() +end + +--save +function ndb.save_data() + local file, err = io.open(path, "w") + if not file then + atprint("load ndb failed: ", err or "Unknown Error") + else + for hash, cid in pairs(ndb_nodes) do + file:write(hash_to_bytes(hash)) + file:write(cid_to_bytes(cid)) + end + file:close() + end + return {nodeids = ndb_nodeids} +end + +--function to get node. track database is not helpful here. +function ndb.get_node_or_nil(pos) + local node=minetest.get_node_or_nil(pos) + if node then + return node + else + --maybe we have the node in the database... + local cid=ndb_nodes[minetest.hash_node_position(pos)] + if cid then + local nodeid = ndb_nodeids[u14b(cid)] + if nodeid then + --atprint("ndb.get_node_or_nil",pos,"found node",nodeid,"cid",cid,"par2",l2b(cid)) + return {name=nodeid, param2 = l2b(cid)} + end + end + end + atprint("ndb.get_node_or_nil",pos,"not found") +end +function ndb.get_node(pos) + local n=ndb.get_node_or_nil(pos) + if not n then + return {name="ignore", param2=0} + end + return n +end + +function ndb.swap_node(pos, node) + minetest.swap_node(pos, node) + ndb.update(pos, node) +end + +function ndb.update(pos, pnode) + local node = pnode or minetest.get_node_or_nil(pos) + if not node or node.name=="ignore" then return end + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].groups.save_in_nodedb then + local nid + for tnid, nname in pairs(ndb_nodeids) do + if nname==node.name then + nid=tnid + end + end + if not nid then + nid=#ndb_nodeids+1 + ndb_nodeids[nid]=node.name + end + local hash = minetest.hash_node_position(pos) + ndb_nodes[hash] = (nid * 4) + (l2b(node.param2 or 0)) + --atprint("nodedb: updating node", pos, "stored nid",nid,"assigned",ndb_nodeids[nid],"resulting cid",ndb_nodes[hash]) + else + --at this position there is no longer a node that needs to be tracked. + local hash = minetest.hash_node_position(pos) + ndb_nodes[hash] = nil + end +end + +function ndb.clear(pos) + local hash = minetest.hash_node_position(pos) + ndb_nodes[hash] = nil +end + + +--get_node with pseudoload. now we only need track data, so we can use the trackdb as second fallback +--nothing new will be saved inside the trackdb. +--returns: +--true, conn1, conn2, rely1, rely2, railheight in case everything's right. +--false if it's not a rail or the train does not drive on this rail, but it is loaded or +--nil if the node is neither loaded nor in trackdb +--the distraction between false and nil will be needed only in special cases.(train initpos) +function advtrains.get_rail_info_at(pos, drives_on) + local rdp=advtrains.round_vector_floor_y(pos) + + local node=ndb.get_node_or_nil(rdp) + + --still no node? + --advtrains.trackdb is nil when there's no data available. + if not node then + if advtrains.trackdb then + --try raildb (see trackdb_legacy.lua) + local dbe=(advtrains.trackdb[rdp.y] and advtrains.trackdb[rdp.y][rdp.x] and advtrains.trackdb[rdp.y][rdp.x][rdp.z]) + if dbe then + for tt,_ in pairs(drives_on) do + if not dbe.tracktype or tt==dbe.tracktype then + return true, dbe.conn1, dbe.conn2, dbe.rely1 or 0, dbe.rely2 or 0, dbe.railheight or 0 + end + end + end + end + return nil + end + local nodename=node.name + if(not advtrains.is_track_and_drives_on(nodename, drives_on)) then + return false + end + local conn1, conn2, rely1, rely2, railheight, tracktype=advtrains.get_track_connections(node.name, node.param2) + + return true, conn1, conn2, rely1, rely2, railheight +end + + +minetest.register_abm({ + name = "advtrains:nodedb_on_load_update", + nodenames = {"group:save_in_nodedb"}, + run_at_every_load = true, + action = function(pos, node) + local cid=ndb_nodes[minetest.hash_node_position(pos)] + if cid then + --if in database, detect changes and apply. + local nodeid = ndb_nodeids[u14b(cid)] + local param2 = l2b(cid) + if not nodeid then + --something went wrong + atprint("nodedb: lbm nid not found", pos, "with nid", u14b(cid), "param2", param2, "cid is", cid) + ndb.update(pos, node) + else + if (nodeid~=node.name or param2~=node.param2) then + atprint("nodedb: lbm replaced", pos, "with nodeid", nodeid, "param2", param2, "cid is", cid) + minetest.swap_node(pos, {name=nodeid, param2 = param2}) + end + end + else + --if not in database, take it. + atprint("nodedb: ", pos, "not in database") + ndb.update(pos, node) + end + end, + interval=10, + chance=1, + }) + +minetest.register_on_dignode(function(pos, oldnode, digger) + ndb.clear(pos) +end) + +function ndb.t() + return ndb_nodes[141061759008906] +end + +advtrains.ndb=ndb + diff --git a/signals.lua b/advtrains/advtrains/signals.lua index 8be65e0..59c5af1 100644 --- a/signals.lua +++ b/advtrains/advtrains/signals.lua @@ -29,14 +29,15 @@ for r,f in pairs({on="off", off="on"}) do choppy=3, not_blocking_trains=1, not_in_creative_inventory=crea, + save_in_nodedb=1, }, mesecons = {effector = { ["action_"..f] = function (pos, node) - minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f..rotation, param2 = node.param2}) + advtrains.np.swap_node(pos, {name = "advtrains:retrosignal_"..f..rotation, param2 = node.param2}) end }}, on_rightclick=function(pos, node, clicker) - minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f..rotation, param2 = node.param2}) + advtrains.np.swap_node(pos, {name = "advtrains:retrosignal_"..f..rotation, param2 = node.param2}) end, }) advtrains.trackplacer.add_worked("advtrains:retrosignal", r, rotation, nil) @@ -59,6 +60,7 @@ for r,f in pairs({on="off", off="on"}) do choppy=3, not_blocking_trains=1, not_in_creative_inventory=crea, + save_in_nodedb=1, }, light_source = 1, sunlight_propagates=true, diff --git a/textures/advtrains_couple.png b/advtrains/advtrains/textures/advtrains_couple.png Binary files differindex 9e997e4..9e997e4 100644 --- a/textures/advtrains_couple.png +++ b/advtrains/advtrains/textures/advtrains_couple.png diff --git a/textures/advtrains_discouple.png b/advtrains/advtrains/textures/advtrains_discouple.png Binary files differindex b27c4fb..b27c4fb 100644 --- a/textures/advtrains_discouple.png +++ b/advtrains/advtrains/textures/advtrains_discouple.png diff --git a/advtrains/advtrains/textures/advtrains_dtrack_atc_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_atc_placer.png Binary files differnew file mode 100644 index 0000000..31c2b30 --- /dev/null +++ b/advtrains/advtrains/textures/advtrains_dtrack_atc_placer.png diff --git a/textures/advtrains_dtrack_bumper_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_bumper_placer.png Binary files differindex 27191fe..27191fe 100644 --- a/textures/advtrains_dtrack_bumper_placer.png +++ b/advtrains/advtrains/textures/advtrains_dtrack_bumper_placer.png diff --git a/textures/advtrains_dtrack_detector_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_detector_placer.png Binary files differindex e6c6ad6..e6c6ad6 100644 --- a/textures/advtrains_dtrack_detector_placer.png +++ b/advtrains/advtrains/textures/advtrains_dtrack_detector_placer.png diff --git a/advtrains/advtrains/textures/advtrains_dtrack_placer.png b/advtrains/advtrains/textures/advtrains_dtrack_placer.png Binary files differnew file mode 100644 index 0000000..7bef8a9 --- /dev/null +++ b/advtrains/advtrains/textures/advtrains_dtrack_placer.png diff --git a/advtrains/advtrains/textures/advtrains_dtrack_rail.png b/advtrains/advtrains/textures/advtrains_dtrack_rail.png Binary files differnew file mode 100644 index 0000000..1cf7f83 --- /dev/null +++ b/advtrains/advtrains/textures/advtrains_dtrack_rail.png diff --git a/advtrains/advtrains/textures/advtrains_dtrack_rail_atc.png b/advtrains/advtrains/textures/advtrains_dtrack_rail_atc.png Binary files differnew file mode 100644 index 0000000..d171985 --- /dev/null +++ b/advtrains/advtrains/textures/advtrains_dtrack_rail_atc.png diff --git a/advtrains/advtrains/textures/advtrains_dtrack_rail_detector_on.png b/advtrains/advtrains/textures/advtrains_dtrack_rail_detector_on.png Binary files differnew file mode 100644 index 0000000..4f09b35 --- /dev/null +++ b/advtrains/advtrains/textures/advtrains_dtrack_rail_detector_on.png diff --git a/textures/advtrains_dtrack_slopeplacer.png b/advtrains/advtrains/textures/advtrains_dtrack_slopeplacer.png Binary files differindex 1d456b0..1d456b0 100644 --- a/textures/advtrains_dtrack_slopeplacer.png +++ b/advtrains/advtrains/textures/advtrains_dtrack_slopeplacer.png diff --git a/textures/advtrains_platform.png b/advtrains/advtrains/textures/advtrains_platform.png Binary files differindex 5ba9663..5ba9663 100644 --- a/textures/advtrains_platform.png +++ b/advtrains/advtrains/textures/advtrains_platform.png diff --git a/textures/advtrains_retrosignal.png b/advtrains/advtrains/textures/advtrains_retrosignal.png Binary files differindex 141198d..141198d 100644 --- a/textures/advtrains_retrosignal.png +++ b/advtrains/advtrains/textures/advtrains_retrosignal.png diff --git a/textures/advtrains_retrosignal_inv.png b/advtrains/advtrains/textures/advtrains_retrosignal_inv.png Binary files differindex 1036594..1036594 100644 --- a/textures/advtrains_retrosignal_inv.png +++ b/advtrains/advtrains/textures/advtrains_retrosignal_inv.png diff --git a/textures/advtrains_signal_inv.png b/advtrains/advtrains/textures/advtrains_signal_inv.png Binary files differindex ed64ed9..ed64ed9 100644 --- a/textures/advtrains_signal_inv.png +++ b/advtrains/advtrains/textures/advtrains_signal_inv.png diff --git a/textures/advtrains_signal_off.png b/advtrains/advtrains/textures/advtrains_signal_off.png Binary files differindex 8046e52..8046e52 100644 --- a/textures/advtrains_signal_off.png +++ b/advtrains/advtrains/textures/advtrains_signal_off.png diff --git a/textures/advtrains_signal_on.png b/advtrains/advtrains/textures/advtrains_signal_on.png Binary files differindex 5228bb3..5228bb3 100644 --- a/textures/advtrains_signal_on.png +++ b/advtrains/advtrains/textures/advtrains_signal_on.png diff --git a/textures/advtrains_track_cr.png b/advtrains/advtrains/textures/advtrains_track_cr.png Binary files differindex 40f0cc5..40f0cc5 100644 --- a/textures/advtrains_track_cr.png +++ b/advtrains/advtrains/textures/advtrains_track_cr.png diff --git a/textures/advtrains_track_cr_45.png b/advtrains/advtrains/textures/advtrains_track_cr_45.png Binary files differindex 54966b3..54966b3 100644 --- a/textures/advtrains_track_cr_45.png +++ b/advtrains/advtrains/textures/advtrains_track_cr_45.png diff --git a/textures/advtrains_track_placer.png b/advtrains/advtrains/textures/advtrains_track_placer.png Binary files differindex 03e17ed..03e17ed 100644 --- a/textures/advtrains_track_placer.png +++ b/advtrains/advtrains/textures/advtrains_track_placer.png diff --git a/textures/advtrains_track_st.png b/advtrains/advtrains/textures/advtrains_track_st.png Binary files differindex 5ad7e4f..5ad7e4f 100644 --- a/textures/advtrains_track_st.png +++ b/advtrains/advtrains/textures/advtrains_track_st.png diff --git a/textures/advtrains_track_st_45.png b/advtrains/advtrains/textures/advtrains_track_st_45.png Binary files differindex 63b4c96..63b4c96 100644 --- a/textures/advtrains_track_st_45.png +++ b/advtrains/advtrains/textures/advtrains_track_st_45.png diff --git a/textures/advtrains_track_swlcr.png b/advtrains/advtrains/textures/advtrains_track_swlcr.png Binary files differindex d9b5c0b..d9b5c0b 100644 --- a/textures/advtrains_track_swlcr.png +++ b/advtrains/advtrains/textures/advtrains_track_swlcr.png diff --git a/textures/advtrains_track_swlcr_45.png b/advtrains/advtrains/textures/advtrains_track_swlcr_45.png Binary files differindex f098fc9..f098fc9 100644 --- a/textures/advtrains_track_swlcr_45.png +++ b/advtrains/advtrains/textures/advtrains_track_swlcr_45.png diff --git a/textures/advtrains_track_swlst.png b/advtrains/advtrains/textures/advtrains_track_swlst.png Binary files differindex 314bd2d..314bd2d 100644 --- a/textures/advtrains_track_swlst.png +++ b/advtrains/advtrains/textures/advtrains_track_swlst.png diff --git a/textures/advtrains_track_swlst_45.png b/advtrains/advtrains/textures/advtrains_track_swlst_45.png Binary files differindex 765d0ec..765d0ec 100644 --- a/textures/advtrains_track_swlst_45.png +++ b/advtrains/advtrains/textures/advtrains_track_swlst_45.png diff --git a/textures/advtrains_track_swrcr.png b/advtrains/advtrains/textures/advtrains_track_swrcr.png Binary files differindex f74e1bc..f74e1bc 100644 --- a/textures/advtrains_track_swrcr.png +++ b/advtrains/advtrains/textures/advtrains_track_swrcr.png diff --git a/textures/advtrains_track_swrcr_45.png b/advtrains/advtrains/textures/advtrains_track_swrcr_45.png Binary files differindex fa432aa..fa432aa 100644 --- a/textures/advtrains_track_swrcr_45.png +++ b/advtrains/advtrains/textures/advtrains_track_swrcr_45.png diff --git a/textures/advtrains_track_swrst.png b/advtrains/advtrains/textures/advtrains_track_swrst.png Binary files differindex 06ea29e..06ea29e 100644 --- a/textures/advtrains_track_swrst.png +++ b/advtrains/advtrains/textures/advtrains_track_swrst.png diff --git a/textures/advtrains_track_swrst_45.png b/advtrains/advtrains/textures/advtrains_track_swrst_45.png Binary files differindex be477b7..be477b7 100644 --- a/textures/advtrains_track_swrst_45.png +++ b/advtrains/advtrains/textures/advtrains_track_swrst_45.png diff --git a/textures/advtrains_trackworker.png b/advtrains/advtrains/textures/advtrains_trackworker.png Binary files differindex b50bcae..b50bcae 100644 --- a/textures/advtrains_trackworker.png +++ b/advtrains/advtrains/textures/advtrains_trackworker.png diff --git a/textures/drwho_screwdriver.png b/advtrains/advtrains/textures/drwho_screwdriver.png Binary files differindex b50bcae..b50bcae 100644 --- a/textures/drwho_screwdriver.png +++ b/advtrains/advtrains/textures/drwho_screwdriver.png diff --git a/advtrains/advtrains/trackdb_legacy.lua b/advtrains/advtrains/trackdb_legacy.lua new file mode 100644 index 0000000..99349e8 --- /dev/null +++ b/advtrains/advtrains/trackdb_legacy.lua @@ -0,0 +1,27 @@ +--trackdb_legacy.lua +--loads the (old) track database. the only use for this is to provide data for rails that haven't been written into the ndb database. +--nothing will be saved. +--if the user thinks that he has loaded every track in his world at least once, he can delete the track database. + +--trackdb[[y][x][z]={conn1, conn2, rely1, rely2, railheight} + + +--trackdb keeps its own save file. +advtrains.fpath_tdb=minetest.get_worldpath().."/advtrains_trackdb2" +local file, err = io.open(advtrains.fpath_tdb, "r") +if not file then + atprint("Not loading a trackdb file.") +else + local tbl = minetest.deserialize(file:read("*a")) + if type(tbl) == "table" then + advtrains.trackdb=tbl + atprint("Loaded trackdb file.") + end + file:close() +end + + + + + + diff --git a/trackplacer.lua b/advtrains/advtrains/trackplacer.lua index eebf2ae..1cb7680 100644 --- a/trackplacer.lua +++ b/advtrains/advtrains/trackplacer.lua @@ -117,19 +117,19 @@ function tp.bend_rail(originpos, conn, nnpref) return false--dont destroy existing track elseif adj1 and not adj2 then if tr.double_conn[adj1.."_"..newdir] then - minetest.set_node(pos, tr.double_conn[adj1.."_"..newdir]) + advtrains.ndb.swap_node(pos, tr.double_conn[adj1.."_"..newdir]) return true--if exists, connect new rail and old end end return false else if tr.single_conn[newdir] then--just rotate old rail to right orientation - minetest.set_node(pos, tr.single_conn[newdir]) + advtrains.ndb.swap_node(pos, tr.single_conn[newdir]) return true end return false end end -function tp.placetrack(pos, nnpref) +function tp.placetrack(pos, nnpref, placer, itemstack, pointed_thing) --1. find all rails that are likely to be connected local tr=tp.tracks[nnpref] local p_rails={} @@ -140,9 +140,16 @@ function tp.placetrack(pos, nnpref) end if #p_rails==0 then minetest.set_node(pos, {name=nnpref.."_"..tr.default}) + if minetest.registered_nodes[nnpref.."_"..tr.default] and minetest.registered_nodes[nnpref.."_"..tr.default].after_place_node then + minetest.registered_nodes[nnpref.."_"..tr.default].after_place_node(pos, placer, itemstack, pointed_thing) + end elseif #p_rails==1 then tp.bend_rail(pos, p_rails[1], nnpref) - minetest.set_node(pos, tr.single_conn[p_rails[1]]) + advtrains.ndb.swap_node(pos, tr.single_conn[p_rails[1]]) + local nname=tr.single_conn[p_rails[1]].name + if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then + minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing) + end else --iterate subsets for k1, conn1 in ipairs(p_rails) do @@ -151,7 +158,11 @@ function tp.placetrack(pos, nnpref) if (tr.double_conn[conn1.."_"..conn2]) then tp.bend_rail(pos, conn1, nnpref) tp.bend_rail(pos, conn2, nnpref) - minetest.set_node(pos, tr.double_conn[conn1.."_"..conn2]) + advtrains.ndb.swap_node(pos, tr.double_conn[conn1.."_"..conn2]) + local nname=tr.double_conn[conn1.."_"..conn2].name + if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then + minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing) + end return end end @@ -159,7 +170,11 @@ function tp.placetrack(pos, nnpref) end --not found tp.bend_rail(pos, p_rails[1], nnpref) - minetest.set_node(pos, tr.single_conn[p_rails[1]]) + advtrains.ndb.swap_node(pos, tr.single_conn[p_rails[1]]) + local nname=tr.single_conn[p_rails[1]].name + if minetest.registered_nodes[nname] and minetest.registered_nodes[nname].after_place_node then + minetest.registered_nodes[nname].after_place_node(pos, placer, itemstack, pointed_thing) + end end end @@ -183,7 +198,7 @@ function tp.register_track_placer(nnprefix, imgprefix, dispname) end if minetest.registered_nodes[minetest.get_node(pos).name] and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to and minetest.registered_nodes[minetest.get_node(upos).name] and minetest.registered_nodes[minetest.get_node(upos).name].walkable then - tp.placetrack(pos, nnprefix) + tp.placetrack(pos, nnprefix, placer, itemstack, pointed_thing) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end @@ -218,7 +233,7 @@ minetest.register_craftitem("advtrains:trackworker",{ if advtrains.is_train_at_pos(pos) then return end local nnprefix, suffix, rotation=string.match(node.name, "^(.+)_([^_]+)(_[^_]+)$") - --print(node.name.."\npattern recognizes:"..nodeprefix.." / "..railtype.." / "..rotation) + --atprint(node.name.."\npattern recognizes:"..nodeprefix.." / "..railtype.." / "..rotation) if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twrotate[suffix] then nnprefix, suffix=string.match(node.name, "^(.+)_([^_]+)$") rotation = "" @@ -230,7 +245,7 @@ minetest.register_craftitem("advtrains:trackworker",{ local modext=tp.tracks[nnprefix].twrotate[suffix] if rotation==modext[#modext] then --increase param2 - minetest.set_node(pos, {name=nnprefix.."_"..suffix..modext[1], param2=(node.param2+1)%4}) + advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..suffix..modext[1], param2=(node.param2+1)%4}) return else local modpos @@ -239,7 +254,7 @@ minetest.register_craftitem("advtrains:trackworker",{ minetest.chat_send_player(placer:get_player_name(), "This node can't be rotated using the trackworker!") return end - minetest.set_node(pos, {name=nnprefix.."_"..suffix..modext[modpos+1], param2=node.param2}) + advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..suffix..modext[modpos+1], param2=node.param2}) end advtrains.invalidate_all_paths() end @@ -259,7 +274,7 @@ minetest.register_craftitem("advtrains:trackworker",{ --if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end if advtrains.is_train_at_pos(pos) then return end local nnprefix, suffix, rotation=string.match(node.name, "^(.+)_([^_]+)(_[^_]+)$") - --print(node.name.."\npattern recognizes:"..nodeprefix.." / "..railtype.." / "..rotation) + --atprint(node.name.."\npattern recognizes:"..nodeprefix.." / "..railtype.." / "..rotation) if not tp.tracks[nnprefix] or not tp.tracks[nnprefix].twcycle[suffix] then nnprefix, suffix=string.match(node.name, "^(.+)_([^_]+)$") rotation = "" @@ -269,11 +284,11 @@ minetest.register_craftitem("advtrains:trackworker",{ end end local nextsuffix=tp.tracks[nnprefix].twcycle[suffix] - minetest.set_node(pos, {name=nnprefix.."_"..nextsuffix..rotation, param2=node.param2}) + advtrains.ndb.swap_node(pos, {name=nnprefix.."_"..nextsuffix..rotation, param2=node.param2}) --invalidate trains advtrains.invalidate_all_paths() else - print(name, dump(tp.tracks)) + atprint(name, dump(tp.tracks)) end end, }) diff --git a/tracks.lua b/advtrains/advtrains/tracks.lua index 99dbb27..1108a06 100644 --- a/tracks.lua +++ b/advtrains/advtrains/tracks.lua @@ -36,7 +36,8 @@ advtrains.all_tracktypes={} --definition preparation
local function conns(c1, c2, r1, r2, rh, rots) return {conn1=c1, conn2=c2, rely1=r1, rely2=r2, railheight=rh} end
-local t_30deg={
+local ap={}
+ap.t_30deg={
regstep=1,
variant={
st=conns(0,8),
@@ -110,7 +111,7 @@ local t_30deg={ rotation={"", "_30", "_45", "_60"},
increativeinv={},
}
-local t_30deg_straightonly={
+ap.t_30deg_straightonly={
regstep=1,
variant={
st=conns(0,8),
@@ -135,7 +136,7 @@ local t_30deg_straightonly={ rotation={"", "_30", "_45", "_60"},
increativeinv={st},
}
-local t_30deg_straightonly_noplacer={
+ap.t_30deg_straightonly_noplacer={
regstep=1,
variant={
st=conns(0,8),
@@ -160,7 +161,7 @@ local t_30deg_straightonly_noplacer={ rotation={"", "_30", "_45", "_60"},
increativeinv={st},
}
-local t_45deg={
+ap.t_45deg={
regstep=2,
variant={
st=conns(0,8),
@@ -215,6 +216,7 @@ local t_45deg={ rotation={"", "_45"},
increativeinv={vst1=true, vst2=true}
}
+advtrains.trackpresets = ap
--definition format: ([] optional)
--[[{
@@ -233,10 +235,7 @@ local t_45deg={ function advtrains.register_tracks(tracktype, def, preset)
local function make_switchfunc(suffix_target, mesecon_state)
local switchfunc=function(pos, node)
- if advtrains.is_train_at_pos(pos) then return end
- minetest.set_node(pos, {name=def.nodename_prefix.."_"..suffix_target, param2=node.param2})
- advtrains.invalidate_all_paths()
- advtrains.reset_trackdb_position(pos)
+ advtrains.ndb.swap_node(pos, {name=def.nodename_prefix.."_"..suffix_target, param2=node.param2})
end
return switchfunc, {effector = {
["action_"..mesecon_state] = switchfunc,
@@ -256,10 +255,12 @@ function advtrains.register_tracks(tracktype, def, preset) rely1=conns.rely1 or 0,
rely2=conns.rely2 or 0,
railheight=conns.railheight or 0,
+
on_rightclick=switchfunc,
groups = {
attached_node=1,
["advtrains_track_"..tracktype]=1,
+ save_in_nodedb=1,
dig_immediate=2,
not_in_creative_inventory=(not in_creative_inv and 1 or nil),
not_blocking_trains=1,
@@ -297,10 +298,10 @@ function advtrains.register_tracks(tracktype, def, preset) end,
after_dig_node=function(pos)
advtrains.invalidate_all_paths()
- advtrains.reset_trackdb_position(pos)
+ advtrains.ndb.update(pos)
end,
after_place_node=function(pos)
- advtrains.reset_trackdb_position(pos)
+ advtrains.ndb.update(pos)
end,
}, def.common or {})
--make trackplacer base def
@@ -346,17 +347,17 @@ function advtrains.register_tracks(tracktype, def, preset) end
end
end
- table.insert(advtrains.all_tracktypes, tracktype)
+ advtrains.all_tracktypes[tracktype]=true
end
-function advtrains.is_track_and_drives_on(nodename, drives_on)
+function advtrains.is_track_and_drives_on(nodename, drives_on_p)
if not minetest.registered_nodes[nodename] then
return false
end
local nodedef=minetest.registered_nodes[nodename]
- for k,v in ipairs(drives_on) do
- if nodedef.groups["advtrains_track_"..v] then
+ for k,v in pairs(drives_on_p) do
+ if nodedef.groups["advtrains_track_"..k] then
return true
end
end
@@ -365,12 +366,19 @@ end function advtrains.get_track_connections(name, param2)
local nodedef=minetest.registered_nodes[name]
- if not nodedef then print("[advtrains] get_track_connections couldn't find nodedef for nodename "..(name or "nil")) return 0, 8, 0, 0, 0 end
+ if not nodedef then atprint(" get_track_connections couldn't find nodedef for nodename "..(name or "nil")) return 0, 8, 0, 0, 0 end
local noderot=param2
if not param2 then noderot=0 end
- if noderot > 3 then print("[advtrains] get_track_connections: rail has invaild param2 of "..noderot) noderot=0 end
+ if noderot > 3 then atprint(" get_track_connections: rail has invaild param2 of "..noderot) noderot=0 end
- return (nodedef.connect1 + 4 * noderot)%16, (nodedef.connect2 + 4 * noderot)%16, nodedef.rely1 or 0, nodedef.rely2 or 0, nodedef.railheight or 0
+ local tracktype
+ for k,_ in pairs(nodedef.groups) do
+ local tt=string.match(k, "^advtrains_track_(.+)$")
+ if tt then
+ tracktype=tt
+ end
+ end
+ return (nodedef.connect1 + 4 * noderot)%16, (nodedef.connect2 + 4 * noderot)%16, nodedef.rely1 or 0, nodedef.rely2 or 0, nodedef.railheight or 0, tracktype
end
--detector code
@@ -386,50 +394,82 @@ advtrains.detector.clean_step_before = false --The entry already being contained in advtrains.detector.on_node_restore will not trigger an on_train_enter event on the node. (when path is reset, this is saved).
function advtrains.detector.enter_node(pos, train_id)
local pts = minetest.pos_to_string(advtrains.round_vector_floor_y(pos))
- --print("enterNode "..pts.." "..train_id)
- if not advtrains.detector.on_node[pts] then
- advtrains.detector.on_node[pts]=train_id
- if advtrains.detector.on_node_restore[pts] then
- advtrains.detector.on_node_restore[pts]=nil
+ --atprint("enterNode "..pts.." "..sid(train_id))
+ if advtrains.detector.on_node[pts] then
+ if advtrains.trains[advtrains.detector.on_node[pts]] then
+ --atprint(""..pts.." already occupied")
+ return false
else
- advtrains.detector.call_enter_callback(advtrains.round_vector_floor_y(pos), train_id)
+ advtrains.detector.leave_node(pos, advtrains.detector.on_node[pts])
end
end
+ advtrains.detector.on_node[pts]=train_id
+ if advtrains.detector.on_node_restore[pts]==train_id then
+ advtrains.detector.on_node_restore[pts]=nil
+ else
+ advtrains.detector.call_enter_callback(advtrains.round_vector_floor_y(pos), train_id)
+ end
+ return true
end
function advtrains.detector.leave_node(pos, train_id)
local pts = minetest.pos_to_string(advtrains.round_vector_floor_y(pos))
- --print("leaveNode "..pts.." "..train_id)
- if advtrains.detector.on_node[pts] then
+ --atprint("leaveNode "..pts.." "..sid(train_id))
+ if not advtrains.detector.on_node[pts] then
+ --atprint(""..pts.." leave: nothing here")
+ return false
+ end
+ if advtrains.detector.on_node[pts]==train_id then
advtrains.detector.call_leave_callback(advtrains.round_vector_floor_y(pos), train_id)
advtrains.detector.on_node[pts]=nil
+ else
+ if advtrains.trains[advtrains.detector.on_node[pts]] then
+ --atprint(""..pts.." occupied by another train")
+ return false
+ else
+ advtrains.detector.leave_node(pos, advtrains.detector.on_node[pts])
+ return false
+ end
end
+ return true
end
--called immediately before invalidating paths
function advtrains.detector.setup_restore()
- --print("setup_restore")
- advtrains.detector.on_node_restore = advtrains.detector.on_node
+ --atprint("setup_restore")
+ -- don't execute if it already has been called. For some reason it gets called twice...
+ if advtrains.detector.clean_step_before then
+ return
+ end
+ advtrains.detector.on_node_restore={}
+ for k, v in pairs(advtrains.detector.on_node) do
+ advtrains.detector.on_node_restore[k]=v
+ end
advtrains.detector.on_node = {}
+ advtrains.detector.clean_step_before = true
end
--called one step after invalidating paths, when all trains have restored their path and called enter_node for their contents.
function advtrains.detector.finalize_restore()
- --print("finalize_restore")
+ --atprint("finalize_restore")
for pts, train_id in pairs(advtrains.detector.on_node_restore) do
- --print("called leave callback "..pts.." "..train_id)
+ --atprint("called leave callback "..pts.." "..train_id)
advtrains.detector.call_leave_callback(minetest.string_to_pos(pts), train_id)
end
advtrains.detector.on_node_restore = {}
+ advtrains.detector.clean_step_before = false
end
function advtrains.detector.call_enter_callback(pos, train_id)
- --print("instructed to call enter calback")
+ --atprint("instructed to call enter calback")
local node = minetest.get_node(pos) --this spares the check if node is nil, it has a name in any case
local mregnode=minetest.registered_nodes[node.name]
if mregnode and mregnode.advtrains and mregnode.advtrains.on_train_enter then
mregnode.advtrains.on_train_enter(pos, train_id)
- end
+ end
+
+ --atc code wants to be notified too
+ advtrains.atc.trigger_controller_train_enter(pos, train_id)
end
function advtrains.detector.call_leave_callback(pos, train_id)
- --print("instructed to call leave calback")
+ --atprint("instructed to call leave calback")
local node = minetest.get_node(pos) --this spares the check if node is nil, it has a name in any case
local mregnode=minetest.registered_nodes[node.name]
@@ -556,7 +596,7 @@ advtrains.register_tracks("regular", { shared_model="trackplane.b3d",
description="Deprecated Track",
formats={vst1={}, vst2={}},
-}, t_45deg)
+}, ap.t_45deg)
advtrains.register_tracks("default", {
@@ -567,7 +607,7 @@ advtrains.register_tracks("default", { shared_texture="advtrains_dtrack_rail.png",
description="Track",
formats={vst1={true, false, true}, vst2={true, false, true}, vst31={true}, vst32={true}, vst33={true}},
-}, t_30deg)
+}, ap.t_30deg)
--bumpers
advtrains.register_tracks("default", {
@@ -578,7 +618,7 @@ advtrains.register_tracks("default", { shared_texture="advtrains_dtrack_rail.png",
description="Bumper",
formats={},
-}, t_30deg_straightonly)
+}, ap.t_30deg_straightonly)
--legacy bumpers
for _,rot in ipairs({"", "_30", "_45", "_60"}) do
minetest.register_alias("advtrains:dtrack_bumper"..rot, "advtrains:dtrack_bumper_st"..rot)
@@ -609,7 +649,7 @@ if mesecon then }
}
end
- }, t_30deg_straightonly)
+ }, ap.t_30deg_straightonly)
advtrains.register_tracks("default", {
nodename_prefix="advtrains:dtrack_detector_on",
texture_prefix="advtrains_dtrack_detector",
@@ -634,7 +674,7 @@ if mesecon then }
}
end
- }, t_30deg_straightonly_noplacer)
+ }, ap.t_30deg_straightonly_noplacer)
end
--TODO legacy
--I know lbms are better for this purpose
diff --git a/trainhud.lua b/advtrains/advtrains/trainhud.lua index aead246..e69f04a 100644 --- a/trainhud.lua +++ b/advtrains/advtrains/trainhud.lua @@ -11,7 +11,7 @@ local mletter={[1]="F", [-1]="R", [0]="N"} function advtrains.on_control_change(pc, train, flip) if pc.sneak then if pc.up then - train.tarvelocity = advtrains.all_traintypes[train.traintype].max_speed or 10 + train.tarvelocity = train.max_speed or 10 end if pc.down then train.tarvelocity = 0 @@ -94,14 +94,14 @@ function advtrains.set_trainhud(name, text) end function advtrains.hud_train_format(train, flip) local fct=flip and -1 or 1 - if not train or not train.traintype then return "" end + if not train then return "" end - local max=advtrains.all_traintypes[train.traintype].max_speed or 10 + local max=train.max_speed or 10 local vel=advtrains.abs_ceil(train.velocity) local tvel=advtrains.abs_ceil(train.tarvelocity) local topLine, firstLine, secondLine - topLine=train.traintype.." ["..mletter[fct*train.movedir].."] "..(train.brake and "="..( train.brake_hold_state==2 and "^" or "" ).."B=" or "") + topLine="Train".." ["..mletter[fct*train.movedir].."] "..(train.brake and "="..( train.brake_hold_state==2 and "^" or "" ).."B=" or "") firstLine="Speed: |"..string.rep("+", vel)..string.rep("_", max-vel)..">" secondLine="Target: |"..string.rep("+", tvel)..string.rep("_", max-tvel)..">" diff --git a/trainlogic.lua b/advtrains/advtrains/trainlogic.lua index 94dcb69..5bedfec 100644 --- a/trainlogic.lua +++ b/advtrains/advtrains/trainlogic.lua @@ -1,16 +1,13 @@ --trainlogic.lua --controls train entities stuff about connecting/disconnecting/colliding trains and other things ---local print=function(t, ...) minetest.log("action", table.concat({t, ...}, " ")) minetest.chat_send_all(table.concat({t, ...}, " ")) end -local print=function() end local benchmark=false ---printbm=function(str, t) print("[advtrains]"..str.." "..((os.clock()-t)*1000).."ms") end local bm={} local bmlt=0 local bmsteps=0 local bmstepint=200 -printbm=function(action, ta) +atprintbm=function(action, ta) if not benchmark then return end local t=(os.clock()-ta)*1000 if not bm[action] then @@ -34,123 +31,23 @@ function endstep() end end ---TODO: these values need to be integrated when i remove traintypes. advtrains.train_accel_force=2--per second and divided by number of wagons advtrains.train_brake_force=3--per second, not divided by number of wagons advtrains.train_roll_force=0.5--per second, not divided by number of wagons, acceleration when rolling without brake advtrains.train_emerg_force=10--for emergency brakes(when going off track) -advtrains.audit_interval=30 - -advtrains.all_traintypes={} -function advtrains.register_train_type(name, drives_on, max_speed) - advtrains.all_traintypes[name]={} - advtrains.all_traintypes[name].drives_on=drives_on - advtrains.all_traintypes[name].max_speed=max_speed or 10 -end - - -advtrains.trains={} -advtrains.wagon_save={} - ---load initially -advtrains.fpath=minetest.get_worldpath().."/advtrains" -local file, err = io.open(advtrains.fpath, "r") -if not file then - local er=err or "Unknown Error" - print("[advtrains]Failed loading advtrains save file "..er) -else - local tbl = minetest.deserialize(file:read("*a")) - if type(tbl) == "table" then - advtrains.trains=tbl - end - file:close() -end -advtrains.fpath_ws=minetest.get_worldpath().."/advtrains_wagon_save" -local file, err = io.open(advtrains.fpath_ws, "r") -if not file then - local er=err or "Unknown Error" - print("[advtrains]Failed loading advtrains save file "..er) -else - local tbl = minetest.deserialize(file:read("*a")) - if type(tbl) == "table" then - advtrains.wagon_save=tbl - end - file:close() -end +advtrains.audit_interval=10 -advtrains.save = function() - --print("[advtrains]saving") - advtrains.invalidate_all_paths() - local datastr = minetest.serialize(advtrains.trains) - if not datastr then - minetest.log("error", "[advtrains] Failed to serialize train data!") - return - end - local file, err = io.open(advtrains.fpath, "w") - if err then - return err - end - file:write(datastr) - file:close() - - -- update wagon saves - for _,wagon in pairs(minetest.luaentities) do - if wagon.is_wagon and wagon.initialized then - wagon:get_staticdata() - end - end - --cross out userdata - for w_id, data in pairs(advtrains.wagon_save) do - data.name=nil - data.object=nil - if data.driver then - data.driver_name=data.driver:get_player_name() - data.driver=nil - else - data.driver_name=nil - end - if data.discouple then - data.discouple.object:remove() - data.discouple=nil - end - end - --print(dump(advtrains.wagon_save)) - datastr = minetest.serialize(advtrains.wagon_save) - if not datastr then - minetest.log("error", "[advtrains] Failed to serialize train data!") - return - end - file, err = io.open(advtrains.fpath_ws, "w") - if err then - return err - end - file:write(datastr) - file:close() - - advtrains.save_trackdb() -end -minetest.register_on_shutdown(advtrains.save) - advtrains.save_and_audit_timer=advtrains.audit_interval minetest.register_globalstep(function(dtime) advtrains.save_and_audit_timer=advtrains.save_and_audit_timer-dtime if advtrains.save_and_audit_timer<=0 then local t=os.clock() - --print("[advtrains] audit step") - --clean up orphaned trains - for k,v in pairs(advtrains.trains) do - --advtrains.update_trainpart_properties(k) - if #v.trainparts==0 then - print("[advtrains][train "..k.."] has empty trainparts, removing.") - advtrains.trains[k]=nil - end - end --save advtrains.save() advtrains.save_and_audit_timer=advtrains.audit_interval - printbm("saving", t) + atprintbm("saving", t) end --regular train step local t=os.clock() @@ -163,12 +60,15 @@ minetest.register_globalstep(function(dtime) advtrains.detector.finalize_restore() end - printbm("trainsteps", t) + atprintbm("trainsteps", t) endstep() end) function advtrains.train_step(id, train, dtime) - + --Legacy: set drives_on and max_speed + if not train.drives_on or not train.max_speed then + advtrains.update_trainpart_properties(id) + end --TODO check for all vars to be present if not train.velocity then train.velocity=0 @@ -186,7 +86,7 @@ function advtrains.train_step(id, train, dtime) --if not train.last_pos then advtrains.trains[id]=nil return end if not advtrains.pathpredict(id, train) then - print("pathpredict failed(returned false)") + atprint("pathpredict failed(returned false)") train.velocity=0 train.tarvelocity=0 return @@ -196,7 +96,7 @@ function advtrains.train_step(id, train, dtime) if not path then train.velocity=0 train.tarvelocity=0 - print("train has no path for whatever reason") + atprint("train has no path for whatever reason") return end @@ -249,26 +149,17 @@ function advtrains.train_step(id, train, dtime) train.detector_old_index = math.floor(train.index) train.detector_old_end_index = math.floor(train_end_index) + --remove? + if #train.trainparts==0 then + atprint("[train "..sid(id).."] has empty trainparts, removing.") + advtrains.detector.leave_node(path[train.detector_old_index], id) + advtrains.trains[id]=nil + return + end + if train_moves then --check for collisions by finding objects - --front - local search_radius=4 - --coupling - local couple_outward=1 - local posfront=advtrains.get_real_index_position(path, train.index+couple_outward) - local posback=advtrains.get_real_index_position(path, train_end_index-couple_outward) - for _,pos in ipairs({posfront, posback}) do - if pos then - local objrefs=minetest.get_objects_inside_radius(pos, search_radius) - for _,v in pairs(objrefs) do - local le=v:get_luaentity() - if le and le.is_wagon and le.initialized and le.train_id~=id then - advtrains.try_connect_trains(id, le.train_id) - end - end - end - end --heh, new collision again. --this time, based on NODES and the advtrains.detector.on_node table. local collpos @@ -282,61 +173,40 @@ function advtrains.train_step(id, train, dtime) local rcollpos=advtrains.round_vector_floor_y(collpos) for x=-1,1 do for z=-1,1 do - local testpts=minetest.pos_to_string(vector.add(rcollpos, {x=x, y=0, z=z})) + local testpos=vector.add(rcollpos, {x=x, y=0, z=z}) + local testpts=minetest.pos_to_string(testpos) if advtrains.detector.on_node[testpts] and advtrains.detector.on_node[testpts]~=id then - --collides - train.recently_collided_with_env=true - train.velocity=0.5*train.velocity - train.movedir=train.movedir*-1 - train.tarvelocity=0 + if advtrains.trains[advtrains.detector.on_node[testpts]] then + --collides + advtrains.spawn_couple_on_collide(id, testpos, advtrains.detector.on_node[testpts], train.movedir==-1) + + train.recently_collided_with_env=true + train.velocity=0.5*train.velocity + train.movedir=train.movedir*-1 + train.tarvelocity=0 + else + --unexistant train left in this place + advtrains.detector.on_node[testpts]=nil + end end end end end end --check for any trainpart entities if they have been unloaded. do this only if train is near a player, to not spawn entities into unloaded areas + --todo function will be taken by update_trainpart_properties train.check_trainpartload=(train.check_trainpartload or 0)-dtime local node_range=(math.max((minetest.setting_get("active_block_range") or 0),1)*16) if train.check_trainpartload<=0 then local ori_pos=advtrains.get_real_index_position(path, train.index) --not much to calculate - print("[advtrains][train "..id.."] at "..minetest.pos_to_string(vector.round(ori_pos))) + --atprint("[train "..id.."] at "..minetest.pos_to_string(vector.round(ori_pos))) local should_check=false for _,p in ipairs(minetest.get_connected_players()) do should_check=should_check or ((vector.distance(ori_pos, p:getpos())<node_range)) end if should_check then - --it is better to iterate luaentites only once - --print("check_trainpartload") - local found_uids={} - for _,wagon in pairs(minetest.luaentities) do - if wagon.is_wagon and wagon.initialized and wagon.train_id==id then - if found_uids[wagon.unique_id] then - --duplicate found, delete it - if wagon.object then wagon.object:remove() end - else - found_uids[wagon.unique_id]=true - end - end - end - --print("found_uids: "..dump(found_uids)) - --now iterate trainparts and check. then cross them out to see if there are wagons over for any reason - for pit, w_id in ipairs(train.trainparts) do - 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.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... - table.remove(train.trainparts, pit) - end - end + advtrains.update_trainpart_properties(id) end train.check_trainpartload=2 end @@ -352,6 +222,24 @@ function advtrains.train_step(id, train, dtime) if train.locomotives_in_train==0 then train.tarvelocity=0 end + + --interpret ATC command + if train.atc_brake_target and train.atc_brake_target>=train.velocity then + train.atc_brake_target=nil + end + if train.atc_wait_finish then + if not train.atc_brake_target and train.velocity==train.tarvelocity then + train.atc_wait_finish=nil + end + end + if train.atc_command then + if train.atc_delay<=0 and not train.atc_wait_finish then + advtrains.atc.execute_atc_command(id, train) + else + train.atc_delay=train.atc_delay-dtime + end + end + --make brake adjust the tarvelocity if necessary if train.brake and (math.ceil(train.velocity)-1)<train.tarvelocity then train.tarvelocity=math.max((math.ceil(train.velocity)-1), 0) @@ -362,24 +250,24 @@ function advtrains.train_step(id, train, dtime) local mass=#train.trainparts local diff=train.tarvelocity-train.velocity if diff>0 then--accelerating, force will be brought on only by locomotives. - --print("accelerating with default force") + --atprint("accelerating with default force") applydiff=(math.min((advtrains.train_accel_force*train.locomotives_in_train*dtime)/mass, math.abs(diff))) else--decelerating if front_off_track or back_off_track or train.recently_collided_with_env then --every wagon has a brake, so not divided by mass. - --print("braking with emergency force") + --atprint("braking with emergency force") applydiff= -(math.min((advtrains.train_emerg_force*dtime), math.abs(diff))) - elseif train.brake then - --print("braking with default force") + elseif train.brake or (train.atc_brake_target and train.atc_brake_target<train.velocity) then + --atprint("braking with default force") --no math.min, because it can grow beyond tarvelocity, see up there --dont worry, it will never fall below zero. applydiff= -((advtrains.train_brake_force*dtime)) else - --print("roll") + --atprint("roll") applydiff= -(math.min((advtrains.train_roll_force*dtime), math.abs(diff))) end end train.last_accel=(applydiff*train.movedir) - train.velocity=math.min(math.max( train.velocity+applydiff , 0), advtrains.all_traintypes[train.traintype].max_speed) + train.velocity=math.min(math.max( train.velocity+applydiff , 0), train.max_speed or 10) else train.last_accel=0 end @@ -422,14 +310,13 @@ wagon_proto={ ]] --returns new id -function advtrains.create_new_train_at(pos, pos_prev, traintype) +function advtrains.create_new_train_at(pos, pos_prev) local newtrain_id=os.time()..os.clock() while advtrains.trains[newtrain_id] do newtrain_id=os.time()..os.clock() end--ensure uniqueness(will be unneccessary) advtrains.trains[newtrain_id]={} advtrains.trains[newtrain_id].last_pos=pos advtrains.trains[newtrain_id].last_pos_prev=pos_prev - advtrains.trains[newtrain_id].traintype=traintype advtrains.trains[newtrain_id].tarvelocity=0 advtrains.trains[newtrain_id].velocity=0 advtrains.trains[newtrain_id].trainparts={} @@ -439,42 +326,44 @@ end --returns false on failure. handle this case! function advtrains.pathpredict(id, train) - --print("pos ",x,y,z) + --atprint("pos ",x,y,z) --::rerun:: if not train.index then train.index=0 end if not train.path or #train.path<2 then if not train.last_pos then --no chance to recover - print("[advtrains]train hasn't saved last-pos, removing train.") + atprint("train hasn't saved last-pos, removing train.") advtrains.train[id]=nil return false end - local node_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(train.last_pos), train.traintype) + local node_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(train.last_pos), train.drives_on) if node_ok==nil then --block not loaded, do nothing + atprint("last_pos not available") return nil elseif node_ok==false then - print("[advtrains]no track here, (fail) removing train.") + atprint("no track here, (fail) removing train.") advtrains.trains[id]=nil return false end if not train.last_pos_prev then --no chance to recover - print("[advtrains]train hasn't saved last-pos_prev, removing train.") + atprint("train hasn't saved last-pos_prev, removing train.") advtrains.trains[id]=nil return false end - local prevnode_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(train.last_pos_prev), train.traintype) + local prevnode_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(train.last_pos_prev), train.drives_on) if prevnode_ok==nil then --block not loaded, do nothing + atprint("prev not available") return nil elseif prevnode_ok==false then - print("[advtrains]no track at prev, (fail) removing train.") + atprint("no track at prev, (fail) removing train.") advtrains.trains[id]=nil return false end @@ -500,34 +389,34 @@ function advtrains.pathpredict(id, train) end - local maxn=advtrains.maxN(train.path) + local maxn=train.max_index_on_track or 0 while (maxn-train.index) < pregen_front do--pregenerate - --print("[advtrains]maxn conway for ",maxn,minetest.pos_to_string(path[maxn]),maxn-1,minetest.pos_to_string(path[maxn-1])) - local conway=advtrains.conway(train.path[maxn], train.path[maxn-1], train.traintype) + --atprint("maxn conway for ",maxn,minetest.pos_to_string(path[maxn]),maxn-1,minetest.pos_to_string(path[maxn-1])) + local conway=advtrains.conway(train.path[maxn], train.path[maxn-1], train.drives_on) if conway then train.path[maxn+1]=conway train.max_index_on_track=maxn else --do as if nothing has happened and preceed with path --but do not update max_index_on_track - --print("over-generating path max to index "..maxn+1) + atprint("over-generating path max to index "..(maxn+1).." (position "..minetest.pos_to_string(train.path[maxn]).." )") train.path[maxn+1]=vector.add(train.path[maxn], vector.subtract(train.path[maxn], train.path[maxn-1])) end train.path_dist[maxn]=vector.distance(train.path[maxn+1], train.path[maxn]) maxn=advtrains.maxN(train.path) end - local minn=advtrains.minN(train.path) + local minn=train.min_index_on_track or 0 while (train.index-minn) < (train.trainlen or 0) + pregen_back do --post_generate. has to be at least trainlen. (we let go of the exact calculation here since this would be unuseful here) - --print("[advtrains]minn conway for ",minn,minetest.pos_to_string(path[minn]),minn+1,minetest.pos_to_string(path[minn+1])) - local conway=advtrains.conway(train.path[minn], train.path[minn+1], train.traintype) + --atprint("minn conway for ",minn,minetest.pos_to_string(path[minn]),minn+1,minetest.pos_to_string(path[minn+1])) + local conway=advtrains.conway(train.path[minn], train.path[minn+1], train.drives_on) if conway then train.path[minn-1]=conway train.min_index_on_track=minn else --do as if nothing has happened and preceed with path --but do not update min_index_on_track - --print("over-generating path min to index "..minn-1) + atprint("over-generating path min to index "..(minn-1).." (position "..minetest.pos_to_string(train.path[minn]).." )") train.path[minn-1]=vector.add(train.path[minn], vector.subtract(train.path[minn], train.path[minn+1])) end train.path_dist[minn-1]=vector.distance(train.path[minn], train.path[minn-1]) @@ -541,12 +430,12 @@ function advtrains.pathpredict(id, train) train.savedpos_off_track_index_offset=train.index-train.max_index_on_track train.last_pos=train.path[train.max_index_on_track] train.last_pos_prev=train.path[train.max_index_on_track-1] - --print("train is off-track (front), last positions kept at "..minetest.pos_to_string(train.last_pos).." / "..minetest.pos_to_string(train.last_pos_prev)) + atprint("train is off-track (front), last positions kept at "..minetest.pos_to_string(train.last_pos).." / "..minetest.pos_to_string(train.last_pos_prev)) elseif train.min_index_on_track+1>train.index then --whoops, train went even more far. same behavior train.savedpos_off_track_index_offset=train.index-train.min_index_on_track train.last_pos=train.path[train.min_index_on_track+1] train.last_pos_prev=train.path[train.min_index_on_track] - --print("train is off-track (back), last positions kept at "..minetest.pos_to_string(train.last_pos).." / "..minetest.pos_to_string(train.last_pos_prev)) + atprint("train is off-track (back), last positions kept at "..minetest.pos_to_string(train.last_pos).." / "..minetest.pos_to_string(train.last_pos_prev)) else --regular case train.savedpos_off_track_index_offset=nil train.last_pos=train.path[math.floor(train.index+0.5)] @@ -578,29 +467,61 @@ function advtrains.add_wagon_to_train(wagon, train_id, index) end function advtrains.update_trainpart_properties(train_id, invert_flipstate) local train=advtrains.trains[train_id] + train.drives_on=advtrains.all_tracktypes + train.max_speed=20 local rel_pos=0 local count_l=0 for i, w_id in ipairs(train.trainparts) do - local any_loaded=false - for _,wagon in pairs(minetest.luaentities) do - if wagon.is_wagon and wagon.initialized and wagon.unique_id==w_id then - rel_pos=rel_pos+wagon.wagon_span - wagon.train_id=train_id - wagon.pos_in_train=rel_pos - wagon.pos_in_trainparts=i - wagon.old_velocity_vector=nil - if wagon.is_locomotive then - count_l=count_l+1 + local wagon=nil + for aoid,iwagon in pairs(minetest.luaentities) do + 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) + iwagon.object:remove() + else + wagon=iwagon end - if invert_flipstate then - wagon.wagon_flipped = not wagon.wagon_flipped + end + end + if not wagon then + 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() + 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 - rel_pos=rel_pos+wagon.wagon_span - any_loaded=true end end - if not any_loaded then - print("update_trainpart_properties wagon "..w_id.." not loaded, ignoring it.") + if wagon then + rel_pos=rel_pos+wagon.wagon_span + wagon.train_id=train_id + wagon.pos_in_train=rel_pos + wagon.pos_in_trainparts=i + wagon.old_velocity_vector=nil + if wagon.is_locomotive then + count_l=count_l+1 + end + if invert_flipstate then + wagon.wagon_flipped = not wagon.wagon_flipped + end + rel_pos=rel_pos+wagon.wagon_span + any_loaded=true + + if wagon.drives_on then + for k,_ in pairs(train.drives_on) do + if not wagon.drives_on[k] then + train.drives_on[k]=nil + end + end + end + train.max_speed=math.min(train.max_speed, wagon.max_speed) + else + atprint(w_id.." not loaded and no save available") + --what the hell... + table.remove(train.trainparts, pit) end end train.trainlen=rel_pos @@ -616,28 +537,28 @@ function advtrains.split_train_at_wagon(wagon) --before doing anything, check if both are rails. else do not allow if not pos_for_new_train then - print("split_train: pos_for_new_train not set") + atprint("split_train: pos_for_new_train not set") return false end - local node_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(pos_for_new_train), train.traintype) + local node_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(pos_for_new_train), train.drives_on) if not node_ok then - print("split_train: pos_for_new_train "..minetest.pos_to_string(advtrains.round_vector_floor_y(pos_for_new_train_prev)).." not loaded or is not a rail") + atprint("split_train: pos_for_new_train "..minetest.pos_to_string(advtrains.round_vector_floor_y(pos_for_new_train_prev)).." not loaded or is not a rail") return false end if not train.last_pos_prev then - print("split_train: pos_for_new_train_prev not set") + atprint("split_train: pos_for_new_train_prev not set") return false end - local prevnode_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(pos_for_new_train), train.traintype) + local prevnode_ok=advtrains.get_rail_info_at(advtrains.round_vector_floor_y(pos_for_new_train), train.drives_on) if not prevnode_ok then - print("split_train: pos_for_new_train_prev "..minetest.pos_to_string(advtrains.round_vector_floor_y(pos_for_new_train_prev)).." not loaded or is not a rail") + atprint("split_train: pos_for_new_train_prev "..minetest.pos_to_string(advtrains.round_vector_floor_y(pos_for_new_train_prev)).." not loaded or is not a rail") return false end --create subtrain - local newtrain_id=advtrains.create_new_train_at(pos_for_new_train, pos_for_new_train_prev, train.traintype) + local newtrain_id=advtrains.create_new_train_at(pos_for_new_train, pos_for_new_train_prev) local newtrain=advtrains.trains[newtrain_id] --insert all wagons to new train for k,v in ipairs(train.trainparts) do @@ -661,38 +582,7 @@ end --->backpos's will match --4. R<->F F<->R flip one of these trains and take it as new parent --->frontpos's will match -function advtrains.try_connect_trains(id1, id2) - local train1=advtrains.trains[id1] - local train2=advtrains.trains[id2] - if not train1 or not train2 then return end - if not train1.path or not train2.path then return end - if #train1.trainparts==0 or #train2.trainparts==0 then return end - - local frontpos1=advtrains.get_real_index_position(train1.path, train1.index) - local backpos1=advtrains.get_real_index_position(train1.path, advtrains.get_train_end_index(train1)) - --couple logic - if train1.traintype==train2.traintype then - local frontpos2=advtrains.get_real_index_position(train2.path, train2.index) - local backpos2=advtrains.get_real_index_position(train2.path, advtrains.get_train_end_index(train2)) - - if not frontpos1 or not frontpos2 or not backpos1 or not backpos2 then return end - - local couple_spawnradius=0.7 - --case 1 (first train is front) - if vector.distance(frontpos2, backpos1)<couple_spawnradius then - advtrains.spawn_couple_if_neccessary(backpos1, frontpos2, id1, id2, true, false) - --case 2 (second train is front) - elseif vector.distance(frontpos1, backpos2)<couple_spawnradius then - advtrains.spawn_couple_if_neccessary(backpos2, frontpos1, id2, id1, true, false) - --case 3 - elseif vector.distance(backpos2, backpos1)<couple_spawnradius then - advtrains.spawn_couple_if_neccessary(backpos1, backpos2, id1, id2, true, true) - --case 4 - elseif vector.distance(frontpos2, frontpos1)<couple_spawnradius then - advtrains.spawn_couple_if_neccessary(frontpos1, frontpos2, id1, id2, false, false) - end - end -end + --true when trains are facing each other. needed on colliding. -- check done by iterating paths and checking their direction --returns nil when not on the same track at all OR when required path items are not generated. this distinction may not always be needed. @@ -710,72 +600,88 @@ function advtrains.trains_facing(train1, train2) return nil end ---order of trains may be irrelevant in some cases. check opposite cases. TODO does this work? ---pos1 and pos2 are just needed to form a median. -function advtrains.spawn_couple_if_neccessary(pos1, pos2, tid1, tid2, train1_is_backpos, train2_is_backpos) - --print("spawn_couple_if_neccessary..."..dump({pos1=pos1, pos2=pos2, train1_is_backpos=train1_is_backpos, train2_is_backpos=train2_is_backpos})) - local train1=advtrains.trains[tid1] - local train2=advtrains.trains[tid2] +function advtrains.spawn_couple_on_collide(id1, pos, id2, t1_is_backpos) + atprint("COLLISION: "..sid(id1).." and "..sid(id2).." at "..minetest.pos_to_string(pos)..", t1_is_backpos="..(t1_is_backpos and "true" or "false")) + --TODO: + local train1=advtrains.trains[id1] + local train2=advtrains.trains[id2] + + if not train1 or not train2 then return end + + local found + for i=advtrains.minN(train1.path), advtrains.maxN(train1.path) do + if vector.equals(train1.path[i], pos) then + found=true + end + end + if not found then + atprint("Err: pos not in path") + return + end + + local frontpos2=train2.path[math.floor(train2.detector_old_index)] + local backpos2=train2.path[math.floor(train2.detector_old_end_index)] + local t2_is_backpos + atprint("End positions: "..minetest.pos_to_string(frontpos2)..minetest.pos_to_string(backpos2)) + + if vector.distance(frontpos2, pos)<2 then + t2_is_backpos=false + elseif vector.distance(backpos2, pos)<2 then + t2_is_backpos=true + else + atprint("Err: not a endpos") + return --the collision position is not the end position. + end + atprint("t2_is_backpos="..(t2_is_backpos and "true" or "false")) + local t1_has_couple - if train1_is_backpos then + if t1_is_backpos then t1_has_couple=train1.couple_eid_back else t1_has_couple=train1.couple_eid_front end local t2_has_couple - if train2_is_backpos then + if t2_is_backpos then t2_has_couple=train2.couple_eid_back else t2_has_couple=train2.couple_eid_front end - if t1_has_couple and t2_has_couple then - if t1_has_couple~=t2_has_couple then--what the hell - if minetest.object_refs[t2_has_couple] then minetest.object_refs[t2_has_couple]:remove() end - if train2_is_backpos then - train2.couple_eid_back=t1_has_couple + if t1_has_couple then + if minetest.object_refs[t1_has_couple] then minetest.object_refs[t1_has_couple]:remove() end + end + if t2_has_couple then + if minetest.object_refs[t2_has_couple] then minetest.object_refs[t2_has_couple]:remove() end + end + local obj=minetest.add_entity(pos, "advtrains:couple") + if not obj then atprint("failed creating object") return end + local le=obj:get_luaentity() + le.train_id_1=id1 + le.train_id_2=id2 + le.train1_is_backpos=t1_is_backpos + le.train2_is_backpos=t2_is_backpos + --find in object_refs + for aoi, compare in pairs(minetest.object_refs) do + if compare==obj then + if t1_is_backpos then + train1.couple_eid_back=aoi else - train2.couple_eid_front=t1_has_couple + train1.couple_eid_front=aoi end - end - --[[elseif t1_has_couple and not t2_has_couple then - if train2_is_backpos then - train2.couple_eid_back=t1_has_couple - else - train2.couple_eid_front=t1_has_couple - end - elseif not t1_has_couple and t2_has_couple then - if train1_is_backpos then - train1.couple_eid_back=t2_has_couple - else - train1.couple_eid_front=t2_has_couple - end]] - else - local pos=advtrains.pos_median(pos1, pos2) - local obj=minetest.add_entity(pos, "advtrains:couple") - if not obj then print("failed creating object") return end - local le=obj:get_luaentity() - le.train_id_1=tid1 - le.train_id_2=tid2 - le.train1_is_backpos=train1_is_backpos - le.train2_is_backpos=train2_is_backpos - --find in object_refs - for aoi, compare in pairs(minetest.object_refs) do - if compare==obj then - if train1_is_backpos then - train1.couple_eid_back=aoi - else - train1.couple_eid_front=aoi - end - if train2_is_backpos then - train2.couple_eid_back=aoi - else - train2.couple_eid_front=aoi - end + if t2_is_backpos then + train2.couple_eid_back=aoi + else + train2.couple_eid_front=aoi end end end + atprint("Couple entity:"..dump(le)) + + --also TODO: integrate check_trainpartload into update_trainpart_properties. end +--order of trains may be irrelevant in some cases. check opposite cases. TODO does this work? +--pos1 and pos2 are just needed to form a median. + function advtrains.do_connect_trains(first_id, second_id) local first_wagoncnt=#advtrains.trains[first_id].trainparts @@ -812,20 +718,20 @@ function advtrains.invert_train(train_id) end function advtrains.is_train_at_pos(pos) - --print("istrainat: pos "..minetest.pos_to_string(pos)) + --atprint("istrainat: pos "..minetest.pos_to_string(pos)) local checked_trains={} local objrefs=minetest.get_objects_inside_radius(pos, 2) for _,v in pairs(objrefs) do local le=v:get_luaentity() if le and le.is_wagon and le.initialized and le.train_id and not checked_trains[le.train_id] then - --print("istrainat: checking "..le.train_id) + --atprint("istrainat: checking "..le.train_id) checked_trains[le.train_id]=true local path=advtrains.get_or_create_path(le.train_id, le:train()) if path then - --print("has path") + --atprint("has path") for i=math.floor(advtrains.get_train_end_index(le:train())+0.5),math.floor(le:train().index+0.5) do if path[i] then - --print("has pathitem "..i.." "..minetest.pos_to_string(path[i])) + --atprint("has pathitem "..i.." "..minetest.pos_to_string(path[i])) if vector.equals(advtrains.round_vector_floor_y(path[i]), pos) then return true end @@ -837,7 +743,7 @@ function advtrains.is_train_at_pos(pos) return false end function advtrains.invalidate_all_paths() - --print("invalidating all paths") + --atprint("invalidating all paths") for k,v in pairs(advtrains.trains) do if v.index then v.restore_add_index=v.index-math.floor(v.index+0.5) diff --git a/wagons.lua b/advtrains/advtrains/wagons.lua index 8a96c39..029d2d1 100644 --- a/wagons.lua +++ b/advtrains/advtrains/wagons.lua @@ -1,6 +1,4 @@ --atan2 counts angles clockwise, minetest does counterclockwise
---local print=function(t) minetest.log("action", t) minetest.chat_send_all(t) end
-local print=function() end
minetest.register_privilege("train_place", {
description = "Player can place trains on tracks not owned by player",
@@ -58,7 +56,7 @@ end wagon will save only uid in staticdata, no serialized table
]]
function wagon:on_activate(sd_uid, dtime_s)
- print("[advtrains][wagon "..((sd_uid and sd_uid~="" and sd_uid) or "no-id").."] activated")
+ atprint("[wagon "..((sd_uid and sd_uid~="" and sd_uid) or "no-id").."] activated")
self.object:set_armor_groups({immortal=1})
if sd_uid and sd_uid~="" then
--legacy
@@ -74,7 +72,7 @@ function wagon:on_activate(sd_uid, dtime_s) --duplicates?
for ao_id,wagon in pairs(minetest.luaentities) do
if wagon.is_wagon and wagon.initialized and wagon.unique_id==self.unique_id and wagon~=self then--i am a duplicate!
- print("[advtrains][wagon "..((sd_uid and sd_uid~="" and sd_uid) or "no-id").."] duplicate found(ao_id:"..ao_id.."), removing")
+ atprint("[wagon "..((sd_uid and sd_uid~="" and sd_uid) or "no-id").."] duplicate found(ao_id:"..ao_id.."), removing")
self.object:remove()
minetest.after(0.5, function() advtrains.update_trainpart_properties(self.train_id) end)
return
@@ -82,13 +80,13 @@ function wagon:on_activate(sd_uid, dtime_s) end
if self.custom_on_activate then
- self:custom_on_activate(staticdata_table, dtime_s)
+ self:custom_on_activate(dtime_s)
end
end
function wagon:get_staticdata()
if not self:ensure_init() then return end
- print("[advtrains][wagon "..((self.unique_id and self.unique_id~="" and self.unique_id) or "no-id").."]: saving to wagon_save")
+ atprint("[wagon "..((self.unique_id and self.unique_id~="" and self.unique_id) or "no-id").."]: saving to wagon_save")
--serialize inventory, if it has one
if self.has_inventory then
local inv=minetest.get_inventory({type="detached", name="advtrains_wgn_"..self.unique_id})
@@ -112,7 +110,7 @@ function wagon:init_new_instance(train_id, properties) end
self:init_shared()
self.initialized=true
- print("init_new_instance "..self.unique_id.." ("..self.train_id..")")
+ atprint("init_new_instance "..self.unique_id.." ("..self.train_id..")")
return self.unique_id
end
function wagon:init_from_wagon_save(uid)
@@ -133,7 +131,7 @@ function wagon:init_from_wagon_save(uid) self:init_shared()
self.initialized=true
minetest.after(1, function() self:reattach_all() end)
- print("init_from_wagon_save "..self.unique_id.." ("..self.train_id..")")
+ atprint("init_from_wagon_save "..self.unique_id.." ("..self.train_id..")")
advtrains.update_trainpart_properties(self.train_id)
end
function wagon:init_shared()
@@ -162,8 +160,17 @@ function wagon:init_shared() end
end
function wagon:ensure_init()
- if self.initialized then return true end
- self.object:setvelocity({x=0,y=0,z=0})
+ if self.initialized then
+ if self.noninitticks then self.noninitticks=nil end
+ return true
+ end
+ if not self.noninitticks then self.noninitticks=0 end
+ self.noninitticks=self.noninitticks+1
+ if self.noninitticks>20 then
+ self.object:remove()
+ else
+ self.object:setvelocity({x=0,y=0,z=0})
+ end
return false
end
@@ -220,7 +227,7 @@ function wagon:destroy() self.custom_on_destroy(self, puncher, time_from_last_punch, tool_capabilities, direction)
end
- print("[advtrains][wagon "..((self.unique_id and self.unique_id~="" and self.unique_id) or "no-id").."]: destroying")
+ atprint("[wagon "..((self.unique_id and self.unique_id~="" and self.unique_id) or "no-id").."]: destroying")
self.object:remove()
@@ -239,7 +246,7 @@ function wagon:on_step(dtime) local pos = self.object:getpos()
if not pos then
- print("["..self.unique_id.."][fatal] missing position (object:getpos() returned nil)")
+ atprint("["..self.unique_id.."][fatal] missing position (object:getpos() returned nil)")
return
end
@@ -247,7 +254,7 @@ function wagon:on_step(dtime) --is my train still here
if not self.train_id or not self:train() then
- print("[advtrains][wagon "..self.unique_id.."] missing train_id, destroying")
+ atprint("[wagon "..self.unique_id.."] missing train_id, destroying")
self.object:remove()
return
elseif not self.initialized then
@@ -301,7 +308,7 @@ function wagon:on_step(dtime) --object:set_attach(self.object, "", {x=0, y=0, z=self.wagon_span*10}, {x=0, y=0, z=0})
self.discouple=le
else
- print("Couldn't spawn DisCouple")
+ atprint("Couldn't spawn DisCouple")
end
end
else
@@ -322,13 +329,13 @@ function wagon:on_step(dtime) end
local index=advtrains.get_real_path_index(self:train(), self.pos_in_train)
- --print("trainindex "..gp.index.." wagonindex "..index)
+ --atprint("trainindex "..gp.index.." wagonindex "..index)
--position recalculation
local first_pos=gp.path[math.floor(index)]
local second_pos=gp.path[math.floor(index)+1]
if not first_pos or not second_pos then
- --print("[advtrains] object "..self.unique_id.." path end reached!")
+ --atprint(" object "..self.unique_id.." path end reached!")
self.object:setvelocity({x=0,y=0,z=0})
return
end
@@ -396,7 +403,7 @@ function wagon:on_step(dtime) self.old_velocity_vector=velocityvec
self.old_acceleration_vector=accelerationvec
self.old_yaw=yaw
- printbm("wagon step", t)
+ atprintbm("wagon step", t)
end
function advtrains.get_real_path_index(train, pit)
@@ -469,7 +476,7 @@ function wagon:show_get_on_form(pname) if not self.initialized then return end
if #self.seats==0 then
if self.has_inventory and self.get_inventory_formspec then
- minetest.show_formspec(pname, "advtrains_inv_"..self.unique_id, self:get_inventory_formspec())
+ minetest.show_formspec(pname, "advtrains_inv_"..self.unique_id, self:get_inventory_formspec(pname))
end
return
end
@@ -496,11 +503,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if wagon.is_wagon and wagon.initialized and wagon.unique_id==uid then
if fields.inv then
if wagon.has_inventory and wagon.get_inventory_formspec then
- minetest.show_formspec(player:get_player_name(), "advtrains_inv_"..uid, wagon:get_inventory_formspec())
+ minetest.show_formspec(player:get_player_name(), "advtrains_inv_"..uid, wagon:get_inventory_formspec(player:get_player_name()))
end
elseif fields.seat then
local val=minetest.explode_textlist_event(fields.seat)
- if val and val.type~="INV" then
+ if val and val.type~="INV" and not wagon.seatp[player:get_player_name()] then
--get on
wagon:get_on(player, val.index)
--will work with the new close_formspec functionality. close exactly this formspec.
@@ -528,11 +535,11 @@ minetest.register_on_joinplayer(function(player) end
end)
-function advtrains.register_wagon(sysname, traintype, prototype, desc, inv_img)
+function advtrains.register_wagon(sysname, prototype, desc, inv_img)
setmetatable(prototype, {__index=wagon})
- minetest.register_entity("advtrains:"..sysname,prototype)
+ minetest.register_entity(":advtrains:"..sysname,prototype)
- minetest.register_craftitem("advtrains:"..sysname, {
+ minetest.register_craftitem(":advtrains:"..sysname, {
description = desc,
inventory_image = inv_img,
wield_image = inv_img,
@@ -543,19 +550,20 @@ function advtrains.register_wagon(sysname, traintype, prototype, desc, inv_img) return
end
+ local node=minetest.get_node_or_nil(pointed_thing.under)
- if not node then print("[advtrains]Ignore at placer position") return itemstack end
+ if not node then atprint("[advtrains]Ignore at placer position") return itemstack end
local nodename=node.name
- if(not advtrains.is_track_and_drives_on(nodename, advtrains.all_traintypes[traintype].drives_on)) then
- print("[advtrains]no track here, not placing.")
+ if(not advtrains.is_track_and_drives_on(nodename, prototype.drives_on)) then
+ atprint("no track here, not placing.")
return itemstack
end
local conn1=advtrains.get_track_connections(node.name, node.param2)
- local id=advtrains.create_new_train_at(pointed_thing.under, advtrains.dirCoordSet(pointed_thing.under, conn1), traintype)
+ local id=advtrains.create_new_train_at(pointed_thing.under, advtrains.dirCoordSet(pointed_thing.under, conn1))
local ob=minetest.add_entity(pointed_thing.under, "advtrains:"..sysname)
if not ob then
- print("[advtrains]couldn't add_entity, aborting")
+ atprint("couldn't add_entity, aborting")
end
local le=ob:get_luaentity()
@@ -573,227 +581,10 @@ function advtrains.register_wagon(sysname, traintype, prototype, desc, inv_img) end,
})
end
-advtrains.register_train_type("steam", {"regular", "default"})
-
---[[advtrains.register_wagon("blackwagon", "steam",{textures = {"black.png"}})
-advtrains.register_wagon("bluewagon", "steam",{textures = {"blue.png"}})
-advtrains.register_wagon("greenwagon", "steam",{textures = {"green.png"}})
-advtrains.register_wagon("redwagon", "steam",{textures = {"red.png"}})
-advtrains.register_wagon("yellowwagon", "steam",{textures = {"yellow.png"}})
-]]
--[[
wagons can define update_animation(self, velocity) if they have a speed-dependent animation
this function will be called when the velocity vector changes or every 2 seconds.
]]
-advtrains.register_wagon("newlocomotive", "steam",{
- mesh="advtrains_engine_steam.b3d",
- textures = {"advtrains_newlocomotive.png"},
- is_locomotive=true,
- seats = {
- {
- name="Driver Stand (left)",
- attach_offset={x=-5, y=10, z=-10},
- view_offset={x=0, y=6, z=0},
- driving_ctrl_access=true,
- },
- {
- name="Driver Stand (right)",
- attach_offset={x=5, y=10, z=-10},
- view_offset={x=0, y=6, z=0},
- driving_ctrl_access=true,
- },
- },
- visual_size = {x=1, y=1},
- wagon_span=1.85,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- update_animation=function(self, velocity)
- --if self.old_anim_velocity~=advtrains.abs_ceil(velocity) then
- self.object:set_animation({x=1,y=60}, 100)--math.floor(velocity))
- --self.old_anim_velocity=advtrains.abs_ceil(velocity)
- --end
- end,
- custom_on_activate = function(self, staticdata_table, dtime_s)
- minetest.add_particlespawner({
- amount = 10,
- time = 0,
- -- ^ If time is 0 has infinite lifespan and spawns the amount on a per-second base
- minpos = {x=0, y=2, z=1.2},
- maxpos = {x=0, y=2, z=1.2},
- minvel = {x=-0.2, y=1.8, z=-0.2},
- maxvel = {x=0.2, y=2, z=0.2},
- minacc = {x=0, y=-0.1, z=0},
- maxacc = {x=0, y=-0.3, z=0},
- minexptime = 2,
- maxexptime = 4,
- minsize = 1,
- maxsize = 5,
- -- ^ The particle's properties are random values in between the bounds:
- -- ^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration),
- -- ^ minsize/maxsize, minexptime/maxexptime (expirationtime)
- collisiondetection = true,
- -- ^ collisiondetection: if true uses collision detection
- vertical = false,
- -- ^ vertical: if true faces player using y axis only
- texture = "smoke_puff.png",
- -- ^ Uses texture (string)
- attached = self.object,
- })
- end,
- drops={"default:steelblock 4"},
-}, "Steam Engine", "advtrains_newlocomotive_inv.png")
-advtrains.register_wagon("wagon_default", "steam",{
- mesh="advtrains_wagon.b3d",
- textures = {"advtrains_wagon.png"},
- seats = {
- {
- name="Default Seat",
- attach_offset={x=0, y=10, z=0},
- view_offset={x=0, y=6, z=0},
- },
- },
- visual_size = {x=1, y=1},
- wagon_span=1.8,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- drops={"default:steelblock 4"},
-}, "Passenger Wagon", "advtrains_wagon_inv.png")
-advtrains.register_wagon("wagon_box", "steam",{
- mesh="advtrains_wagon.b3d",
- textures = {"advtrains_wagon_box.png"},
- seats = {},
- visual_size = {x=1, y=1},
- wagon_span=1.8,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- drops={"default:steelblock 4"},
- has_inventory = true,
- get_inventory_formspec = function(self)
- return "size[8,11]"..
- "list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
- "list[current_player;main;0,7;8,4;]"..
- "listring[]"
- end,
- inventory_list_sizes = {
- box=8*6,
- },
-}, "Box Wagon", "advtrains_wagon_box_inv.png")
-
-advtrains.register_train_type("electric", {"regular", "default"}, 20)
-
-advtrains.register_wagon("engine_japan", "electric",{
- mesh="advtrains_engine_japan.b3d",
- textures = {"advtrains_engine_japan.png"},
- seats = {
- {
- name="Default Seat (driver stand)",
- attach_offset={x=0, y=10, z=0},
- view_offset={x=0, y=6, z=0},
- driving_ctrl_access=true,
- },
- },
- visual_size = {x=1, y=1},
- wagon_span=2.5,
- is_locomotive=true,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- drops={"default:steelblock 4"},
-}, "Japanese Train Engine", "advtrains_engine_japan_inv.png")
-
-advtrains.register_wagon("wagon_japan", "electric",{
- mesh="advtrains_wagon_japan.b3d",
- textures = {"advtrains_wagon_japan.png"},
- seats = {
- {
- name="Default Seat",
- attach_offset={x=0, y=10, z=0},
- view_offset={x=0, y=6, z=0},
- },
- },
- visual_size = {x=1, y=1},
- wagon_span=2.3,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- drops={"default:steelblock 4"},
-}, "Japanese Train Wagon", "advtrains_wagon_japan_inv.png")
-
-advtrains.register_wagon("engine_industrial", "electric",{
- mesh="advtrains_engine_industrial.b3d",
- textures = {"advtrains_engine_industrial.png"},
- seats = {
- {
- name="Driver Stand (left)",
- attach_offset={x=-5, y=10, z=-10},
- view_offset={x=0, y=10, z=0},
- driving_ctrl_access=true,
- },
- {
- name="Driver Stand (right)",
- attach_offset={x=5, y=10, z=-10},
- view_offset={x=0, y=10, z=0},
- driving_ctrl_access=true,
- },
- },
- visual_size = {x=1, y=1},
- wagon_span=2.6,
- is_locomotive=true,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- drops={"default:steelblock 4"},
-}, "Industrial Train Engine", "advtrains_engine_industrial_inv.png")
-advtrains.register_wagon("wagon_tank", "electric",{
- mesh="advtrains_wagon_tank.b3d",
- textures = {"advtrains_wagon_tank.png"},
- seats = {},
- visual_size = {x=1, y=1},
- wagon_span=2.2,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- drops={"default:steelblock 4"},
- has_inventory = true,
- get_inventory_formspec = function(self)
- return "size[8,11]"..
- "list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
- "list[current_player;main;0,7;8,4;]"..
- "listring[]"
- end,
- inventory_list_sizes = {
- box=8*6,
- },
-}, "Industrial tank wagon", "advtrains_wagon_tank_inv.png")
-advtrains.register_wagon("wagon_wood", "electric",{
- mesh="advtrains_wagon_wood.b3d",
- textures = {"advtrains_wagon_wood.png"},
- seats = {},
- visual_size = {x=1, y=1},
- wagon_span=1.8,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- drops={"default:steelblock 4"},
- has_inventory = true,
- get_inventory_formspec = function(self)
- return "size[8,11]"..
- "list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]"..
- "list[current_player;main;0,7;8,4;]"..
- "listring[]"
- end,
- inventory_list_sizes = {
- box=8*6,
- },
-}, "Industrial wood wagon", "advtrains_wagon_wood_inv.png")
-
-advtrains.register_train_type("subway", {"default"}, 15)
-
-advtrains.register_wagon("subway_wagon", "subway",{
- mesh="advtrains_subway_train.b3d",
- textures = {"advtrains_subway_train.png"},
- seats = {
- {
- name="Default Seat (driver stand)",
- attach_offset={x=0, y=10, z=0},
- view_offset={x=0, y=6, z=0},
- driving_ctrl_access=true,
- },
- },
- visual_size = {x=1, y=1},
- wagon_span=1.8,
- collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
- is_locomotive=true,
- drops={"default:steelblock 4"},
-}, "Subway Passenger Wagon", "advtrains_subway_train_inv.png")
-
diff --git a/advtrains/advtrains_train_industrial/depends.txt b/advtrains/advtrains_train_industrial/depends.txt new file mode 100644 index 0000000..6f00bf6 --- /dev/null +++ b/advtrains/advtrains_train_industrial/depends.txt @@ -0,0 +1 @@ +advtrains
\ No newline at end of file diff --git a/advtrains/advtrains_train_industrial/init.lua b/advtrains/advtrains_train_industrial/init.lua new file mode 100644 index 0000000..379832c --- /dev/null +++ b/advtrains/advtrains_train_industrial/init.lua @@ -0,0 +1,67 @@ +advtrains.register_wagon("engine_industrial", { + mesh="advtrains_engine_industrial.b3d", + textures = {"advtrains_engine_industrial.png"}, + drives_on={default=true}, + max_speed=20, + seats = { + { + name="Driver Stand (left)", + attach_offset={x=-5, y=10, z=-10}, + view_offset={x=0, y=10, z=0}, + driving_ctrl_access=true, + }, + { + name="Driver Stand (right)", + attach_offset={x=5, y=10, z=-10}, + view_offset={x=0, y=10, z=0}, + driving_ctrl_access=true, + }, + }, + visual_size = {x=1, y=1}, + wagon_span=2.6, + is_locomotive=true, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + drops={"default:steelblock 4"}, +}, "Industrial Train Engine", "advtrains_engine_industrial_inv.png") +advtrains.register_wagon("wagon_tank", { + mesh="advtrains_wagon_tank.b3d", + textures = {"advtrains_wagon_tank.png"}, + seats = {}, + drives_on={default=true}, + max_speed=20, + visual_size = {x=1, y=1}, + wagon_span=2.2, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + drops={"default:steelblock 4"}, + has_inventory = true, + get_inventory_formspec = function(self) + return "size[8,11]".. + "list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]".. + "list[current_player;main;0,7;8,4;]".. + "listring[]" + end, + inventory_list_sizes = { + box=8*6, + }, +}, "Industrial tank wagon", "advtrains_wagon_tank_inv.png") +advtrains.register_wagon("wagon_wood", { + mesh="advtrains_wagon_wood.b3d", + textures = {"advtrains_wagon_wood.png"}, + seats = {}, + drives_on={default=true}, + max_speed=20, + visual_size = {x=1, y=1}, + wagon_span=1.8, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + drops={"default:steelblock 4"}, + has_inventory = true, + get_inventory_formspec = function(self) + return "size[8,11]".. + "list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]".. + "list[current_player;main;0,7;8,4;]".. + "listring[]" + end, + inventory_list_sizes = { + box=8*6, + }, +}, "Industrial wood wagon", "advtrains_wagon_wood_inv.png") diff --git a/models/advtrains_engine_industrial.b3d b/advtrains/advtrains_train_industrial/models/advtrains_engine_industrial.b3d Binary files differindex f1ea485..f1ea485 100644 --- a/models/advtrains_engine_industrial.b3d +++ b/advtrains/advtrains_train_industrial/models/advtrains_engine_industrial.b3d diff --git a/models/advtrains_wagon_tank.b3d b/advtrains/advtrains_train_industrial/models/advtrains_wagon_tank.b3d Binary files differindex af2604b..af2604b 100644 --- a/models/advtrains_wagon_tank.b3d +++ b/advtrains/advtrains_train_industrial/models/advtrains_wagon_tank.b3d diff --git a/models/advtrains_wagon_wood.b3d b/advtrains/advtrains_train_industrial/models/advtrains_wagon_wood.b3d Binary files differindex 0e7fb4b..0e7fb4b 100644 --- a/models/advtrains_wagon_wood.b3d +++ b/advtrains/advtrains_train_industrial/models/advtrains_wagon_wood.b3d diff --git a/textures/advtrains_engine_industrial.png b/advtrains/advtrains_train_industrial/textures/advtrains_engine_industrial.png Binary files differindex 38a872f..38a872f 100644 --- a/textures/advtrains_engine_industrial.png +++ b/advtrains/advtrains_train_industrial/textures/advtrains_engine_industrial.png diff --git a/textures/advtrains_engine_industrial_inv.png b/advtrains/advtrains_train_industrial/textures/advtrains_engine_industrial_inv.png Binary files differindex be4e80f..be4e80f 100644 --- a/textures/advtrains_engine_industrial_inv.png +++ b/advtrains/advtrains_train_industrial/textures/advtrains_engine_industrial_inv.png diff --git a/textures/advtrains_wagon_tank.png b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_tank.png Binary files differindex 79b1316..79b1316 100644 --- a/textures/advtrains_wagon_tank.png +++ b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_tank.png diff --git a/textures/advtrains_wagon_tank_inv.png b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_tank_inv.png Binary files differindex 03401be..03401be 100644 --- a/textures/advtrains_wagon_tank_inv.png +++ b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_tank_inv.png diff --git a/textures/advtrains_wagon_wood.png b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_wood.png Binary files differindex acc6f72..acc6f72 100644 --- a/textures/advtrains_wagon_wood.png +++ b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_wood.png diff --git a/textures/advtrains_wagon_wood_inv.png b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_wood_inv.png Binary files differindex 87109dd..87109dd 100644 --- a/textures/advtrains_wagon_wood_inv.png +++ b/advtrains/advtrains_train_industrial/textures/advtrains_wagon_wood_inv.png diff --git a/advtrains/advtrains_train_japan/depends.txt b/advtrains/advtrains_train_japan/depends.txt new file mode 100644 index 0000000..6f00bf6 --- /dev/null +++ b/advtrains/advtrains_train_japan/depends.txt @@ -0,0 +1 @@ +advtrains
\ No newline at end of file diff --git a/advtrains/advtrains_train_japan/init.lua b/advtrains/advtrains_train_japan/init.lua new file mode 100644 index 0000000..47f50cf --- /dev/null +++ b/advtrains/advtrains_train_japan/init.lua @@ -0,0 +1,38 @@ +advtrains.register_wagon("engine_japan", { + mesh="advtrains_engine_japan.b3d", + textures = {"advtrains_engine_japan.png"}, + drives_on={default=true}, + max_speed=20, + seats = { + { + name="Default Seat (driver stand)", + attach_offset={x=0, y=10, z=0}, + view_offset={x=0, y=6, z=0}, + driving_ctrl_access=true, + }, + }, + visual_size = {x=1, y=1}, + wagon_span=2.5, + is_locomotive=true, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + drops={"default:steelblock 4"}, +}, "Japanese Train Engine", "advtrains_engine_japan_inv.png") + +advtrains.register_wagon("wagon_japan", { + mesh="advtrains_wagon_japan.b3d", + textures = {"advtrains_wagon_japan.png"}, + drives_on={default=true}, + max_speed=20, + seats = { + { + name="Default Seat", + attach_offset={x=0, y=10, z=0}, + view_offset={x=0, y=6, z=0}, + }, + }, + visual_size = {x=1, y=1}, + wagon_span=2.3, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + drops={"default:steelblock 4"}, +}, "Japanese Train Wagon", "advtrains_wagon_japan_inv.png") + diff --git a/models/advtrains_engine_japan.b3d b/advtrains/advtrains_train_japan/models/advtrains_engine_japan.b3d Binary files differindex f82c33e..f82c33e 100644 --- a/models/advtrains_engine_japan.b3d +++ b/advtrains/advtrains_train_japan/models/advtrains_engine_japan.b3d diff --git a/models/advtrains_wagon_japan.b3d b/advtrains/advtrains_train_japan/models/advtrains_wagon_japan.b3d Binary files differindex 7970438..7970438 100644 --- a/models/advtrains_wagon_japan.b3d +++ b/advtrains/advtrains_train_japan/models/advtrains_wagon_japan.b3d diff --git a/textures/advtrains_engine_japan.png b/advtrains/advtrains_train_japan/textures/advtrains_engine_japan.png Binary files differindex b286b38..b286b38 100644 --- a/textures/advtrains_engine_japan.png +++ b/advtrains/advtrains_train_japan/textures/advtrains_engine_japan.png diff --git a/textures/advtrains_engine_japan_inv.png b/advtrains/advtrains_train_japan/textures/advtrains_engine_japan_inv.png Binary files differindex 6af0636..6af0636 100644 --- a/textures/advtrains_engine_japan_inv.png +++ b/advtrains/advtrains_train_japan/textures/advtrains_engine_japan_inv.png diff --git a/textures/advtrains_wagon_japan.png b/advtrains/advtrains_train_japan/textures/advtrains_wagon_japan.png Binary files differindex bee565e..bee565e 100644 --- a/textures/advtrains_wagon_japan.png +++ b/advtrains/advtrains_train_japan/textures/advtrains_wagon_japan.png diff --git a/textures/advtrains_wagon_japan_inv.png b/advtrains/advtrains_train_japan/textures/advtrains_wagon_japan_inv.png Binary files differindex 3e6357c..3e6357c 100644 --- a/textures/advtrains_wagon_japan_inv.png +++ b/advtrains/advtrains_train_japan/textures/advtrains_wagon_japan_inv.png diff --git a/advtrains/advtrains_train_steam/depends.txt b/advtrains/advtrains_train_steam/depends.txt new file mode 100644 index 0000000..6f00bf6 --- /dev/null +++ b/advtrains/advtrains_train_steam/depends.txt @@ -0,0 +1 @@ +advtrains
\ No newline at end of file diff --git a/advtrains/advtrains_train_steam/init.lua b/advtrains/advtrains_train_steam/init.lua new file mode 100644 index 0000000..22f525f --- /dev/null +++ b/advtrains/advtrains_train_steam/init.lua @@ -0,0 +1,196 @@ +advtrains.register_wagon("newlocomotive", { + mesh="advtrains_engine_steam.b3d", + textures = {"advtrains_engine_steam.png"}, + is_locomotive=true, + drives_on={default=true}, + max_speed=10, + seats = { + { + name="Driver Stand (left)", + attach_offset={x=-5, y=10, z=-10}, + view_offset={x=0, y=6, z=0}, + driving_ctrl_access=true, + }, + { + name="Driver Stand (right)", + attach_offset={x=5, y=10, z=-10}, + view_offset={x=0, y=6, z=0}, + driving_ctrl_access=true, + }, + }, + visual_size = {x=1, y=1}, + wagon_span=1.85, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + update_animation=function(self, velocity) + if self.old_anim_velocity~=advtrains.abs_ceil(velocity) then + self.object:set_animation({x=1,y=80}, advtrains.abs_ceil(velocity)*15, 0, true) + self.old_anim_velocity=advtrains.abs_ceil(velocity) + end + end, + custom_on_activate = function(self, staticdata_table, dtime_s) + minetest.add_particlespawner({ + amount = 10, + time = 0, + -- ^ If time is 0 has infinite lifespan and spawns the amount on a per-second base + minpos = {x=0, y=2, z=1.2}, + maxpos = {x=0, y=2, z=1.2}, + minvel = {x=-0.2, y=1.8, z=-0.2}, + maxvel = {x=0.2, y=2, z=0.2}, + minacc = {x=0, y=-0.1, z=0}, + maxacc = {x=0, y=-0.3, z=0}, + minexptime = 2, + maxexptime = 4, + minsize = 1, + maxsize = 5, + -- ^ The particle's properties are random values in between the bounds: + -- ^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration), + -- ^ minsize/maxsize, minexptime/maxexptime (expirationtime) + collisiondetection = true, + -- ^ collisiondetection: if true uses collision detection + vertical = false, + -- ^ vertical: if true faces player using y axis only + texture = "smoke_puff.png", + -- ^ Uses texture (string) + attached = self.object, + }) + end, + drops={"default:steelblock 4"}, +}, "Steam Engine", "advtrains_engine_steam_inv.png") + +advtrains.register_wagon("detailed_steam_engine", { + mesh="advtrains_detailed_steam_engine.b3d", + textures = {"advtrains_detailed_steam_engine.png"}, + is_locomotive=true, + drives_on={default=true}, + max_speed=10, + seats = { + { + name="Driver Stand (left)", + attach_offset={x=-5, y=10, z=-10}, + view_offset={x=0, y=6, z=0}, + driving_ctrl_access=true, + }, + { + name="Driver Stand (right)", + attach_offset={x=5, y=10, z=-10}, + view_offset={x=0, y=6, z=0}, + driving_ctrl_access=true, + }, + }, + visual_size = {x=1, y=1}, + wagon_span=2.05, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + update_animation=function(self, velocity) + if self.old_anim_velocity~=advtrains.abs_ceil(velocity) then + self.object:set_animation({x=1,y=80}, advtrains.abs_ceil(velocity)*15, 0, true) + self.old_anim_velocity=advtrains.abs_ceil(velocity) + end + end, + custom_on_activate = function(self, staticdata_table, dtime_s) + minetest.add_particlespawner({ + amount = 10, + time = 0, + -- ^ If time is 0 has infinite lifespan and spawns the amount on a per-second base + minpos = {x=0, y=2.3, z=1.45}, + maxpos = {x=0, y=2.3, z=1.4}, + minvel = {x=-0.2, y=1.8, z=-0.2}, + maxvel = {x=0.2, y=2, z=0.2}, + minacc = {x=0, y=-0.1, z=0}, + maxacc = {x=0, y=-0.3, z=0}, + minexptime = 2, + maxexptime = 4, + minsize = 1, + maxsize = 5, + -- ^ The particle's properties are random values in between the bounds: + -- ^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration), + -- ^ minsize/maxsize, minexptime/maxexptime (expirationtime) + collisiondetection = true, + -- ^ collisiondetection: if true uses collision detection + vertical = false, + -- ^ vertical: if true faces player using y axis only + texture = "smoke_puff.png", + -- ^ Uses texture (string) + attached = self.object, + }) + end, + drops={"default:steelblock 4"}, +}, "Detailed Steam Engine", "advtrains_engine_steam_inv.png") + +advtrains.register_wagon("wagon_default", { + mesh="advtrains_passenger_wagon.b3d", + textures = {"advtrains_wagon.png"}, + drives_on={default=true}, + max_speed=10, + seats = { + { + name="1", + attach_offset={x=-4, y=8, z=8}, + view_offset={x=0, y=0, z=0}, + }, + { + name="2", + attach_offset={x=4, y=8, z=8}, + view_offset={x=0, y=0, z=0}, + }, + { + name="3", + attach_offset={x=-4, y=8, z=-8}, + view_offset={x=0, y=0, z=0}, + }, + { + name="4", + attach_offset={x=4, y=8, z=-8}, + view_offset={x=0, y=0, z=0}, + }, + }, + visual_size = {x=1, y=1}, + wagon_span=3.1, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + drops={"default:steelblock 4"}, +}, "Passenger Wagon", "advtrains_wagon_inv.png") +advtrains.register_wagon("wagon_box", { + mesh="advtrains_wagon.b3d", + textures = {"advtrains_wagon_box.png"}, + drives_on={default=true}, + max_speed=10, + seats = {}, + visual_size = {x=1, y=1}, + wagon_span=1.8, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + drops={"default:steelblock 4"}, + has_inventory = true, + get_inventory_formspec = function(self) + return "size[8,11]".. + "list[detached:advtrains_wgn_"..self.unique_id..";box;0,0;8,6;]".. + "list[current_player;main;0,7;8,4;]".. + "listring[]" + end, + inventory_list_sizes = { + box=8*6, + }, +}, "Box Wagon", "advtrains_wagon_box_inv.png") + +minetest.register_craft({ + output = 'advtrains:newlocomotive', + recipe = { + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + {'default:steelblock', 'dye:black', 'default:steelblock'}, + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + }, +}) +minetest.register_craft({ + output = 'advtrains:wagon_default', + recipe = { + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + {'default:steelblock', 'dye:dark_green', 'default:steelblock'}, + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + }, +}) +minetest.register_craft({ + output = 'advtrains:wagon_box', + recipe = { + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + {'default:steelblock', 'default:chest', 'default:steelblock'}, + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + }, +}) diff --git a/advtrains/advtrains_train_steam/models/advtrains_detailed_steam_engine.b3d b/advtrains/advtrains_train_steam/models/advtrains_detailed_steam_engine.b3d Binary files differnew file mode 100644 index 0000000..7418d8a --- /dev/null +++ b/advtrains/advtrains_train_steam/models/advtrains_detailed_steam_engine.b3d diff --git a/advtrains/advtrains_train_steam/models/advtrains_engine_steam.b3d b/advtrains/advtrains_train_steam/models/advtrains_engine_steam.b3d Binary files differnew file mode 100644 index 0000000..6a92f57 --- /dev/null +++ b/advtrains/advtrains_train_steam/models/advtrains_engine_steam.b3d diff --git a/advtrains/advtrains_train_steam/models/advtrains_passenger_wagon.b3d b/advtrains/advtrains_train_steam/models/advtrains_passenger_wagon.b3d Binary files differnew file mode 100644 index 0000000..bb057f8 --- /dev/null +++ b/advtrains/advtrains_train_steam/models/advtrains_passenger_wagon.b3d diff --git a/models/advtrains_wagon.b3d b/advtrains/advtrains_train_steam/models/advtrains_wagon.b3d Binary files differindex 5c8214c..5c8214c 100644 --- a/models/advtrains_wagon.b3d +++ b/advtrains/advtrains_train_steam/models/advtrains_wagon.b3d diff --git a/advtrains/advtrains_train_steam/textures/advtrains_detailed_steam_engine.png b/advtrains/advtrains_train_steam/textures/advtrains_detailed_steam_engine.png Binary files differnew file mode 100644 index 0000000..eab4dc8 --- /dev/null +++ b/advtrains/advtrains_train_steam/textures/advtrains_detailed_steam_engine.png diff --git a/advtrains/advtrains_train_steam/textures/advtrains_engine_steam.png b/advtrains/advtrains_train_steam/textures/advtrains_engine_steam.png Binary files differnew file mode 100644 index 0000000..4b27e77 --- /dev/null +++ b/advtrains/advtrains_train_steam/textures/advtrains_engine_steam.png diff --git a/textures/advtrains_newlocomotive_inv.png b/advtrains/advtrains_train_steam/textures/advtrains_engine_steam_inv.png Binary files differindex 8d3fafb..8d3fafb 100755..100644 --- a/textures/advtrains_newlocomotive_inv.png +++ b/advtrains/advtrains_train_steam/textures/advtrains_engine_steam_inv.png diff --git a/advtrains/advtrains_train_steam/textures/advtrains_wagon.png b/advtrains/advtrains_train_steam/textures/advtrains_wagon.png Binary files differnew file mode 100644 index 0000000..c850518 --- /dev/null +++ b/advtrains/advtrains_train_steam/textures/advtrains_wagon.png diff --git a/textures/advtrains_wagon_box.png b/advtrains/advtrains_train_steam/textures/advtrains_wagon_box.png Binary files differindex 8bfbe06..8bfbe06 100644 --- a/textures/advtrains_wagon_box.png +++ b/advtrains/advtrains_train_steam/textures/advtrains_wagon_box.png diff --git a/textures/advtrains_wagon_box_inv.png b/advtrains/advtrains_train_steam/textures/advtrains_wagon_box_inv.png Binary files differindex 480f245..480f245 100644 --- a/textures/advtrains_wagon_box_inv.png +++ b/advtrains/advtrains_train_steam/textures/advtrains_wagon_box_inv.png diff --git a/textures/advtrains_wagon_inv.png b/advtrains/advtrains_train_steam/textures/advtrains_wagon_inv.png Binary files differindex 0b72ac3..0b72ac3 100755..100644 --- a/textures/advtrains_wagon_inv.png +++ b/advtrains/advtrains_train_steam/textures/advtrains_wagon_inv.png diff --git a/advtrains/advtrains_train_subway/depends.txt b/advtrains/advtrains_train_subway/depends.txt new file mode 100644 index 0000000..6f00bf6 --- /dev/null +++ b/advtrains/advtrains_train_subway/depends.txt @@ -0,0 +1 @@ +advtrains
\ No newline at end of file diff --git a/advtrains/advtrains_train_subway/init.lua b/advtrains/advtrains_train_subway/init.lua new file mode 100644 index 0000000..b105f1a --- /dev/null +++ b/advtrains/advtrains_train_subway/init.lua @@ -0,0 +1,34 @@ + +advtrains.register_wagon("subway_wagon", { + mesh="advtrains_subway_wagon.b3d", + textures = {"advtrains_subway_wagon.png"}, + drives_on={default=true}, + max_speed=15, + seats = { + { + name="Default Seat (driver stand)", + attach_offset={x=0, y=10, z=0}, + view_offset={x=0, y=0, z=0}, + driving_ctrl_access=true, + }, + }, + visual_size = {x=1, y=1}, + wagon_span=2, + collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, + is_locomotive=true, + drops={"default:steelblock 4"}, + --custom_on_activate = function(self, dtime_s) + -- atprint("subway custom_on_activate") + -- self.object:set_animation({x=1,y=80}, 15, 0, true) + --end, +}, "Subway Passenger Wagon", "advtrains_subway_wagon_inv.png") + +--wagons +minetest.register_craft({ + output = 'advtrains:subway_wagon', + recipe = { + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + {'default:steelblock', 'dye:yellow', 'default:steelblock'}, + {'default:steelblock', 'default:steelblock', 'default:steelblock'}, + }, +}) diff --git a/advtrains/advtrains_train_subway/models/advtrains_subway_wagon.b3d b/advtrains/advtrains_train_subway/models/advtrains_subway_wagon.b3d Binary files differnew file mode 100644 index 0000000..8f35769 --- /dev/null +++ b/advtrains/advtrains_train_subway/models/advtrains_subway_wagon.b3d diff --git a/advtrains/advtrains_train_subway/textures/advtrains_subway_wagon.png b/advtrains/advtrains_train_subway/textures/advtrains_subway_wagon.png Binary files differnew file mode 100644 index 0000000..079d797 --- /dev/null +++ b/advtrains/advtrains_train_subway/textures/advtrains_subway_wagon.png diff --git a/textures/advtrains_subway_train_inv.png b/advtrains/advtrains_train_subway/textures/advtrains_subway_wagon_inv.png Binary files differindex 1d0e809..1d0e809 100644 --- a/textures/advtrains_subway_train_inv.png +++ b/advtrains/advtrains_train_subway/textures/advtrains_subway_wagon_inv.png diff --git a/advtrains/atc_command.txt b/advtrains/atc_command.txt new file mode 100644 index 0000000..fa846e3 --- /dev/null +++ b/advtrains/atc_command.txt @@ -0,0 +1,68 @@ +ATC Command Syntax + +A train runs the current ATC command once it receives it, including delayed instructions. If the train receives a new command, the current command is discarded. +Spaces can be inserted into commands as needed and are ignored. + +# simple commands: + +S<[0-9]+ speed or 'M'> +Set target speed of train to <speed>. Accelerates if slower, rolls if faster. 'M' means maximum speed. +Execution of command continues immediately. + +B<[0-9]+ speed> +Brake until speed is reached. If faster, apply brakes, if slower, do nothing. +Execution of command continues immediately. + +Examples: +SM : accelerate to maximum speed +S0 : roll to stand +B0 : brake to stand +S0B3 or B3S0: brake to 3, then roll to stand. + +W +Wait until S and/or B commands reached the desired speed before continuing execution. + +D<[0-9]+ time> +Delay: Wait for time seconds before continuing execution. + +R +Reverse: change movement direction of train. ONLY WORKS WHEN TRAIN STANDS, else no-op. +Use B0WR to definitely change direction. + +Examples: +B0 W R D10 SM +Subway train stopping in dead end station and returning in opposite direction + +# conditional statements: + +I<condition><code>; +Execute code only if condition applies +I<condition><code1>E<code2>; +Execute code1 only if condition applies, else execute code2 + +Conditions: ++ / - +Tests the train's movement direction against the arrow on the ATC rail: M+ is true when train drives in direction of arrow. + +[</>/<=/>=][speed] +Test if train's speed is greater or smaller than the given value + +Examples: +I- B0 W R ; S8 +If the train drives in the 'wrong' direction, stop and reverse; independently accelerate to speed 8 afterwards. + +I<8 S8 ; +If the train is slower than 8, accelerate to 8. + +# ATC controller operation modes +static: Only give 1 static command. +mesecon: Give 2 different commands depending on if the controller is mesecon-powered or not +digiline: Don't give any commands by itself. When a train passes, a digiline message in the form of "[+/-][speed]" is sent on the set channel (where +/- means the same as with conditions). Any digiline message sent to the controller will be interpreted as ATC command and sent to the train. + +# Persistence +ATC controllers that are configured as 'static' or 'mesecon' are persistent over mapblock unloads and will even command the train when the mapblock is unloaded. This is not possible with digilines since these do not work in unloaded mapchunks. + +# LUA ATC controller (in development) +The LUA ATC Controller will operate by using LUA code. All operations shown above will have a function equivalent. Additionally all LUA ATC controllers share an environment and setting signal and switch status will be possible to allow for complicated railway systems/fully automated subways a.s.o. +Also planned: +- digicompute add-on to allow computer access to the ATC environment (railway maps... ... ... ... ...) diff --git a/license.txt b/advtrains/license.txt index 68a4b60..68a4b60 100644 --- a/license.txt +++ b/advtrains/license.txt diff --git a/license_media.txt b/advtrains/license_media.txt index c0da560..c0da560 100644 --- a/license_media.txt +++ b/advtrains/license_media.txt diff --git a/manual.pdf b/advtrains/manual.pdf Binary files differindex e8c6380..e8c6380 100644 --- a/manual.pdf +++ b/advtrains/manual.pdf diff --git a/models/blender/gleis/licence.txt~ b/advtrains/modpack.txt index e69de29..e69de29 100644 --- a/models/blender/gleis/licence.txt~ +++ b/advtrains/modpack.txt diff --git a/readme.txt b/advtrains/readme.txt index ad093bd..40516e4 100644 --- a/readme.txt +++ b/advtrains/readme.txt @@ -17,7 +17,9 @@ Gravel Texture : from Minetest Game Initial rail model/texture : DS-minetest
Models for signals/bumpers : mbb
Steam engine / wagon texture: mbb +Detailed Steam engine : mbb / Krokoschlange(animation) Industrial engine/wagons : mbb Inventory images : mbb Small code contributions : NaruTrey / gpcf -Mod Description : hajo
\ No newline at end of file +Mod Description : hajo +If I forgot someone please punish me for that.
\ No newline at end of file diff --git a/screenshot.png b/advtrains/screenshot.png Binary files differindex 78783e1..78783e1 100644 --- a/screenshot.png +++ b/advtrains/screenshot.png diff --git a/assets/AdvTrains_Additions.zip b/assets/AdvTrains_Additions.zip Binary files differnew file mode 100644 index 0000000..7588acf --- /dev/null +++ b/assets/AdvTrains_Additions.zip diff --git a/assets/Weichenhebel-CooleLokAnimiert.zip b/assets/Weichenhebel-CooleLokAnimiert.zip Binary files differnew file mode 100644 index 0000000..1175880 --- /dev/null +++ b/assets/Weichenhebel-CooleLokAnimiert.zip diff --git a/assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend b/assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend Binary files differnew file mode 100644 index 0000000..cf3b1da --- /dev/null +++ b/assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend diff --git a/assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend1 b/assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend1 Binary files differnew file mode 100644 index 0000000..cbc247b --- /dev/null +++ b/assets/Weichenhebel-CooleLokAnimiert/dampflock4pipe_animated.blend1 diff --git a/textures/advtrains_newlocomotive.xcf b/assets/advtrains_newlocomotive.xcf Binary files differindex 9ad5187..9ad5187 100644 --- a/textures/advtrains_newlocomotive.xcf +++ b/assets/advtrains_newlocomotive.xcf diff --git a/assets/advtrains_wagon.png b/assets/advtrains_wagon.png Binary files differnew file mode 100644 index 0000000..143154b --- /dev/null +++ b/assets/advtrains_wagon.png diff --git a/models/blender/engine-with-animation.blend b/assets/blender/engine-with-animation.blend Binary files differindex 2649587..2649587 100644 --- a/models/blender/engine-with-animation.blend +++ b/assets/blender/engine-with-animation.blend diff --git a/assets/blender/engine-with-animation_newtry.blend b/assets/blender/engine-with-animation_newtry.blend Binary files differnew file mode 100644 index 0000000..101dc71 --- /dev/null +++ b/assets/blender/engine-with-animation_newtry.blend diff --git a/assets/blender/engine-with-animation_newtry.blend1 b/assets/blender/engine-with-animation_newtry.blend1 Binary files differnew file mode 100644 index 0000000..77d82d4 --- /dev/null +++ b/assets/blender/engine-with-animation_newtry.blend1 diff --git a/assets/blender/gleis/detectorpart.png b/assets/blender/gleis/detectorpart.png Binary files differnew file mode 100644 index 0000000..fc24181 --- /dev/null +++ b/assets/blender/gleis/detectorpart.png diff --git a/models/blender/gleis/infos/Grafik_weiche.png b/assets/blender/gleis/infos/Grafik_weiche.png Binary files differindex 6674eb3..6674eb3 100644 --- a/models/blender/gleis/infos/Grafik_weiche.png +++ b/assets/blender/gleis/infos/Grafik_weiche.png diff --git a/models/blender/gleis/infos/breite b/assets/blender/gleis/infos/breite index b2862c6..b2862c6 100644 --- a/models/blender/gleis/infos/breite +++ b/assets/blender/gleis/infos/breite diff --git a/assets/blender/gleis/licence.txt~ b/assets/blender/gleis/licence.txt~ new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/assets/blender/gleis/licence.txt~ diff --git a/models/blender/gleis/rail_my.blend b/assets/blender/gleis/rail_my.blend Binary files differindex 3c741bc..3c741bc 100644 --- a/models/blender/gleis/rail_my.blend +++ b/assets/blender/gleis/rail_my.blend diff --git a/models/blender/gleis/rail_my.blend1 b/assets/blender/gleis/rail_my.blend1 Binary files differindex 6322856..6322856 100644 --- a/models/blender/gleis/rail_my.blend1 +++ b/assets/blender/gleis/rail_my.blend1 diff --git a/models/blender/gleis/rail_my_rt.blend b/assets/blender/gleis/rail_my_rt.blend Binary files differindex 8372a0c..8372a0c 100644 --- a/models/blender/gleis/rail_my_rt.blend +++ b/assets/blender/gleis/rail_my_rt.blend diff --git a/models/blender/gleis/rail_my_rt.blend1 b/assets/blender/gleis/rail_my_rt.blend1 Binary files differindex 7d0978e..7d0978e 100644 --- a/models/blender/gleis/rail_my_rt.blend1 +++ b/assets/blender/gleis/rail_my_rt.blend1 diff --git a/models/blender/gleis/rail_my_rt_final.blend1 b/assets/blender/gleis/rail_my_rt_final.blend Binary files differindex 1f346ae..d07a65d 100644 --- a/models/blender/gleis/rail_my_rt_final.blend1 +++ b/assets/blender/gleis/rail_my_rt_final.blend diff --git a/models/blender/gleis/rail_my_rt_final.blend b/assets/blender/gleis/rail_my_rt_final.blend1 Binary files differindex 6a9a088..8a2d213 100644 --- a/models/blender/gleis/rail_my_rt_final.blend +++ b/assets/blender/gleis/rail_my_rt_final.blend1 diff --git a/models/blender/gleis/rail_my_rt_switches.blend b/assets/blender/gleis/rail_my_rt_switches.blend Binary files differindex fdce427..fdce427 100644 --- a/models/blender/gleis/rail_my_rt_switches.blend +++ b/assets/blender/gleis/rail_my_rt_switches.blend diff --git a/models/blender/gleis/rail_my_rt_switches.blend1 b/assets/blender/gleis/rail_my_rt_switches.blend1 Binary files differindex 04370ba..04370ba 100644 --- a/models/blender/gleis/rail_my_rt_switches.blend1 +++ b/assets/blender/gleis/rail_my_rt_switches.blend1 diff --git a/models/blender/gleis/rail_my_rt_switches2.blend b/assets/blender/gleis/rail_my_rt_switches2.blend Binary files differindex 9562e4d..9562e4d 100644 --- a/models/blender/gleis/rail_my_rt_switches2.blend +++ b/assets/blender/gleis/rail_my_rt_switches2.blend diff --git a/models/blender/gleis/rail_my_rt_switches2.blend1 b/assets/blender/gleis/rail_my_rt_switches2.blend1 Binary files differindex 07a155f..07a155f 100644 --- a/models/blender/gleis/rail_my_rt_switches2.blend1 +++ b/assets/blender/gleis/rail_my_rt_switches2.blend1 diff --git a/models/blender/gleis/rail_together.blend b/assets/blender/gleis/rail_together.blend Binary files differindex cff51ea..cff51ea 100644 --- a/models/blender/gleis/rail_together.blend +++ b/assets/blender/gleis/rail_together.blend diff --git a/models/blender/gleis/rail_together.png b/assets/blender/gleis/rail_together.png Binary files differindex 386cd5c..386cd5c 100644 --- a/models/blender/gleis/rail_together.png +++ b/assets/blender/gleis/rail_together.png diff --git a/models/blender/gleis/rail_together2.png b/assets/blender/gleis/rail_together2.png Binary files differindex 3effe34..3effe34 100644 --- a/models/blender/gleis/rail_together2.png +++ b/assets/blender/gleis/rail_together2.png diff --git a/models/blender/gleis/rail_together3.png b/assets/blender/gleis/rail_together3.png Binary files differindex 4a183c1..4a183c1 100644 --- a/models/blender/gleis/rail_together3.png +++ b/assets/blender/gleis/rail_together3.png diff --git a/models/blender/gleis/rail_verticals.blend b/assets/blender/gleis/rail_verticals.blend Binary files differindex 45c37e1..45c37e1 100644 --- a/models/blender/gleis/rail_verticals.blend +++ b/assets/blender/gleis/rail_verticals.blend diff --git a/models/blender/gleis/rail_verticals.blend1 b/assets/blender/gleis/rail_verticals.blend1 Binary files differindex 320f30b..320f30b 100644 --- a/models/blender/gleis/rail_verticals.blend1 +++ b/assets/blender/gleis/rail_verticals.blend1 diff --git a/models/blender/gleis/rail_verticals3.blend b/assets/blender/gleis/rail_verticals3.blend Binary files differindex 5d62959..5d62959 100644 --- a/models/blender/gleis/rail_verticals3.blend +++ b/assets/blender/gleis/rail_verticals3.blend diff --git a/models/blender/gleis/rail_verticals3.blend1 b/assets/blender/gleis/rail_verticals3.blend1 Binary files differindex 893f2ea..893f2ea 100644 --- a/models/blender/gleis/rail_verticals3.blend1 +++ b/assets/blender/gleis/rail_verticals3.blend1 diff --git a/models/blender/gleis/rail_verticals45.blend b/assets/blender/gleis/rail_verticals45.blend Binary files differindex a1589e3..a1589e3 100644 --- a/models/blender/gleis/rail_verticals45.blend +++ b/assets/blender/gleis/rail_verticals45.blend diff --git a/models/blender/gleis/rail_verticals45.blend1 b/assets/blender/gleis/rail_verticals45.blend1 Binary files differindex 6b44d1c..6b44d1c 100644 --- a/models/blender/gleis/rail_verticals45.blend1 +++ b/assets/blender/gleis/rail_verticals45.blend1 diff --git a/models/blender/gleis/rail_verticals45.blend11 b/assets/blender/gleis/rail_verticals45.blend11 Binary files differindex 48316e8..48316e8 100644 --- a/models/blender/gleis/rail_verticals45.blend11 +++ b/assets/blender/gleis/rail_verticals45.blend11 diff --git a/models/blender/gleis/texturen/rail.png b/assets/blender/gleis/texturen/rail.png Binary files differindex 8478cf6..8478cf6 100644 --- a/models/blender/gleis/texturen/rail.png +++ b/assets/blender/gleis/texturen/rail.png diff --git a/models/blender/gleis/texturen/uv.png b/assets/blender/gleis/texturen/uv.png Binary files differindex fb0af3e..fb0af3e 100644 --- a/models/blender/gleis/texturen/uv.png +++ b/assets/blender/gleis/texturen/uv.png diff --git a/models/blender/industrial/industry_loc.blend b/assets/blender/industrial/industry_loc.blend Binary files differindex 1a6cb2b..1a6cb2b 100644 --- a/models/blender/industrial/industry_loc.blend +++ b/assets/blender/industrial/industry_loc.blend diff --git a/models/blender/industrial/industry_loc.blend1 b/assets/blender/industrial/industry_loc.blend1 Binary files differindex af54c3f..af54c3f 100644 --- a/models/blender/industrial/industry_loc.blend1 +++ b/assets/blender/industrial/industry_loc.blend1 diff --git a/models/blender/industrial/industry_loc.blend11 b/assets/blender/industrial/industry_loc.blend11 Binary files differindex a089a65..a089a65 100644 --- a/models/blender/industrial/industry_loc.blend11 +++ b/assets/blender/industrial/industry_loc.blend11 diff --git a/models/blender/industrial/industry_oil_ wagong.blend b/assets/blender/industrial/industry_oil_ wagong.blend Binary files differindex 30bde51..30bde51 100644 --- a/models/blender/industrial/industry_oil_ wagong.blend +++ b/assets/blender/industrial/industry_oil_ wagong.blend diff --git a/models/blender/industrial/industry_oil_ wagong.blend1 b/assets/blender/industrial/industry_oil_ wagong.blend1 Binary files differindex 849971d..849971d 100644 --- a/models/blender/industrial/industry_oil_ wagong.blend1 +++ b/assets/blender/industrial/industry_oil_ wagong.blend1 diff --git a/models/blender/industrial/industry_tree_wagong.blend b/assets/blender/industrial/industry_tree_wagong.blend Binary files differindex 23de208..23de208 100644 --- a/models/blender/industrial/industry_tree_wagong.blend +++ b/assets/blender/industrial/industry_tree_wagong.blend diff --git a/models/blender/industrial/industry_tree_wagong.blend1 b/assets/blender/industrial/industry_tree_wagong.blend1 Binary files differindex bf2c9ed..bf2c9ed 100644 --- a/models/blender/industrial/industry_tree_wagong.blend1 +++ b/assets/blender/industrial/industry_tree_wagong.blend1 diff --git a/models/blender/industrial/industry_tree_wagong.png b/assets/blender/industrial/industry_tree_wagong.png Binary files differindex 87109dd..87109dd 100644 --- a/models/blender/industrial/industry_tree_wagong.png +++ b/assets/blender/industrial/industry_tree_wagong.png diff --git a/models/blender/locomotive.blend b/assets/blender/locomotive.blend Binary files differindex 8fd6059..8fd6059 100644 --- a/models/blender/locomotive.blend +++ b/assets/blender/locomotive.blend diff --git a/models/blender/magnet_track.blend b/assets/blender/magnet_track.blend Binary files differindex 0ab14e7..0ab14e7 100644 --- a/models/blender/magnet_track.blend +++ b/assets/blender/magnet_track.blend diff --git a/models/blender/mbb/advtrains_wagon_japan.xcf b/assets/blender/mbb/advtrains_wagon_japan.xcf Binary files differindex 4fc88c0..4fc88c0 100644 --- a/models/blender/mbb/advtrains_wagon_japan.xcf +++ b/assets/blender/mbb/advtrains_wagon_japan.xcf diff --git a/models/blender/mbb/modern_japanlocomotive.blend b/assets/blender/mbb/modern_japanlocomotive.blend Binary files differindex 6eb8f3d..6eb8f3d 100644 --- a/models/blender/mbb/modern_japanlocomotive.blend +++ b/assets/blender/mbb/modern_japanlocomotive.blend diff --git a/models/blender/mbb/modern_japanlocomotive.blend1 b/assets/blender/mbb/modern_japanlocomotive.blend1 Binary files differindex a2e745d..a2e745d 100644 --- a/models/blender/mbb/modern_japanlocomotive.blend1 +++ b/assets/blender/mbb/modern_japanlocomotive.blend1 diff --git a/models/blender/mbb/modern_japanlocomotive.png b/assets/blender/mbb/modern_japanlocomotive.png Binary files differindex b80d16f..b80d16f 100644 --- a/models/blender/mbb/modern_japanlocomotive.png +++ b/assets/blender/mbb/modern_japanlocomotive.png diff --git a/models/blender/mbb/modern_japanlocomotive.xcf b/assets/blender/mbb/modern_japanlocomotive.xcf Binary files differindex bb28534..bb28534 100644 --- a/models/blender/mbb/modern_japanlocomotive.xcf +++ b/assets/blender/mbb/modern_japanlocomotive.xcf diff --git a/models/blender/mbb/modern_locomotive.blend b/assets/blender/mbb/modern_locomotive.blend Binary files differindex 8e72233..8e72233 100644 --- a/models/blender/mbb/modern_locomotive.blend +++ b/assets/blender/mbb/modern_locomotive.blend diff --git a/models/blender/mbb/modern_wagong.blend b/assets/blender/mbb/modern_wagong.blend Binary files differindex f32710a..f32710a 100644 --- a/models/blender/mbb/modern_wagong.blend +++ b/assets/blender/mbb/modern_wagong.blend diff --git a/models/blender/mbb/modern_wagong.blend1 b/assets/blender/mbb/modern_wagong.blend1 Binary files differindex 376831c..376831c 100644 --- a/models/blender/mbb/modern_wagong.blend1 +++ b/assets/blender/mbb/modern_wagong.blend1 diff --git a/models/blender/mbb/modern_wagong_uv.blend b/assets/blender/mbb/modern_wagong_uv.blend Binary files differindex 4c10fb3..4c10fb3 100644 --- a/models/blender/mbb/modern_wagong_uv.blend +++ b/assets/blender/mbb/modern_wagong_uv.blend diff --git a/models/blender/mbb/modern_wagong_uv.blend1 b/assets/blender/mbb/modern_wagong_uv.blend1 Binary files differindex ce77416..ce77416 100644 --- a/models/blender/mbb/modern_wagong_uv.blend1 +++ b/assets/blender/mbb/modern_wagong_uv.blend1 diff --git a/models/blender/mbb/modern_wagong_uv.png b/assets/blender/mbb/modern_wagong_uv.png Binary files differindex 68018ea..68018ea 100644 --- a/models/blender/mbb/modern_wagong_uv.png +++ b/assets/blender/mbb/modern_wagong_uv.png diff --git a/models/blender/mbb/prellbock.blend b/assets/blender/mbb/prellbock.blend Binary files differindex 1c20ab2..1c20ab2 100644 --- a/models/blender/mbb/prellbock.blend +++ b/assets/blender/mbb/prellbock.blend diff --git a/models/blender/mbb/prellbock.blend1 b/assets/blender/mbb/prellbock.blend1 Binary files differindex 981538e..981538e 100644 --- a/models/blender/mbb/prellbock.blend1 +++ b/assets/blender/mbb/prellbock.blend1 diff --git a/models/blender/mbb/prellbock.uv.png b/assets/blender/mbb/prellbock.uv.png Binary files differindex 7730753..7730753 100644 --- a/models/blender/mbb/prellbock.uv.png +++ b/assets/blender/mbb/prellbock.uv.png diff --git a/models/blender/mbb/regio-lokomotive.blend b/assets/blender/mbb/regio-lokomotive.blend Binary files differindex 210e60e..210e60e 100644 --- a/models/blender/mbb/regio-lokomotive.blend +++ b/assets/blender/mbb/regio-lokomotive.blend diff --git a/models/blender/mbb/regio-waron.blend b/assets/blender/mbb/regio-waron.blend Binary files differindex 19b07ce..19b07ce 100644 --- a/models/blender/mbb/regio-waron.blend +++ b/assets/blender/mbb/regio-waron.blend diff --git a/models/blender/mbb/retrosignal.blend b/assets/blender/mbb/retrosignal.blend Binary files differindex b795215..b795215 100644 --- a/models/blender/mbb/retrosignal.blend +++ b/assets/blender/mbb/retrosignal.blend diff --git a/models/blender/mbb/retrosignal.blend1 b/assets/blender/mbb/retrosignal.blend1 Binary files differindex 94af470..94af470 100644 --- a/models/blender/mbb/retrosignal.blend1 +++ b/assets/blender/mbb/retrosignal.blend1 diff --git a/models/blender/mbb/signal(2)_hoch.blend b/assets/blender/mbb/signal(2)_hoch.blend Binary files differindex 70391f6..70391f6 100644 --- a/models/blender/mbb/signal(2)_hoch.blend +++ b/assets/blender/mbb/signal(2)_hoch.blend diff --git a/models/blender/mbb/signal(2)_unten.blend b/assets/blender/mbb/signal(2)_unten.blend Binary files differindex 4e917bc..4e917bc 100644 --- a/models/blender/mbb/signal(2)_unten.blend +++ b/assets/blender/mbb/signal(2)_unten.blend diff --git a/models/blender/mbb/signal.blend b/assets/blender/mbb/signal.blend Binary files differindex 135c7b4..135c7b4 100644 --- a/models/blender/mbb/signal.blend +++ b/assets/blender/mbb/signal.blend diff --git a/models/blender/mbb/signal.blend1 b/assets/blender/mbb/signal.blend1 Binary files differindex 63a8c99..63a8c99 100644 --- a/models/blender/mbb/signal.blend1 +++ b/assets/blender/mbb/signal.blend1 diff --git a/models/blender/mbb/signal.png b/assets/blender/mbb/signal.png Binary files differindex 779cdda..779cdda 100644 --- a/models/blender/mbb/signal.png +++ b/assets/blender/mbb/signal.png diff --git a/models/blender/mbb/signal.xcf b/assets/blender/mbb/signal.xcf Binary files differindex f667739..f667739 100644 --- a/models/blender/mbb/signal.xcf +++ b/assets/blender/mbb/signal.xcf diff --git a/models/blender/mbb/signal2.png b/assets/blender/mbb/signal2.png Binary files differindex 7af4e2d..7af4e2d 100644 --- a/models/blender/mbb/signal2.png +++ b/assets/blender/mbb/signal2.png diff --git a/models/blender/mbb/tr-logo.png b/assets/blender/mbb/tr-logo.png Binary files differindex 9bc0f10..9bc0f10 100644 --- a/models/blender/mbb/tr-logo.png +++ b/assets/blender/mbb/tr-logo.png diff --git a/models/blender/mbb/weichenhebel1.blend b/assets/blender/mbb/weichenhebel1.blend Binary files differindex 70b997d..70b997d 100644 --- a/models/blender/mbb/weichenhebel1.blend +++ b/assets/blender/mbb/weichenhebel1.blend diff --git a/models/blender/mbb/weichenhebel2.blend b/assets/blender/mbb/weichenhebel2.blend Binary files differindex c1c3aac..c1c3aac 100644 --- a/models/blender/mbb/weichenhebel2.blend +++ b/assets/blender/mbb/weichenhebel2.blend diff --git a/models/blender/newlocomotive.blend b/assets/blender/newlocomotive.blend Binary files differindex 858882b..858882b 100644 --- a/models/blender/newlocomotive.blend +++ b/assets/blender/newlocomotive.blend diff --git a/models/blender/newlocomotive.blend1 b/assets/blender/newlocomotive.blend1 Binary files differindex 4b8b24f..4b8b24f 100644 --- a/models/blender/newlocomotive.blend1 +++ b/assets/blender/newlocomotive.blend1 diff --git a/models/blender/newlocomotive_uvs.png b/assets/blender/newlocomotive_uvs.png Binary files differindex 879be65..879be65 100644 --- a/models/blender/newlocomotive_uvs.png +++ b/assets/blender/newlocomotive_uvs.png diff --git a/models/blender/newwagon.blend b/assets/blender/newwagon.blend Binary files differindex 1cedc55..1cedc55 100644 --- a/models/blender/newwagon.blend +++ b/assets/blender/newwagon.blend diff --git a/models/blender/newwagon.blend1 b/assets/blender/newwagon.blend1 Binary files differindex eb30fde..eb30fde 100644 --- a/models/blender/newwagon.blend1 +++ b/assets/blender/newwagon.blend1 diff --git a/models/blender/newwagon.png b/assets/blender/newwagon.png Binary files differindex 812bc32..812bc32 100644 --- a/models/blender/newwagon.png +++ b/assets/blender/newwagon.png diff --git a/models/blender/subway-train.blend1 b/assets/blender/subway-train.blend Binary files differindex 86d1f92..01bb233 100644 --- a/models/blender/subway-train.blend1 +++ b/assets/blender/subway-train.blend diff --git a/models/blender/subway-train.blend b/assets/blender/subway-train.blend1 Binary files differindex 690d87b..690d87b 100644 --- a/models/blender/subway-train.blend +++ b/assets/blender/subway-train.blend1 diff --git a/models/blender/subway-train.png b/assets/blender/subway-train.png Binary files differindex d0b9731..d0b9731 100644 --- a/models/blender/subway-train.png +++ b/assets/blender/subway-train.png diff --git a/models/blender/subway-train.xcf b/assets/blender/subway-train.xcf Binary files differindex 775b87c..775b87c 100644 --- a/models/blender/subway-train.xcf +++ b/assets/blender/subway-train.xcf diff --git a/assets/blender/subway-train_animate.blend b/assets/blender/subway-train_animate.blend Binary files differnew file mode 100644 index 0000000..75cdc52 --- /dev/null +++ b/assets/blender/subway-train_animate.blend diff --git a/assets/blender/subway-train_animate.blend1 b/assets/blender/subway-train_animate.blend1 Binary files differnew file mode 100644 index 0000000..04171fc --- /dev/null +++ b/assets/blender/subway-train_animate.blend1 diff --git a/assets/blender/subway-train_animate_mirrored.blend b/assets/blender/subway-train_animate_mirrored.blend Binary files differnew file mode 100644 index 0000000..aa11c34 --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored.blend diff --git a/assets/blender/subway-train_animate_mirrored.blend1 b/assets/blender/subway-train_animate_mirrored.blend1 Binary files differnew file mode 100644 index 0000000..4d64915 --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored.blend1 diff --git a/assets/blender/subway-train_animate_mirrored_solidify.blend b/assets/blender/subway-train_animate_mirrored_solidify.blend Binary files differnew file mode 100644 index 0000000..7a25b6f --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored_solidify.blend diff --git a/assets/blender/subway-train_animate_mirrored_solidify.blend1 b/assets/blender/subway-train_animate_mirrored_solidify.blend1 Binary files differnew file mode 100644 index 0000000..f81e303 --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored_solidify.blend1 diff --git a/assets/blender/subway-train_animate_mirrored_solidify_uv.blend b/assets/blender/subway-train_animate_mirrored_solidify_uv.blend Binary files differnew file mode 100644 index 0000000..b05b0a5 --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored_solidify_uv.blend diff --git a/assets/blender/subway-train_animate_mirrored_solidify_uv.blend1 b/assets/blender/subway-train_animate_mirrored_solidify_uv.blend1 Binary files differnew file mode 100644 index 0000000..145137b --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored_solidify_uv.blend1 diff --git a/assets/blender/subway-train_animate_mirrored_solidify_uv.png b/assets/blender/subway-train_animate_mirrored_solidify_uv.png Binary files differnew file mode 100644 index 0000000..e63a7f2 --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored_solidify_uv.png diff --git a/assets/blender/subway-train_animate_mirrored_solidify_uv.xcf b/assets/blender/subway-train_animate_mirrored_solidify_uv.xcf Binary files differnew file mode 100644 index 0000000..42adace --- /dev/null +++ b/assets/blender/subway-train_animate_mirrored_solidify_uv.xcf diff --git a/models/blender/trackplane.blend b/assets/blender/trackplane.blend Binary files differindex 79365f7..79365f7 100644 --- a/models/blender/trackplane.blend +++ b/assets/blender/trackplane.blend diff --git a/models/blender/trackvertical1.blend b/assets/blender/trackvertical1.blend Binary files differindex fca6742..fca6742 100644 --- a/models/blender/trackvertical1.blend +++ b/assets/blender/trackvertical1.blend diff --git a/models/blender/trackvertical1.blend1 b/assets/blender/trackvertical1.blend1 Binary files differindex b146b56..b146b56 100644 --- a/models/blender/trackvertical1.blend1 +++ b/assets/blender/trackvertical1.blend1 diff --git a/models/blender/trackvertical1.png b/assets/blender/trackvertical1.png Binary files differindex a998dcb..a998dcb 100644 --- a/models/blender/trackvertical1.png +++ b/assets/blender/trackvertical1.png diff --git a/models/blender/trackvertical2.blend b/assets/blender/trackvertical2.blend Binary files differindex a066b84..a066b84 100644 --- a/models/blender/trackvertical2.blend +++ b/assets/blender/trackvertical2.blend diff --git a/models/blender/trackvertical2.png b/assets/blender/trackvertical2.png Binary files differindex 43142f9..43142f9 100644 --- a/models/blender/trackvertical2.png +++ b/assets/blender/trackvertical2.png diff --git a/assets/dampflock4.blend b/assets/dampflock4.blend Binary files differnew file mode 100644 index 0000000..883c3d3 --- /dev/null +++ b/assets/dampflock4.blend diff --git a/assets/init.lua b/assets/init.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/assets/init.lua diff --git a/textures/larger rails.xcf b/assets/larger rails.xcf Binary files differindex 42ae592..42ae592 100644 --- a/textures/larger rails.xcf +++ b/assets/larger rails.xcf diff --git a/assets/magleves_lockomotive.blend b/assets/magleves_lockomotive.blend Binary files differnew file mode 100644 index 0000000..8c82b00 --- /dev/null +++ b/assets/magleves_lockomotive.blend diff --git a/assets/magleves_track.blend b/assets/magleves_track.blend Binary files differnew file mode 100644 index 0000000..82f11ef --- /dev/null +++ b/assets/magleves_track.blend diff --git a/assets/magleves_wagon.blend b/assets/magleves_wagon.blend Binary files differnew file mode 100644 index 0000000..cc89531 --- /dev/null +++ b/assets/magleves_wagon.blend diff --git a/assets/mbbrailtextures/advtrains_dtrack_rail.png b/assets/mbbrailtextures/advtrains_dtrack_rail.png Binary files differnew file mode 100644 index 0000000..bd0c217 --- /dev/null +++ b/assets/mbbrailtextures/advtrains_dtrack_rail.png diff --git a/assets/mbbrailtextures/advtrains_dtrack_rail_atc.png b/assets/mbbrailtextures/advtrains_dtrack_rail_atc.png Binary files differnew file mode 100644 index 0000000..7e4c20f --- /dev/null +++ b/assets/mbbrailtextures/advtrains_dtrack_rail_atc.png diff --git a/assets/mbbrailtextures/advtrains_dtrack_rail_detector_on.png b/assets/mbbrailtextures/advtrains_dtrack_rail_detector_on.png Binary files differnew file mode 100644 index 0000000..c878324 --- /dev/null +++ b/assets/mbbrailtextures/advtrains_dtrack_rail_detector_on.png diff --git a/models/oldmodels/locomotive.b3d b/assets/oldmodels/locomotive.b3d Binary files differindex 5e16be3..5e16be3 100644 --- a/models/oldmodels/locomotive.b3d +++ b/assets/oldmodels/locomotive.b3d diff --git a/models/oldmodels/trackvertical1.b3d b/assets/oldmodels/trackvertical1.b3d Binary files differindex 5620f60..5620f60 100644 --- a/models/oldmodels/trackvertical1.b3d +++ b/assets/oldmodels/trackvertical1.b3d diff --git a/models/oldmodels/trackvertical2.b3d b/assets/oldmodels/trackvertical2.b3d Binary files differindex 22dbb20..22dbb20 100644 --- a/models/oldmodels/trackvertical2.b3d +++ b/assets/oldmodels/trackvertical2.b3d diff --git a/assets/uban_fancy.blend b/assets/uban_fancy.blend Binary files differnew file mode 100644 index 0000000..f049966 --- /dev/null +++ b/assets/uban_fancy.blend diff --git a/assets/wagonfancytexture.png b/assets/wagonfancytexture.png Binary files differnew file mode 100644 index 0000000..c850518 --- /dev/null +++ b/assets/wagonfancytexture.png diff --git a/assets/wagong_fancy.blend b/assets/wagong_fancy.blend Binary files differnew file mode 100644 index 0000000..f9e44d5 --- /dev/null +++ b/assets/wagong_fancy.blend diff --git a/assets/wagong_fancy.blend1 b/assets/wagong_fancy.blend1 Binary files differnew file mode 100644 index 0000000..5c6c328 --- /dev/null +++ b/assets/wagong_fancy.blend1 diff --git a/atc.lua b/atc.lua deleted file mode 100644 index 0afddb0..0000000 --- a/atc.lua +++ /dev/null @@ -1,4 +0,0 @@ ---atc.lua ---registers and controls the ATC system - ---(simple)mesecon detector rails diff --git a/init.lua b/init.lua deleted file mode 100644 index 41b624e..0000000 --- a/init.lua +++ /dev/null @@ -1,42 +0,0 @@ ---advtrains - -advtrains={} - -advtrains.modpath = minetest.get_modpath("advtrains") - ---print=function(text) --- minetest.log("action", tostring(text) or "<non-string>") ---end -print = function(t) minetest.log("action", t) minetest.chat_send_all(t) end - -dofile(advtrains.modpath.."/helpers.lua"); -dofile(advtrains.modpath.."/debugitems.lua"); - -advtrains.meseconrules = -{{x=0, y=0, z=-1}, - {x=1, y=0, z=0}, - {x=-1, y=0, z=0}, - {x=0, y=0, z=1}, - {x=1, y=1, z=0}, - {x=1, y=-1, z=0}, - {x=-1, y=1, z=0}, - {x=-1, y=-1, z=0}, - {x=0, y=1, z=1}, - {x=0, y=-1, z=1}, - {x=0, y=1, z=-1}, - {x=0, y=-1, z=-1}, - {x=0, y=-2, z=0}} -dofile(advtrains.modpath.."/trainlogic.lua") -dofile(advtrains.modpath.."/trainhud.lua") -dofile(advtrains.modpath.."/trackplacer.lua") -dofile(advtrains.modpath.."/tracks.lua") -dofile(advtrains.modpath.."/atc.lua") -dofile(advtrains.modpath.."/wagons.lua") - -dofile(advtrains.modpath.."/pseudoload.lua") -dofile(advtrains.modpath.."/couple.lua") -dofile(advtrains.modpath.."/damage.lua") - -dofile(advtrains.modpath.."/signals.lua") -dofile(advtrains.modpath.."/misc_nodes.lua") -dofile(advtrains.modpath.."/crafting.lua") diff --git a/models/advtrains_engine_steam.b3d b/models/advtrains_engine_steam.b3d Binary files differdeleted file mode 100644 index 36bdd15..0000000 --- a/models/advtrains_engine_steam.b3d +++ /dev/null diff --git a/models/advtrains_subway_train.b3d b/models/advtrains_subway_train.b3d Binary files differdeleted file mode 100644 index a824d33..0000000 --- a/models/advtrains_subway_train.b3d +++ /dev/null diff --git a/modpack.txt b/modpack.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/modpack.txt diff --git a/pseudoload.lua b/pseudoload.lua deleted file mode 100644 index 8511811..0000000 --- a/pseudoload.lua +++ /dev/null @@ -1,180 +0,0 @@ -local print=function(t) minetest.log("action", t) minetest.chat_send_all(t) end - ---pseudoload.lua ---responsible for keeping up a database of all rail nodes existant in the world, regardless of whether the mapchunk is loaded. - -advtrains.trackdb={} ---trackdb[tt][y][x][z]={conn1, conn2, rely1, rely2, railheight} ---serialization format: ---(2byte x)(2byte y)(2byte z)(4bits conn1, 4bits conn2)[(plain rely1)|(plain rely2)|(plain railheight)]\n ---[] may be missing if 0,0,0 - ---load initially - ---[[ TODO temporary outcomment - ---delayed since all traintypes need to be registered -minetest.after(0, function() - -for tt, _ in pairs(advtrains.all_traintypes) do - local pl_fpath=minetest.get_worldpath().."/advtrains_trackdb_"..tt - advtrains.trackdb[tt]={} - local file, err = io.open(pl_fpath, "r") - if not file then - local er=err or "Unknown Error" - print("[advtrains]Failed loading advtrains trackdb save file "..er) - else - --custom format to save memory - while true do - local xbytes=file:read(2) - if not xbytes or #xbytes<2 then - break --eof reached - end - print(xbytes) - local ybytes=file:read(2) - local zbytes=file:read(2) - local x=(string.byte(xbytes[1])-128)*256+(string.byte(xbytes[2])) - local y=(string.byte(ybytes[1])-128)*256+(string.byte(ybytes[2])) - local z=(string.byte(zbytes[1])-128)*256+(string.byte(zbytes[2])) - - local conn1=string.byte(file:read(1)) - local conn1=string.byte(file:read(1)) - - if not advtrains.trackdb[tt][y] then advtrains.trackdb[tt][y]={} end - if not advtrains.trackdb[tt][y][x] then advtrains.trackdb[tt][y][x]={} end - - local rest=file.read("*l") - if rest~="" then - local rely1, rely2, railheight=string.match(rest, "([^|]+)|([^|]+)|([^|]+)") - if rely1 and rely2 and railheight then - advtrains.trackdb[tt][y][x][z]={ - conn1=conn1, conn2=conn2, - rely1=rely1, rely2=rely2, - railheight=railheight - } - else - advtrains.trackdb[tt][y][x][z]={ - conn1=conn1, conn2=conn2 - } - end - else - advtrains.trackdb[tt][y][x][z]={ - conn1=conn1, conn2=conn2 - } - end - end - file:close() - end -end - ---end minetest.after -end) - -function advtrains.save_trackdb() - for tt, _ in pairs(advtrains.all_traintypes) do - local pl_fpath=minetest.get_worldpath().."/advtrains_trackdb_"..tt - local file, err = io.open(pl_fpath, "w") - if not file then - local er=err or "Unknown Error" - print("[advtrains]Failed saving advtrains trackdb save file "..er) - else - --custom format to save memory - for y,tyl in pairs(advtrains.trackdb[tt]) do - for x,txl in pairs(tyl) do - for z,rail in pairs(txl) do - print("write "..x.." "..y.." "..z.." "..minetest.serialize(rail)) - file:write(string.char(math.floor(x/256)+128)..string.char((x%256))) - file:write(string.char(math.floor(y/256)+128)..string.char((y%256))) - file:write(string.char(math.floor(z/256)+128)..string.char((z%256))) - file:write(string.char(rail.conn1)) - file:write(string.char(rail.conn2)) - if (rail.rely1 and rail.rely1~=0) or (rail.rely2 and rail.rely2~=0) or (rail.railheight and rail.railheight~=0) then - file:write(rail.rely1.."|"..rail.rely2.."|"..rail.railheight) - end - file:write("\n") - end - end - end - file:close() - end - end -end -]]--end temp outcomment -advtrains.trackdb={} -advtrains.fpath_tdb=minetest.get_worldpath().."/advtrains_trackdb" -local file, err = io.open(advtrains.fpath_tdb, "r") -if not file then - local er=err or "Unknown Error" - print("[advtrains]Failed loading advtrains save file "..er) -else - local tbl = minetest.deserialize(file:read("*a")) - if type(tbl) == "table" then - advtrains.trackdb=tbl - end - file:close() -end -function advtrains.save_trackdb() - local datastr = minetest.serialize(advtrains.trackdb) - if not datastr then - minetest.log("error", "[advtrains] Failed to serialize trackdb data!") - return - end - local file, err = io.open(advtrains.fpath_tdb, "w") - if err then - return err - end - file:write(datastr) - file:close() -end - ---get_node with pseudoload. ---returns: ---true, conn1, conn2, rely1, rely2, railheight in case everything's right. ---false if it's not a rail or the train does not drive on this rail, but it is loaded or ---nil if the node is neither loaded nor in trackdb ---the distraction between false and nil will be needed only in special cases.(train initpos) -function advtrains.get_rail_info_at(pos, traintype) - local node=minetest.get_node_or_nil(pos) - if not node then - --try raildb - local rdp=vector.round(pos) - local dbe=(advtrains.trackdb[traintype] and advtrains.trackdb[traintype][rdp.y] and advtrains.trackdb[traintype][rdp.y][rdp.x] and advtrains.trackdb[traintype][rdp.y][rdp.x][rdp.z]) - if dbe then - return true, dbe.conn1, dbe.conn2, dbe.rely1 or 0, dbe.rely2 or 0, dbe.railheight or 0 - else - return nil - end - end - local nodename=node.name - if(not advtrains.is_track_and_drives_on(nodename, advtrains.all_traintypes[traintype].drives_on)) then - return false - end - local conn1, conn2, rely1, rely2, railheight=advtrains.get_track_connections(node.name, node.param2) - - --already in trackdb? - local rdp=vector.round(pos) - if not (advtrains.trackdb[traintype] and advtrains.trackdb[traintype][rdp.y] and advtrains.trackdb[traintype][rdp.y][rdp.x] and advtrains.trackdb[traintype][rdp.y][rdp.x][rdp.z]) then--TODO is this necessary? - if not advtrains.trackdb[traintype] then advtrains.trackdb[traintype]={} end - if not advtrains.trackdb[traintype][rdp.y] then advtrains.trackdb[traintype][rdp.y]={} end - if not advtrains.trackdb[traintype][rdp.y][rdp.x] then advtrains.trackdb[traintype][rdp.y][rdp.x]={} end - advtrains.trackdb[traintype][rdp.y][rdp.x][rdp.z]={ - conn1=conn1, conn2=conn2, - rely1=rely1, rely2=rely2, - railheight=railheight - } - end - - return true, conn1, conn2, rely1, rely2, railheight -end -function advtrains.reset_trackdb_position(pos) - local rdp=vector.round(pos) - for tt, _ in pairs(advtrains.all_traintypes) do - if not advtrains.trackdb[tt] then advtrains.trackdb[tt]={} end - if not advtrains.trackdb[tt][rdp.y] then advtrains.trackdb[tt][rdp.y]={} end - if not advtrains.trackdb[tt][rdp.y][rdp.x] then advtrains.trackdb[tt][rdp.y][rdp.x]={} end - advtrains.trackdb[tt][rdp.y][rdp.x][rdp.z]=nil - advtrains.get_rail_info_at(pos, tt)--to restore it. - end -end - - diff --git a/textures/advtrains_dtrack_placer.png b/textures/advtrains_dtrack_placer.png Binary files differdeleted file mode 100644 index c49777c..0000000 --- a/textures/advtrains_dtrack_placer.png +++ /dev/null diff --git a/textures/advtrains_dtrack_rail.png b/textures/advtrains_dtrack_rail.png Binary files differdeleted file mode 100644 index 568e533..0000000 --- a/textures/advtrains_dtrack_rail.png +++ /dev/null diff --git a/textures/advtrains_dtrack_rail_detector_on.png b/textures/advtrains_dtrack_rail_detector_on.png Binary files differdeleted file mode 100644 index 3ae0dac..0000000 --- a/textures/advtrains_dtrack_rail_detector_on.png +++ /dev/null diff --git a/textures/advtrains_newlocomotive.png b/textures/advtrains_newlocomotive.png Binary files differdeleted file mode 100644 index e461bc7..0000000 --- a/textures/advtrains_newlocomotive.png +++ /dev/null diff --git a/textures/advtrains_subway_train.png b/textures/advtrains_subway_train.png Binary files differdeleted file mode 100644 index 1d569f3..0000000 --- a/textures/advtrains_subway_train.png +++ /dev/null diff --git a/textures/advtrains_wagon.png b/textures/advtrains_wagon.png Binary files differdeleted file mode 100644 index c37c979..0000000 --- a/textures/advtrains_wagon.png +++ /dev/null |