Page 1 of 4

[0.17] LTN Combinator

Posted: Sat Mar 23, 2019 4:38 pm
by dockmeister
LTN Combinator
Adds a new type of Constant Combinators to the game. They come with a custom GUI to ease the control of LTN signals.

All LTN Signals are supported. Which signals are visible can be adjusted in the "Mod Settings" menu. Any LTN signal placed in an output slot will be visible the next time the combinator gets opened, regardless of the default visibility.
LTN Combinator uses Factorios upgrade feature. They can replace existing constant combinators while preserving all signals.
This mod also adds an new command: Use /ltncopen while hovering any LTN Combinator on the map to open and edit signals without range limitations.

Download: https://mods.factorio.com/mod/LTN_Combinator
Changelog: https://mods.factorio.com/mod/LTN_Combinator/changelog

Bug Reports or Requests are welcome and can be posted in here or in the Mod Portal.
ltn-combinator-2.png
ltn-combinator-2.png (63.62 KiB) Viewed 2096 times
Current limitations
  • Station cannot be setup as a requester and a provider at the same time
    I don't know who would do such heresy, but if it is requested i'll find a way. Meanwhile you can connect two combinators to a station
  • Output signal amounts are not shown
    Yes it's a bummer. It is not supported by the API, i am working on a workaround though.
    Output signal now shows the amount
  • Window is not draggable
    Mod GUIs aren't draggable.

Re: [0.17] LTN Combinator

Posted: Sat Mar 23, 2019 5:28 pm
by Optera
Nice helper mod for those lost in the sea of configuration signals LTN offers.

made thread sticky

Re: [0.17] LTN Combinator

Posted: Sat Mar 30, 2019 2:22 am
by mrvn
Nice start.

I frequently have stations that request fluids and provide items or vice versa. Saves a lot of rails and LTN stops. Before 0.17 this was the only good way to handle both fluids and items at the same station. So please try to support that too.

To make this perfect I would suggest 3 more features:

1) Option to specify the limit for liquids in multiples of tanks / fluid wagons

I assume setting limits for items in stacks is already support. Just not visible in the screenshot.

2) Option to specify the requested amounts in multiples of a) stacks, b) containers (chests, warehouses, ore silos, tanks, (cargo/fluid) wagons)

This would make it much easier to set the amounts for items without having to check the stack size and container size and multiplying them in your head. E.g. the plastic factory wants 2 cargo wagons of iron plates and 2 fluid wagons of butan (or whatever vanilla has there).

3) Option to specify the requested amounts as ratio for a number of containers

For example an electronic circuit factory may have 4 warehouses for LCCCC trains and wants to requests iron plates and copper plates in a ratio of 2:3.

Re: [0.17] LTN Combinator

Posted: Sat Mar 30, 2019 5:34 pm
by dockmeister
mrvn wrote:
Sat Mar 30, 2019 2:22 am
I frequently have stations that request fluids and provide items or vice versa. Saves a lot of rails and LTN stops. Before 0.17 this was the only good way to handle both fluids and items at the same station. So please try to support that too.
You're right about that. You're not the first to request such a feature - i will work on that.
mrvn wrote:
Sat Mar 30, 2019 2:22 am
1) Option to specify the limit for liquids in multiples of tanks / fluid wagons
I assume setting limits for items in stacks is already support. Just not visible in the screenshot.

2) Option to specify the requested amounts in multiples of a) stacks, b) containers (chests, warehouses, ore silos, tanks, (cargo/fluid) wagons)
Stack thresholds are supported. You can toggle the visibility in the Mod Settings.
As for the request amounts: I am reluctant to implement anything that isn't supported by LTN itself. The goal of LTN-C is to be a lightweight, remote controllable (through LTN-T) combinator with improved visibility over core LTN-signals. I do not want to alter or introduce new behaviours into LTN.
Additionally there are so many mods out there which change stack size or capacity - i fear going there would be a rabbit hole.
mrvn wrote:
Sat Mar 30, 2019 2:22 am
3) Option to specify the requested amounts as ratio for a number of containers

