Mini Machines Mod

by Kryzeth

Miniature versions of assemblers, electric furnaces, etc. Full integration with all of Bobs mods and ShinyBobGFX/ShinyAngelGFX, Industrial Revolution, Factorio Extended Plus (FXP), Gotlag's Electric Furnaces, AAI Industry, Fantario, and One More Tier. (independently, not necessarily simultaneously)

Content
2 days ago
0.13 - 2.0
12.0K
Manufacturing

i [Implemented] Let other mods balance machines

9 months ago

Hello. I'm working on a beacon mod which I would like to be compatible with everything. I've been thinking about how this mod as well as your Micro Machines Mod might be made compatible in a programmatic way and think I've come up with a decent solution if you're interested:

Let other mods create and balance whatever entities your mods would normally create. You could check if the entity already exists, and do nothing if it does. If it doesn't exist, then you'd just continue as normal.

If you wanted to make it easier on other mods, you could add more complexity to your end by handling specific non-balance things if the entity already exists such as changing the dimensions to 2x2 or adjusting the item icon. But that would be more than necessary. I wouldn't mind handling all of that on my end.

9 months ago

Hm, if I'm following you correctly, you're just asking for my mods to basically.. step out of the way, when your mod is enabled? I can definitely add a check for your mod, that disables any beacon creation/balancing that my mod would have done, if you mean to handle all of the mini/micro beacon processing on your side (presumably only when mini/micro is detected alongside yours?).

As for doing it in general, with any other mod that wants to do the same... it should be possible to do the checks as you say, though I doubt any other mods would actually be willing to do the mini machine handling on their end, as opposed to just letting my mod handle it. Would definitely make things easier for me lol.

Implemented v8.0.14 (and micro machines v2.0.10), hopefully it should allow other mods to make mini machines before data-final-fixes, and my mod should theoretically skip handling them.

9 months ago

That's essentially it, yeah. I appreciate you working on this so quickly, but it seems everything still gets overwritten for me. Not sure why yet.

9 months ago

Ohh, I think I know what I forgot. Should be fixed with the latest updates (v8.0.15 and v2.0.10)

9 months ago

Nice, that fixed it! Time to do some balance testing.

9 months ago

So I've had more time to test this and it seems I spoke too soon earlier. If both bob's modules and 5dim's modules are loaded together, the micro beacons of tier 4 or higher are fixed and will use whatever versions I create, but the lower tiers won't. Other mod combinations such as FE+ and 5dim's or 5dim's alone result in the tier 4+ micro beacons being replaced by yours. As for the mini beacons, your versions are still used regardless of tier or mod combination.

9 months ago
(updated 9 months ago)

I think I see what messed up this time; try replacing the func.lua of each mod with these ones: mini and micro
(since I'd like to avoiding making any further unnecessary uploads to the mod portal, until we know for sure everything is completely working, and I kinda get the feeling I might have to do something further to make sure the relevant mini technologies aren't modified either)

9 months ago

I get an access denied message when trying to use those links, could you make the documents available to anyone with the link?

9 months ago

Everything seems to be working as expected now except for technologies. I didn't adjust those at all, so I would expect them to either be the same as they normally are without my mod or for them to not exist. Instead, the mini/micro beacons seem to treat the "Automation" technology as the requirement for the original full-sized beacons and are either unlocked with it (if the tech tree setting is disabled) or their technologies are added after it (if that setting is enabled)

9 months ago

Ahh, yup, that sounds exactly like my tech tree code at work. During the mini-machine creation process, I set a "base_machine" flag in each mini machine recipe that is used to locate its origin technology, and to make a new technology that requires that origin tech (after copying and changing some of its properties). But if something went wrong, and the "base_machine" field was invalid or not set, then I had the default "automation" tech as a failsafe, so that it at least wouldn't crash the game.
The technology functions and the mini-machine creation functions are entirely decoupled, and the tech functions just assume that if a certain mini-machine exists, then it should do technology stuff. I think I should be able to change this default "automation" handling, so that it skips the machine instead. Just added them to the micro and mini folders that I shared above

Honestly, the mini machines codebase is in dire need of a rewrite; it's been getting more and more bloated, and the more I work on it, the more I realize how horribly inefficient most of it is, especially when dealing with other mods. Of course, I couldn't have predicted that another mod would want to handle its own mini machines instead, but it's still rather... spaghetti-fied

9 months ago
(updated 9 months ago)

Oh, and if you wanted my mod to continue handling the technology side of things, you could easily add the "base_machine" property when creating your mini/micro recipes, and then it should follow my mod's logic as normal, creating the technologies in a more sensible manner. Though I'm not sure if your mod has more than just the base mini/micro beacon, and if you added more, those would not get handled, unless they were all in the "mini-beacon-x" format

9 months ago

That "base_machine" field is great! I was kind of dreading adding 2 different technology systems for these new beacons, but now it just takes 1 line on my part. So nice.

Now that you mention it, custom fields kinda seem perfect for this sort of reverse mod compatibility. I had forgotten we can even make those. You could potentially have a few choice fields corresponding to the major prototype fields so that other mods can just change those and let your mod handle the rest. Not that I'm asking for that! I'm just glad your mods work with mine now and I won't have to disable the beacon setting when they're used together.

I've been in similar situations with my own code projects in the past with scope/feature creep. It feels great to finish refactoring things, but it can be difficult to motivate myself to start doing that.

9 months ago
(updated 9 months ago)

Hehe, I always thought it was a pretty "hacky" way to do it, but it definitely simplified the technology side of the code for me; glad to see that it can work for you too! But yes, that sounds pretty great to me; I'm kind of excited to try out your mod and see what it's like!

I've already done a couple of major rewrites before, including once already for this mod (to incorporate some nifty code that made the entity resizing way simpler), and twice for one of my other mods (Reverse Factory). It's definitely a daunting task, but knowing that it will be so much cleaner on the other side, and easier to work with makes it so worth it lol.

That being said, I'm sort of waiting for the Factorio 2.0 update to release before doing any major code modifications though, so I can just do it all at once (since I'm almost positive something will break in at least some, if not all, of my mods)

New response