Lignumis


Dive into the world of Lignumis, a moon of Nauvis offering only the most basic technologies.

Content
a day ago
2.0 - 2.1
28.0K
Factorio: Space Age Icon Space Age Mod
Planets Logistics Environment Mining Fluids Manufacturing

i ✅ load-balancers compat

13 days ago

Hi! Since https://mods.factorio.com/mod/lane-splitters seems a bit passive and I wanted to use the lane splitter, I installed that guy https://mods.factorio.com/mod/lane-balancers. Not terribly active, either, but at least it's 2.1 and has way more downloads, I guess that's the way to go nowadays.

So I thought maybe Lignumis could add compatibility for lane-balancers, since you already got it for lane-splitters? I tinkered around a bit and it wasn't too complicated (of course, I could be missing some side effects), luckily lane-balancers provides a public interface for creating new objects similar as lane-splitters does.

I wanted to open a PR in your Git so you could have a look at it and use it if you wanted to, but regrettably, it seems I cannot register there (I'm not getting an e-mail).

So if you're interested, either you find the time to fix your Git site :-) so I can provide you the code there via PR, or point me to somewhere else I can send it to you. Or I can post it here in the message board if you want, it's similar to the compatibility for lane-splitters, some 40 lines (and the glue in info.json and /prototypes/compatibility/data.lua obviously).

I decided to start a new game for 2.1, so I'm looking forward to experience Lignumis again. :-) Thanks for your work!

13 days ago

I activated your account and you should be able to log in now. Of course a PR is easiest for me so feel free to create one. The problem lies rather in the mail server than in the git server. I'll have a look at it soon.

13 days ago
(updated 13 days ago)
2 days ago
(updated 2 days ago)

for reference - with load-balancers, I STILL got the copper cable as ingredient for wood-lane-splitter introduced by wood-logistics. I pretty much copied it from your implementation for the mod lane-splitter, and for the life of me I couldn't figure out why it wasn't replaced with basic circuit board.

Then I couldn't even figure out why for the mod lane-splitters (which I quick-hacked to 2.1, just info.json and some category->categories business), your wood-splitter as well as wood-lane-splitter had copper cables replaced by basic circuit board.

Finally with the help of AI, I found this in mod lane-splitter's prototypes/entity/entities.lua, where the lane-splitters are generated:

  local recipe = {
    type = "recipe",
    name = config.name,
    enabled = false,
    energy_required = 1,
    category = data.raw["recipe"][config.base_splitter].category,
    ingredients = data.raw["recipe"][config.base_splitter].ingredients,
    results = {{type="item", name=config.name, amount=1}}
  }

Turns out, this is really, really bad, because since they don't do a deep copy of the ingredients, they pass the reference to the ingredients for wood-splitter to wood-lane-splitter. And when you set this for the wood-splitter https://git.cacklingfiend.info/cacklingfiend/lignumis/src/commit/753803096ca40a9b99cac30addc276998da8c9fd/lignumis/prototypes/compatibility/wood-logistics.lua#L102, it implicitly sets the ingredients for wood-lane-splitter, too. Which is why I couldn't find the magic why wood-lane-splitter has its copper cables replaced, since the assignment to ingredients by reference didn't catch my eye when looking at the code. And I didn't even know that this is what would happen, wouldn't have caught it without AI.

I really wonder whether you were aware of this or if it just worked silently with your code and you didn't bother to check it (for which you would have no apparent reason, so would be 100% understandable :-).

However, because lane-balancers does indeed make a deep copy, that's the reason for this: https://git.cacklingfiend.info/cacklingfiend/lignumis/src/commit/753803096ca40a9b99cac30addc276998da8c9fd/lignumis/prototypes/compatibility/wood-logistics.lua#L126 making the replacement explicit. Doesn't matter for mod line-splitter (if it ever will be upgraded to 2.1), the ingredients to both wood-splitter and wood-lane-splitter is replaced twice, but your code in cf-lib guards against errors resulting from this.

Thanks for merging - I really hope I caught all subtleties...

2 days ago

ah and I've noticed, default_import_location for your wood logistic items is not set when wood-logistics is not present and you introduce them yourself, but I think that's not a great issue, probably nobody imports wood logistic items when they're flying around in space platforms... :-)

"probably nobody imports wood logistic items when they're flying around in space platforms"
This. I never noticed.

I merged your PR. Release is coming.

a day ago

:-) thanks a lot!

New response