For example an electronic circuit factory may have 4 warehouses for LCCCC trains and wants to requests iron plates and copper plates in a ratio of 2:3.
I don't really get that point, why can't you just say: Do i have enough space for 16k copper, then bring some? Furthermore with increased complexity comes a loss in flexibility. You can still put another wire into the LTN input lamp, calculating the request amount with an arithmetic combinator.

cheers

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 2:36 am
by mrvn
dockmeister wrote:
Sat Mar 30, 2019 5:34 pm
mrvn wrote:
Sat Mar 30, 2019 2:22 am
I frequently have stations that request fluids and provide items or vice versa. Saves a lot of rails and LTN stops. Before 0.17 this was the only good way to handle both fluids and items at the same station. So please try to support that too.
You're right about that. You're not the first to request such a feature - i will work on that.
mrvn wrote:
Sat Mar 30, 2019 2:22 am
1) Option to specify the limit for liquids in multiples of tanks / fluid wagons
I assume setting limits for items in stacks is already support. Just not visible in the screenshot.

2) Option to specify the requested amounts in multiples of a) stacks, b) containers (chests, warehouses, ore silos, tanks, (cargo/fluid) wagons)
Stack thresholds are supported. You can toggle the visibility in the Mod Settings.
As for the request amounts: I am reluctant to implement anything that isn't supported by LTN itself. The goal of LTN-C is to be a lightweight, remote controllable (through LTN-T) combinator with improved visibility over core LTN-signals. I do not want to alter or introduce new behaviours into LTN.
Additionally there are so many mods out there which change stack size or capacity - i fear going there would be a rabbit hole.
mrvn wrote:
Sat Mar 30, 2019 2:22 am
3) Option to specify the requested amounts as ratio for a number of containers

For example an electronic circuit factory may have 4 warehouses for LCCCC trains and wants to requests iron plates and copper plates in a ratio of 2:3.
I don't really get that point, why can't you just say: Do i have enough space for 16k copper, then bring some? Furthermore with increased complexity comes a loss in flexibility. You can still put another wire into the LTN input lamp, calculating the request amount with an arithmetic combinator.

cheers
You hit the problem: "there are so many mods out there which change stack size or capacity".

I know I have placed 6 wooden chests. Or I placed one warehouse. But does that mean 4k copper plates will fit? Or 16k? That really depends on the mods and even changes over time.

So the idea is to set the amount in units that remain constant in the GUI and then internally the combinator can read out the stack size and container size and calculate the actual item count and set that for the internal constant combinator. There is nothing needed for LTN itself to be added. All the math would be internal to the combinator GUI.

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 6:16 am
by Optera
mrvn wrote:
Sun Mar 31, 2019 2:36 am
I know I have placed 6 wooden chests. Or I placed one warehouse. But does that mean 4k copper plates will fit? Or 16k? That really depends on the mods and even changes over time.
[sarcasm]Changing stack size or container capacity mid game is something players will do on a regular basis and mods have to take care to handle this.[/sarcasm]
Machines and production show items/s not stacks/s. Should wube also change to stack/s so you don't have to bother thinking how much buffer capacity for n seconds between trains you will need for a build?

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 10:37 am
by mrvn
Optera wrote:
Sun Mar 31, 2019 6:16 am
mrvn wrote:
Sun Mar 31, 2019 2:36 am
I know I have placed 6 wooden chests. Or I placed one warehouse. But does that mean 4k copper plates will fit? Or 16k? That really depends on the mods and even changes over time.
[sarcasm]Changing stack size or container capacity mid game is something players will do on a regular basis and mods have to take care to handle this.[/sarcasm]
Machines and production show items/s not stacks/s. Should wube also change to stack/s so you don't have to bother thinking how much buffer capacity for n seconds between trains you will need for a build?
It's crazy, I know. But over the course of a game there are factorio updates and mod updates. And hey, someone complained that iron ore has a stack size of only 100 and every bob/angles ore has a stack size of 200. So the next mod update changes iron ore stacks from 100 to 200. Now all stations requesting iron ore only request half as much in terms of train loads. Or slag has gone from stack size 200 to stack size 800. Now stations don't even request enough to exceed the 40 stacks limit and no slag is delivered at all. This stuff happens.

