Single Train Unit


Adds a single train unit that is the standard length, but include storage and can travel in both directions

Content
1 year, 4 months ago
1.0 - 1.1
1.39K
Trains

g data-final-fixes

3 years ago

I was curious why Multiple Unit Train Control ignores this mod. I found the reason is that Single Train Unit adds all new entities in data-final-fixes. MUTC runs in data-updates to detect all locomotives added in data.lua. According to the Factorio modding convention, it's good practice to only create entities in data.lua, or data-updates.lua if they depend on other entities. data-final-fixes is generally reserved for altering parameters of existing entities and recipes. Adding entities there will mean most mods that alter behavior and balance will not know they exist.

In the case of MUTC, it creates the "MU version" in data-updates so that dependencies are not needed to detect locos added by other mods in data.lua. If locos are added in data-updates, I add a hidden optional dependency on that mod so that MUTC data-updates runs after that mod. I would strongly suggest you do the same, moving your entity creation to data or data-updates and adding optional dependencies as needed. Then I will add any "single_train_unit-" locos to the MUTC blacklist.

3 years ago
(updated 3 years ago)

MUTC ignored this mod's entities even when I did it in normal data, which is the desired behaviour. As the concept of MUTC doesn't apply to this mod. Plus if you rotate or recreate the entity parts in a single train unit you will break this mod. For this reason I don't raise the entity created script event by design at present as its likely to do more harm than good.

I did the creation in data originally, but some of the mods I recently added compatibility with only add and change vanilla prototypes in the update and final stages. This is the simplest way for me to support them as I'm not going through rehashing my code to do the same thing 3 times just to handle all their random crap. P.S. I am fully aware of the convention and have decided to internally break it.
Should any mod want to modify this mods prototypes it can just put this mod as a dependency and so run after its data-final-fixes.

3 years ago

Hmm that section of my readme isn't layed out the best. Will update later to make it clear it's world's as expected in doing nothing.

3 years ago

Okay thanks for explaining it clearly.

New response