Renai Transportation


Se~no to traditional belts and tiresome walking with these ridiculous ways to transport items and yourself around your factory. Features: Thrower inserters, train ramps, player launchers, bounce pads, ziplines, and more

Content
4 months ago
0.18 - 1.1
33.9K
Transportation Logistics Trains

b Wagon metadata not restored after landing [1/2 fixed βœ…]

3 years ago

Just tried out your mod today, and it is a very fun concept to build "jumptions" instead of junctions, or instead of destroying cliffs :D Though it seems I've came to problems with jumping trains.

I have a heavily modded map, and my locomotives have equipment grid modules in them. Besides that, I also have 2 vehicle wagons. The problem is that after the train lands wagons lose metadata, like equipment grid modules and vehicles loaded onto the vehicle wagons.

Here is my map on which you can see what happens: https://1drv.ms/u/s!ArvLKxtjzZnrv8la-gwwVNkwp29geQ?e=hP0gEC
After loading the map, you can check that the locomotives have modules in them. If you set the train to automatic mode, it will start going towards the ramp, and after it landed and stopped you can see that the modules have been cleared.
A similar thing happens with the 2 vehicle wagons: if you try to unload them, the mod will tell you that no vehicle data was found in the wagon

3 years ago

idk much about hooking into the systems of other mods so that sounds very tricky since each mod probably handles their own carriages differently, if you happen to know any info or tips on how to do so I'd love to try it and make the mod more fun for you and everyone 😎

3 years ago

Unfortunately I don't know much about Lua or the Factorio API, so I might not be of much help here :/
I'll try to look into the Factorio API though to see if I have an idea for special carriages.

Though Robot256's solution could work for the saving and restoring of the equipment grid, or maybe even more. This is a method in their public modding library, although for replacing of carriages instead of copying, but it could be of help to you: https://github.com/robot256/Robot256Lib/blob/f9ddbbdca604cd689823ed9ef95fd5b3db3a5ce8/script/carriage_replacement.lua#L28
The method actually doing the saving of the grid is here: https://github.com/robot256/Robot256Lib/blob/f9ddbbdca604cd689823ed9ef95fd5b3db3a5ce8/script/save_restore.lua#L292

Actually, looking at the documentation is a bit harder to understand what's happening, but Robot256's code is really easy to understand. I think I might find a solution for the custom carriages easier if I grab a debugger and see the actual values that a carriage holds, like the vehicle wagon.

3 years ago

Vehicle grid size is just a prototype property for all vehicles, so all mods should handle it the same way.

I'm sure that if you make it support one train with a grid, it will support all

3 years ago

Yes, I didn't know equipment grids were a standardized thing. Once I knew that I was able to work out a quick fix and I just uploaded 0.4.6 which should have equipment grids carrying over for any train carriage. Unfortunately I couldn't find a solution for vehicle wagons yet. From what I could tell, the data of the vehicle loaded on the wagons isn't attached to the wagon entity itself, but in that mod's "personal" data bank of global variables, which I don't know how/if I can access.

3 years ago

Yes, I didn't know equipment grids were a standardized thing. Once I knew that I was able to work out a quick fix and I just uploaded 0.4.6 which should have equipment grids carrying over for any train carriage. Unfortunately I couldn't find a solution for vehicle wagons yet. From what I could tell, the data of the vehicle loaded on the wagons isn't attached to the wagon entity itself, but in that mod's "personal" data bank of global variables, which I don't know how/if I can access.

You may not need to access the mod's own database, but only restore the links/ids. As a mod developer can you see properties in an object that were put there by an other mod? Like you know that the official properties are there, because they are in the documentation, but can you do operations on the ones that were put there by mods, like log their values, and can you see them in a debugger?

3 years ago
(updated 3 years ago)

I'm not super experienced with programming but as far as I can tell it's like this: trains and carriages run around in Factorio and my mod can only interact with them the ways Factorio allows. There are only certain properties I can read/write and adjust about the trains like color, speed, and cargo. Anything else I want to note or remember about the train I have to write it in my mod's "personal notebook" then read from it later. Vehicle Wagon 2 has its own notebook where it writes "I'm keeping vehicle A on wagon B" which would be that ID link you're talking about. But I can't see or rewrite those links because it's not "my notebook" and that link is in the notebook and not stored on the actual train. THe only way is if me and Vehicle Wagon's author collaborate and specifically add communication between specifically our mods.

New response