Comparing this to the item/s shown for machines and production is wrong. Showing stacks/s there would have no affect on the game. The numbers set for LTN stations on the other hand greatly affect the game. And yes, I do have problems remembering the stack size of all 200+ items, the number of slots of 8 different cargo wagons and 8 different fluid wagons and multiplying both of those with the length of the train (1-8). I also can't remember what networks 537133072 is in. [sarcasm]Simple math. Isn't that something computers are good at?[/sarcasm].

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 11:03 am
by mrvn
19.378 Mods to disable:Failed to load mods: Error while running setup for entity prototype "crafting_combinator_FML_blueprint-data-prototype_entity" (constant-combinator): next_upgrade target (ltn-combinator) must have the same grid alignment (bounding boxes aren't compatible or tile_width/tile_height aren't compatible).

Looks like there is an incompatibility with crafting_combinator_0.9.12.

Update: The selection box seems to be different. But even when I change that to (-0.5, -0.5), (0.5, 0.5) so they match the error remains. Removing then "next_upgrade" fixes the error and fast replace seems to still work. Why do you need to set "next_upgrade"? Maybe set that in data-final-changes.lua so other mods inheriting from constant-combinator don't also inherit the next_upgrade field.

Odd behavior with provider signals in requester

Posted: Sun Mar 31, 2019 11:57 am
by mrvn
I tried making a requster/provider station simply by adding the provider symbols manually to the ltn-combinator in requester mode. But the behavior is really strange there.
ltn-combinator.png
ltn-combinator.png (176.52 KiB) Viewed 1910 times
As you can see I've set all 3 provider settings in the ltn-combinator. But when I close the combinator and hover over it with the mouse somehow the previous setting (23) for the provider limit gets added to the new value. Opening the combinator again doesn't show any of the provider settings. In other cases the provider stack limit and provider priority value would disappear when closing the combinator but the provider limit remain.

I would get it if they all remain as set or all disappear but this random behavior seems odd.


Another bug seems to be that "Locked Slots per wagon" is not displayed. I activate that in the mod settings.

Anyway, I will simply use 2 ltn-combinators to make a requester/provider station for now. Just have to be careful to set the network ID and train limits to 0 in one of them.

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 12:05 pm
by mrvn
Just spotted another problem. The Encoded Network ID is shown as -1 in the GUI but no -1 is emitted by the combinator. I figure you use -1 for not set. But why not leave that as 0 in the GUI?

More problematic the values are limited to -1 - 2,000,000,000. But a train that should go to all but network 1 would be 4,294,967,294. All values between 0 and 2^32-1 should be allowed. Preferably would be some widget that shows the bits or a hexadecimal number. Base 10 integers are not good at showing the encoded networks.

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 12:48 pm
by dockmeister
Hi,

1. Capacity:
There is no easy way for me to figure out, how much capacity a station has. I would need to iterate over the connected circuit network every time an entity is placed and check if its connected. There is also no event that triggers upon "circuit network wires dis-/connected". I probably would have to use "OnTick" and i am not willing to do that.

2. Stack sizes:
Stack sizes are already supported by LTN. The dispatcher reads the currently configured stack size for an item. You just need to use Stack Threshold. Applying the request amount in Stack Amounts might be something i look into. My first gut feeling is however, that it would help 5% of users and confuse the rest.

3. Locked slots per Wagon:
Locked slots is a Provider only signal. I doesn't have any effect on Requester stations, so its working as intended.

4. Crafting Combinator:
CC is not updated for 0.17 and i am not entirely sure, if LTN-C is at fault regarding the error message. So i will ignore it for now, but i will keep it in mind and check again if and when CC is updated.

