I have a train on a track, from the first front mover... I would *think* that if have a bit of track that I should be able to use rail.get_connected_entity{ {rail_direction=defines.rail_direction.back, rail_connection_direction=defines.rail_connection_direction.straight} ) to go through and get a linear line of track; this is not what happens, and instead it oscillates between two peices of track doing it this way....
but apparently on curves, going around a circle... I have to do direction.left or direction.right depending on the direction I'm iterating.
But worse, if I just go rail_direction.back, it will oscillate between two bits of track instead of going to the next one.
(Yes, I can store the prior track, and if the next is the same as the one I just came from, I can go the other way instead).
I added a flying-text every second at the position of each of the rails (although I do add count/2 to the x position because the first iteration was overlapping)
(1) is always white as the starting point
I color coded the other directions
red is .back, .straight
cyan is .forward, .left
blue is .back, .right
purple is .forward, .straight
(green would be backward, .left )
(yellow would be forward .right)
This first image, the train is ... in position 1. The next image, the train is moved forward a little so it's front_rail is the next rail ahead.
So; this shows me 1) .forward and .backward not not relative to the front-mover direction of the train I'm in...
and 2) forward and backward are not even a linear list.
For the purposes of this train mod, it doesn't matter a lot which direction I go, because the energy will be re-filled on the next tick anyway in either direction (except in low power conditions)...
so; the real 'request' would be...
someday I'd like to get the rails that are underneath the train, preferably in a list from first_rail to last_rail.
Or; more complex; I'd like to have something like a rail-network identifier and associated entities to that network that I could just access a power source attached somewhere along the rail; assuming there's still a path to it. (Although RailPowerSystem does also transport red/green signals and power with the rails; and they would still need something to connect to). So in this case there is a Rail_Accumulator that has kJ storage big enough for one tick of the train to run, and each rail segment has (although corners, since they are longer, should have 2) so basically the rail that each engine is one is the accumulator it should use. (again if it's on a curve, it could be 2-3 engines on the curve) it's not such a big deal for horizontal stretches.
get_connected_rail oscillates (bad title)
Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Return to “Modding interface requests”
Jump to
- General
- ↳ Releases
- ↳ News
- ↳ General discussion
- ↳ Multiplayer
- ↳ Find Servers / Tools / Guides
- ↳ Show your Creations
- ↳ Videos
- ↳ Combinator Creations
- ↳ Mechanical Throughput Magic (circuit-free)
- ↳ Railway Setups
- ↳ Energy Production
- ↳ Medium/Big/Gigantic Sized Structures
- ↳ Fan Art
- ↳ Gameplay Help
- ↳ Spread the Word
- ↳ Off topic
- ↳ This Forum
- ↳ Celebration Party
- Support
- ↳ Gameplay Help
- ↳ Discover Factorio Wiki
- ↳ Discover Others Creations
- ↳ Discover Mods
- ↳ Discover Tools Around Factorio
- ↳ Technical Help
- ↳ Bug Reports
- ↳ Resolved for the next release
- ↳ Assigned
- ↳ Not a bug
- ↳ Pending
- ↳ 1 / 0 magic
- ↳ Duplicates
- ↳ Minor issues
- ↳ Desyncs with mods
- ↳ Won't fix.
- ↳ Resolved Problems and Bugs
- Factorio Direction
- ↳ Ideas and Suggestions
- ↳ Outdated/Not implemented
- ↳ Frequently Suggested / Link Collections
- ↳ Implemented Suggestions
- ↳ Implemented in 2.0
- ↳ Development Proposals
- ↳ Balancing
- Contributions
- ↳ Mods
- ↳ Download mods
- ↳ Mod portal Discussion
- ↳ Mods
- ↳ Mod Packs / Libs / Special Interest
- ↳ 5dim's mod
- ↳ Angels Mods
- ↳ Atomic Power
- ↳ Bob's mods
- ↳ DyWorld
- ↳ F.A.R.L
- ↳ Fentus Challenge & Tool Mods
- ↳ Logistic Train Network
- ↳ MoMods
- ↳ Reika's Mods
- ↳ Resource Spawner Overhaul
- ↳ Yuoki Industries
- ↳ PyMods
- ↳ Questions, reviews and ratings
- ↳ Modding Discussions
- ↳ Modding discussion
- ↳ Modding help
- ↳ Ideas and Requests For Mods
- ↳ Modding interface requests
- ↳ Implemented mod requests
- ↳ Already exists
- ↳ Won't implement
- ↳ Documentation Improvement Requests
- ↳ Resolved Requests
- ↳ Development tools
- ↳ Tools
- ↳ Mod and installation managers
- ↳ Cheatsheets / Calculators / Viewers
- ↳ Development tools
- ↳ Special interest mods and libraries
- ↳ Modding Development
- ↳ Multiplayer / Dedicated Server
- ↳ Multiplayer Board
- ↳ Archive
- ↳ Maps and Scenarios
- ↳ Translations
- ↳ Texture Packs
- ↳ Fan Art
- ↳ Wiki Talk
- ↳ To be sorted
- ↳ Campaign / Scenario suggestions