Kuxynator's Smart Linked Chests


Alternate expandable Crashsite Logistic using smart linked chests. - UPS optimized logistic for mass transport - tries to be not overpowered as the (hidden) native linked chest. - highly configurable

Content
4 months ago
1.1
365
Logistics Storage

b Incompatibility with Krastorio 2

3 months ago
(updated 3 months ago)

Edit: Apologies, the title should say Incompatibility between Krastorio 2, Factorissimo, and this mod. I accidentally mixed up some earlier testing notes.

This is very specific and the error itself says don't bother, so I'm sure this is low or priority or not on the radar at all, but I wound up killing 45 minutes tracking down what was going on, so I figured I might as well report it anyway. Maybe it'll be useful in the future. 🤷

With the following Modlist:
Base Mod
Editor Extensions (to cheat in a factory)
Factorissimo 2 (notnotmelon fork)
Krastorio 2
Kuxynator's Smart Linked Chests

Plus their dependencies (flib, k2 assets, kuxy's core lib, fslib)

Placing any Factorissimo Factory will generate the following error even on a new game with no placed smart chests.

Entity is not a known factory.
Factorissimo get_factory_by_entity returns nil.
I can not initialize smart linked chests.

You don't need to report this. I apologize, but there is nothing I can do.
The cause lies outside this mod.
May be removing some other mods could help.

stack traceback:
    __Kux-SmartLinkedChests__/modules/Chest.lua:210: in function 'on_built_factory'
    __Kux-SmartLinkedChests__/events/on_built_entity.lua:13: in function 'fnc'
    __Kux-CoreLib__/lib/EventDistributor.lua:188: in function 'fnc'
    __Kux-CoreLib__/lib/EventDistributor.lua:157: in function <__Kux-CoreLib__/lib/EventDistributor.lua:151>
----------------------------------------
Kux-SmartLinkedChests v2.0.14
Kux-CoreLib v2.11.0
----------------------------------------
Steps to reproduce:
...describe which steps you have done before...
3 months ago

Have you read the text of the message? I have already written everything.
I can only give you moral support.

You have not described how this error occurs.
- Where did you build the chest/building?
- Can you repeat the steps?
- Why do you have to do it this way? Can you avoid doing it again?

3 months ago
(updated 3 months ago)

I apologize, but if it seems like I have not given you the details, it is because no further details are necessary. I have provided you with the details of when this happens. There are no other conditions that limit when this occurs. I mean to say that this happens under absolutely all circumstances for any reason.

It seems I was not clear, so I will elaborate. With those mods installed (Krastorio 2, Factorissimo 2, Smart Linked Chests), placing any Factorissimo factory will cause this error. This happens at the beginning of the game, in the middle of the game, at the end of the game, on any surface, in any place, at any time, whenever any Factory building is placed.

Small Factories, Medium Factories, and Large Factories all do this. This happens even when there are no chests or, in fact, any items in the entire game placed anywhere at all for any reason in a brand-new game with nothing going on. I have repeated the steps well over thirty times while reloading my game for hours to effectively narrow it down to that one minimum set of mods that causes the problem. This bug is perfectly consistent and replicable in my experience. I have to do it this way because there is no way to use the mod Factorissimo that does not involve placing Factory buildings on the ground somewhere.

It does not appear to relate to any settings that I have set in anything because resetting all three mods to default settings makes no change.

In the meantime, I have played well over 16 hours of a game where this is occurring out of curiosity and discovered that the presence of the error does not appear to correlate to any sort of functional problem in the experience. It's still possible to place Surface Linked Chests inside the factory and link them to things on the parent surface, the error simply repeats once per placed Factory building. Crossing three thousand chests I have not found any indication of performance issues or other problems. Also of note is that the error will reoccur if an occupied Factory is picked up and replaced or moved, which I believe indicates that it's a problem with the way the link is established between the two surfaces and not the generation of a new area on the Factorissimo surface.

Edit: Also to be especially clear, the error will happen every time a Factory building is placed and the parent surface is linked to the Factorissimo 2 surface, regardless of the presence of any Smart Linked Chests anywhere in the world. The error is only associated with the placement of the Factory, and does not reoccur when linked chests are placed around or inside or anywhere else.

3 months ago
(updated 3 months ago)

Well, I've been testing all this with Factorissimo for a while now and as I play, I've never encountered an error.
The error message you are getting is just an expected message that I had implemented when I integrated the Factorissimo Remote API and that should never occur and never did. I can't tell you why the error only occurs for your setup.
When a new factory is placed, I need to know which one it is and therefore I call get_factory_by_entity of the Factorissimo API but get no result. and therefore cannot make any calculations for the chests, which is necessary. therefore an error is raised, because otherwise all affected chests would have invalid data, which would lead to further errors.
I can only try to find out if I can find a workaround in a game where the error occurs. Can you provide me a saved game?

EDIT
You dont need to provide a save game. with then current version of Krastorio 2 I get the same warning.
But there is nothing what I can do. in my code
- I get the event on_built_entity
- my Chest module calls remote.call('factorissimo', 'get_factory_by_entity', entity)
- because i get no result, i write to my log >> entity is not a factory. {name = "factory-1", type = "storage-tank"}
- and shows the warning

if I remove Krastorio, all works as expected und no warning occurs.
I can not change Krastorio und I can also not change Factorissimo.
I can only write to the author of Factorissimo if he knows a reason why the function does not return a result. But that will also be difficult, because it works without Krastorio.

In the meantime:
You can continue playing after this warning.
There will be no problems as long as there is no chest in the building (I can't check this because of the missing result)
However, if there are already chests in the building, they will not work properly. In this case you could try a rescan (command), see settings for the correct name. "rescan-smart-linked-chests" by default. This will repair all chests. I can not do this on each event on_built_entity , because it is time consuming.

3 months ago

Yeah, it's super freaking weird. I dug into the code of everything going on here and then pored over Krastorio to see what it could possibly be doing to cause this, and I can't find anything. Notnotmelon might know and seems active enough on their Discord server, but it's definitely weird.

And yeah, the actual result of the error seems like it would be problematic for chests that rely on measuring proximity, but it seems to cause no issues with surface chests.

Basically I just dismiss the message, close the error, and then dismiss the message again. It's mildly inconvenient, but hardly the end of the world.

New response