5. Provider & Requester at the same time:
Since LTN-C does not support Requesting and Providing at the same time, it is confusing.
I will work on that. My current idea is to replace Radiobuttons with Checkboxes and filter the visible inputs accordingly.

6. Encoded network id:
LTN-C removes any signals with default values (exception: thresholds), in case of the network id it's -1. The same behaviour occurs with train limits, disable warnings and priorities. The latter don't cause confusion since the default value is 0.
I agree that network id is not entirely clear - i'll look into that.

7. Network id bounds:
It is on my TODO list. I also thought about a widget, with toggable networks, but factorio does not allow free flowing widgets.

cheers

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 1:44 pm
by Optera
mrvn wrote:
Sun Mar 31, 2019 12:05 pm
Just spotted another problem. The Encoded Network ID is shown as -1 in the GUI but no -1 is emitted by the combinator. I figure you use -1 for not set. But why not leave that as 0 in the GUI?

More problematic the values are limited to -1 - 2,000,000,000. But a train that should go to all but network 1 would be 4,294,967,294. All values between 0 and 2^32-1 should be allowed. Preferably would be some widget that shows the bits or a hexadecimal number. Base 10 integers are not good at showing the encoded networks.
All values between −2,147,483,648 (−2^31) and 2,147,483,647 (2^31 − 1) must be allowed to set all possible 32 bits.
0 is the only bit combination that makes no sense to LTN since a stop can't be in no network.

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 1:49 pm
by eduran
mrvn wrote:
Sun Mar 31, 2019 12:05 pm
More problematic the values are limited to -1 - 2,000,000,000. But a train that should go to all but network 1 would be 4,294,967,294. All values between 0 and 2^32-1 should be allowed.
dockmeister wrote:
Sun Mar 31, 2019 12:48 pm
7. Network id bounds:
It is on my TODO list. I also thought about a widget, with toggable networks, but factorio does not allow free flowing widgets.
Circuit network signals are signed 32-bit integers. The maximum value is therefore 2^31 = 2147483648. Values between 2^31 and 2^32 are shifted to negative range. So -1 is equivalent to 2^32-1 and "all networks except 1" is encoded network ID -2.

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 3:46 pm
by mrvn
Optera wrote:
Sun Mar 31, 2019 1:44 pm
mrvn wrote:
Sun Mar 31, 2019 12:05 pm
Just spotted another problem. The Encoded Network ID is shown as -1 in the GUI but no -1 is emitted by the combinator. I figure you use -1 for not set. But why not leave that as 0 in the GUI?

More problematic the values are limited to -1 - 2,000,000,000. But a train that should go to all but network 1 would be 4,294,967,294. All values between 0 and 2^32-1 should be allowed. Preferably would be some widget that shows the bits or a hexadecimal number. Base 10 integers are not good at showing the encoded networks.
All values between −2,147,483,648 (−2^31) and 2,147,483,647 (2^31 − 1) must be allowed to set all possible 32 bits.
0 is the only bit combination that makes no sense to LTN since a stop can't be in no network.
eduran wrote:
Sun Mar 31, 2019 1:49 pm
mrvn wrote:
Sun Mar 31, 2019 12:05 pm
More problematic the values are limited to -1 - 2,000,000,000. But a train that should go to all but network 1 would be 4,294,967,294. All values between 0 and 2^32-1 should be allowed.
dockmeister wrote:
Sun Mar 31, 2019 12:48 pm
7. Network id bounds:
It is on my TODO list. I also thought about a widget, with toggable networks, but factorio does not allow free flowing widgets.
Circuit network signals are signed 32-bit integers. The maximum value is therefore 2^31 = 2147483648. Values between 2^31 and 2^32 are shifted to negative range. So -1 is equivalent to 2^32-1 and "all networks except 1" is encoded network ID -2.
Factorio is happy to convert values larger than 2,147,483,647 to their 32 bit signed form and I sure hope the GUI would convert negative numbers back to 32bit unsigned. Having to input network IDs as negatives to get the highest bit set would be silly. Remember we are talking only about the frontend to the user. Not what value is used internally. Look at my example: All but network 1 means internally -2 is set. See how confusing that is to the average user?


I'm not sure why you need a free flowing widget for the network ID. I would think a static grid (or table) with 8x4 buttons that you can toggle on and off would be quite useful. Maybe below that a text field with the hexadecimal value for easy cut&paste. I've seen other mods use tables so they are possible.

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 4:15 pm
by eduran
mrvn wrote:
Sun Mar 31, 2019 3:46 pm
Factorio is happy to convert values larger than 2,147,483,647 to their 32 bit signed form and I sure hope the GUI would convert negative numbers back to 32bit unsigned. Having to input network IDs as negatives to get the highest bit set would be silly. Remember we are talking only about the frontend to the user. Not what value is used internally. Look at my example: All but network 1 means internally -2 is set. See how confusing that is to the average user?
Very confusing (hence the sticky about encoded network ID). But 4,294,967,294 does not make it less confusing. And if you mouse over a power pole connected to a CC set to that value you will actually see -2. Even more confusion to follow.

That said, I agree that the LTNC UI should allow the same values as a normal constant combinator, i.e. any integer. And something like 8x4 check boxes to select network ID would be fantastic.

Re: [0.17] LTN Combinator

Posted: Sun Mar 31, 2019 11:08 pm
by nuhll
Just incase you didnt see it on mod portal (for me notifications are not working)

https://mods.factorio.com/mod/LTN_Combi ... 000c12d110

If i disable your mod, all my mods including these 2 are working just fine.

Re: [0.17] LTN Combinator

Posted: Mon Apr 01, 2019 12:06 pm
by dockmeister
nuhll wrote:
Sun Mar 31, 2019 11:08 pm
Just incase you didnt see it on mod portal (for me notifications are not working)
I do receive notifications if someone post on the Mod Portal. I replied there.

cheers

Re: [0.17] LTN Combinator

Posted: Mon Apr 01, 2019 5:49 pm
by Oaquasis
Hi,

I keep getting this error: "LTN-Combinator: Player # 1 is not initialized. Please report this message to the author."
It happens whenever I click on a LTN-Combinator. I'm playing a multiplayer game with the latest addon versions (LTN, LTN Tracker and LTN-Combinator)
There isn't any additional information in the logs. Am I doing something wrong?

Image

Re: [0.17] LTN Combinator

Posted: Mon Apr 01, 2019 6:25 pm
by dockmeister
Oaquasis wrote:
Mon Apr 01, 2019 5:49 pm
I keep getting this error: "LTN-Combinator: Player # 1 is not initialized. Please report this message to the author."
It happens whenever I click on a LTN-Combinator. I'm playing a multiplayer game with the latest addon versions (LTN, LTN Tracker and LTN-Combinator)
There isn't any additional information in the logs. Am I doing something wrong?
I don't think you did something wrong, i had this error report before (thread in the mod portal). I am still unable to reproduce it.

Does it happen, when you load LTN-C as a new Mod into an existing savegame? Does it happen, when you start a new game?

cheers

Re: [0.17] LTN Combinator

Posted: Mon Apr 01, 2019 7:04 pm
by eduran
Oaquasis wrote:
Mon Apr 01, 2019 5:49 pm
I keep getting this error: "LTN-Combinator: Player # 1 is not initialized. Please report this message to the author."
Is this error-message shown when some UI element is invalid? If so, I think you have to start working around that issue by rebuilding your UI whenever this error occurs.
Background: I've had errors like that reported about LTNT quite a few times. My suspicion is that some mods call clear() on root UI elements when they want to clear their own UI. Since all mods have access to all modded UI elements, that also deletes your UI. Problem is, you only notice it when someone clicks your combinator. By that time it is near impossible to figure out when and how the UI got deleted. I am still hoping for a report were only a few other mods are involved. But so far, these cases always had 50+ mods active and I am not going to wade through all that code to find the culprit(s).