Page 2 of 3

Re: Threshold and Stack Threshold

Posted: Mon May 24, 2021 12:18 pm
by nuhll
Ive made a picture to show what i mean. sorry for my paint skills.

Would it possible for LTN to strip the [itemname blablabla] and just show the items like vanilla does?

maybe as an option atleast?
1.png
1.png (4.9 MiB) Viewed 5053 times
---->
2.png
2.png (4.19 MiB) Viewed 5053 times

Re: Threshold and Stack Threshold

Posted: Tue May 25, 2021 7:39 pm
by Optera
viewtopic.php?f=214&t=82823
Optera wrote:
Sun Nov 29, 2020 2:27 pm
LTN will use the same format as in game chat.
If you want images only use the img= format when naming stops.

Re: Threshold and Stack Threshold

Posted: Sun Jun 20, 2021 11:54 am
by nuhll
Thanks.

So i guess i have to manually write and know the english names of the items instead of picking it from the "image" selector on the right... :roll: I always selected the items there.

edit:
youre right that works. As always as complicated as possible. :roll:

Re: Threshold and Stack Threshold

Posted: Mon Jun 21, 2021 2:01 pm
by Optera
As always, there's a mod for that: https://mods.factorio.com/mod/Rich_Text_Helper
However i just used a script to replace all item= with img=item/ : viewtopic.php?p=537888#p537888

Re: Threshold and Stack Threshold

Posted: Mon Aug 23, 2021 11:27 pm
by mrvn
Optera wrote:
Mon Jun 21, 2021 2:01 pm
As always, there's a mod for that: https://mods.factorio.com/mod/Rich_Text_Helper
However i just used a script to replace all item= with img=item/ : viewtopic.php?p=537888#p537888
I can't remember but is there an event when a station gets named that could do that replacement automatically?

Re: Threshold and Stack Threshold

Posted: Sat Aug 28, 2021 11:39 am
by Optera
mrvn wrote:
Mon Aug 23, 2021 11:27 pm
Optera wrote:
Mon Jun 21, 2021 2:01 pm
As always, there's a mod for that: https://mods.factorio.com/mod/Rich_Text_Helper
However i just used a script to replace all item= with img=item/ : viewtopic.php?p=537888#p537888
I can't remember but is there an event when a station gets named that could do that replacement automatically?
To work properly a script would have to hook into all build events and on_entity_renamed

Re: Threshold and Stack Threshold

Posted: Sat Aug 28, 2021 2:47 pm
by mrvn
Optera wrote:
Sat Aug 28, 2021 11:39 am
mrvn wrote:
Mon Aug 23, 2021 11:27 pm
Optera wrote:
Mon Jun 21, 2021 2:01 pm
As always, there's a mod for that: https://mods.factorio.com/mod/Rich_Text_Helper
However i just used a script to replace all item= with img=item/ : viewtopic.php?p=537888#p537888
I can't remember but is there an event when a station gets named that could do that replacement automatically?
To work properly a script would have to hook into all build events and on_entity_renamed
Why build events actually? Building a new station from scratch will never get icons in the name. And when blueprinting the name in the blueprint should already be fixed (ignoring migration issues). I think I will try adding an on_entity_renamed later tonight with your replace script and see how well that works. Anyway, getting off-topic here.

Re: Threshold and Stack Threshold

Posted: Sun Sep 05, 2021 6:09 am
by ssilk
It will get icons, if you - for example - just copy a station. Station name is copied, if that had icons in its name it will have icons, too.

Re: Threshold and Stack Threshold

Posted: Sun Sep 05, 2021 10:10 am
by mrvn
ssilk wrote:
Sun Sep 05, 2021 6:09 am
It will get icons, if you - for example - just copy a station. Station name is copied, if that had icons in its name it will have icons, too.
Sure. but assuming you always played with the script hooked into on_entity_renamed then the name you copy will already have the icons renamed properly. So on copy you don't have to fix them again. That's all I'm saying.

Re: Threshold and Stack Threshold

Posted: Fri Nov 05, 2021 10:22 pm
by chugin_iv
Feature request: is it possible to make global mod setting for default stack threshold instead of default item threshold?

Or even better, if the default (stack) theshold could be set to full train capacity, so by default only ever move full trains of cargo, and whoever wherever needs something different can set circuit signals accordingly.

Re: Threshold and Stack Threshold

Posted: Fri Nov 05, 2021 11:01 pm
by mrvn
chugin_iv wrote:
Fri Nov 05, 2021 10:22 pm
Feature request: is it possible to make global mod setting for default stack threshold instead of default item threshold?

Or even better, if the default (stack) theshold could be set to full train capacity, so by default only ever move full trains of cargo, and whoever wherever needs something different can set circuit signals accordingly.
What's a full train? You can't decide that from the train stop itself. You could check depots for possible trains but that could change from tick to tick. And then the stop would flicker between active and passive states. Maybe you could take all trains with a depot in the schedule, filter for network_id, min_carriages, max_carriages and then use that. You would have to update that over time but it shouldn't change often.

Unless you want it to never use a partial train. For that you could change scripts/dispatcher.lua: getFreeTrains to only return trains where "inventorySize <= size". You would still want a minimum threshold for the smallest train the station allows so the dispatcher doesn't run every tick.

Re: Threshold and Stack Threshold

Posted: Sat Nov 06, 2021 8:47 am
by chugin_iv
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
What's a full train? You can't decide that from the train stop itself.
Why? Train station is designed with specific train composition in mind. If the train station is designed for N cargo wagons then full train = N * 40 stacks or N * 25000 (liters?) for liquid trains.
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
Unless you want it to never use a partial train.
Yes, that's the idea.
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
For that you could change scripts/dispatcher.lua: getFreeTrains to only return trains where "inventorySize <= size". You would still want a minimum threshold for the smallest train the station allows so the dispatcher doesn't run every tick.
That seems to be backwards. I don't want to run shorter train, especially when my chests are (hopefully) properly balanced - shorter train will either not get filled to the same proportion as longer train (if provider station is not yet ready), or will not get fully unloaded (if consumer station is too full), creating imbalance as the result.

I want the train to be the exact composition the station was designed for, just later, when it can carry a full load.

Re: Threshold and Stack Threshold

Posted: Sat Nov 06, 2021 11:42 am
by mrvn
chugin_iv wrote:
Sat Nov 06, 2021 8:47 am
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
What's a full train? You can't decide that from the train stop itself.
Why? Train station is designed with specific train composition in mind. If the train station is designed for N cargo wagons then full train = N * 40 stacks or N * 25000 (liters?) for liquid trains.
But there is no N signal in the train stop. At most you have the min/max train size signal but that includes locomotives. And the train could have 1, 2, 3, 4... locomotives. So how do you determine N?
chugin_iv wrote:
Sat Nov 06, 2021 8:47 am
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
Unless you want it to never use a partial train.
Yes, that's the idea.
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
For that you could change scripts/dispatcher.lua: getFreeTrains to only return trains where "inventorySize <= size". You would still want a minimum threshold for the smallest train the station allows so the dispatcher doesn't run every tick.
That seems to be backwards. I don't want to run shorter train, especially when my chests are (hopefully) properly balanced - shorter train will either not get filled to the same proportion as longer train (if provider station is not yet ready), or will not get fully unloaded (if consumer station is too full), creating imbalance as the result.

I want the train to be the exact composition the station was designed for, just later, when it can carry a full load.
If your station has min train size == max train size and those trains all have the same number of locomotives then you would get full trains or none at all. Only when min train size < max train size can you get shorter trains and for that you have to design your stations to handle different train sizes. It's a corner case but one that makes your idea hard to implement.

Re: Threshold and Stack Threshold

Posted: Mon Nov 08, 2021 1:32 pm
by chugin_iv
mrvn wrote:
Sat Nov 06, 2021 11:42 am
chugin_iv wrote:
Sat Nov 06, 2021 8:47 am
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
What's a full train? You can't decide that from the train stop itself.
Why? Train station is designed with specific train composition in mind. If the train station is designed for N cargo wagons then full train = N * 40 stacks or N * 25000 (liters?) for liquid trains.
But there is no N signal in the train stop. At most you have the min/max train size signal but that includes locomotives. And the train could have 1, 2, 3, 4... locomotives. So how do you determine N?
I'd guess most train systems have at most 2 train lengths/compositions: default (long) and short (1 locomotive + 1 wagon). Personal and/or builder trains are possible exceptions, but they are not managed by LTN. I'd suggest global setting "default train wagon count", that automatically determines default stack and liquid thresholds. With possible addition of "default minimum load %" (relative to full train of default length) or "default minimum stack count per cargo wagon" (ditto). If that's inconvenient or conflicts with some different-wagon-capacity mods, my first suggestion of adding "default stack threshold" setting is still valid.
mrvn wrote:
Sat Nov 06, 2021 11:42 am
chugin_iv wrote:
Sat Nov 06, 2021 8:47 am
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
Unless you want it to never use a partial train.
Yes, that's the idea.
mrvn wrote:
Fri Nov 05, 2021 11:01 pm
For that you could change scripts/dispatcher.lua: getFreeTrains to only return trains where "inventorySize <= size". You would still want a minimum threshold for the smallest train the station allows so the dispatcher doesn't run every tick.
That seems to be backwards. I don't want to run shorter train, especially when my chests are (hopefully) properly balanced - shorter train will either not get filled to the same proportion as longer train (if provider station is not yet ready), or will not get fully unloaded (if consumer station is too full), creating imbalance as the result.

I want the train to be the exact composition the station was designed for, just later, when it can carry a full load.
If your station has min train size == max train size and those trains all have the same number of locomotives then you would get full trains or none at all. Only when min train size < max train size can you get shorter trains and for that you have to design your stations to handle different train sizes. It's a corner case but one that makes your idea hard to implement.
That check would cause additional work per tick and spam "no trains found" message, wouldn't it?

If it wouldn't, this could be used to add option "minimum train load %". It could use similar check and only return trains where "inventorySize * minimumLoad <= size".

Re: Threshold and Stack Threshold

Posted: Mon Nov 08, 2021 3:34 pm
by mrvn
chugin_iv wrote:
Mon Nov 08, 2021 1:32 pm
I'd guess most train systems have at most 2 train lengths/compositions: default (long) and short (1 locomotive + 1 wagon). Personal and/or builder trains are possible exceptions, but they are not managed by LTN. I'd suggest global setting "default train wagon count", that automatically determines default stack and liquid thresholds. With possible addition of "default minimum load %" (relative to full train of default length) or "default minimum stack count per cargo wagon" (ditto). If that's inconvenient or conflicts with some different-wagon-capacity mods, my first suggestion of adding "default stack threshold" setting is still valid.
If it's just a global setting then it's equivalent with the default threshold, just a different unit.

So is you suggestion to just have a default threshold and default stack threshold in settings?

Re: Threshold and Stack Threshold

Posted: Sun Nov 14, 2021 8:48 am
by chugin_iv
mrvn wrote:
Mon Nov 08, 2021 3:34 pm
chugin_iv wrote:
Mon Nov 08, 2021 1:32 pm
I'd guess most train systems have at most 2 train lengths/compositions: default (long) and short (1 locomotive + 1 wagon). Personal and/or builder trains are possible exceptions, but they are not managed by LTN. I'd suggest global setting "default train wagon count", that automatically determines default stack and liquid thresholds. With possible addition of "default minimum load %" (relative to full train of default length) or "default minimum stack count per cargo wagon" (ditto). If that's inconvenient or conflicts with some different-wagon-capacity mods, my first suggestion of adding "default stack threshold" setting is still valid.
If it's just a global setting then it's equivalent with the default threshold, just a different unit.

So is you suggestion to just have a default threshold and default stack threshold in settings?
Essentially yes. But that different unit is important - if all (or most) of your trains are the same length then you can use it to default to full trains. You can't do that with default threshold 'cause of different stack sizes of different items.

Default threshold then would be used (only) for liquids, so you can't replace the setting, it has to be both.

Re: Threshold and Stack Threshold

Posted: Sun Nov 14, 2021 3:51 pm
by mrvn
There might be one problem with this. Not with having stack and non-stack threshold. But with using this to request/provide goods:

It will provide goods.

If you have a stop and it has more goods than requested, maybe because you send a train there manually to unload left over goods, then it will suddenly provide those goods. I have the request/provide threshold at 1_000_000_000 so this never happens. Because when it does you will have a train stuck at a requester station waiting to get loaded and never leaving. And after the delivery timeout a second train. Then a third. Eventually your factory is shut down with a massive traffic jam.


This might be better suited for the ltn-combinator. It could set default threshold/stack-threshold values for provider or requester when you choose which type the station is going to be.

Re: Threshold and Stack Threshold

Posted: Tue Nov 16, 2021 8:49 pm
by chugin_iv
mrvn wrote:
Sun Nov 14, 2021 3:51 pm
There might be one problem with this. Not with having stack and non-stack threshold. But with using this to request/provide goods:

It will provide goods.

If you have a stop and it has more goods than requested, maybe because you send a train there manually to unload left over goods, then it will suddenly provide those goods. I have the request/provide threshold at 1_000_000_000 so this never happens. Because when it does you will have a train stuck at a requester station waiting to get loaded and never leaving. And after the delivery timeout a second train. Then a third. Eventually your factory is shut down with a massive traffic jam.


This might be better suited for the ltn-combinator. It could set default threshold/stack-threshold values for provider or requester when you choose which type the station is going to be.
Why yes, that's another problem with LTN - requester stations being able to suddenly be counted as provider stations. TSM has separate Supplier and Requester stations so that never happens. While LTN requires I either always request exactly full containers or rely on hacks like setting threshold to 1_000_000_000. Why is there no clear non-hacky way to tell LTN that this station is a requester and will never provide any goods?

Re: Threshold and Stack Threshold

Posted: Wed Nov 17, 2021 7:40 pm
by Optera
chugin_iv wrote:
Tue Nov 16, 2021 8:49 pm
mrvn wrote:
Sun Nov 14, 2021 3:51 pm
There might be one problem with this. Not with having stack and non-stack threshold. But with using this to request/provide goods:

It will provide goods.

If you have a stop and it has more goods than requested, maybe because you send a train there manually to unload left over goods, then it will suddenly provide those goods. I have the request/provide threshold at 1_000_000_000 so this never happens. Because when it does you will have a train stuck at a requester station waiting to get loaded and never leaving. And after the delivery timeout a second train. Then a third. Eventually your factory is shut down with a massive traffic jam.


This might be better suited for the ltn-combinator. It could set default threshold/stack-threshold values for provider or requester when you choose which type the station is going to be.
Why yes, that's another problem with LTN - requester stations being able to suddenly be counted as provider stations. TSM has separate Supplier and Requester stations so that never happens. While LTN requires I either always request exactly full containers or rely on hacks like setting threshold to 1_000_000_000. Why is there no clear non-hacky way to tell LTN that this station is a requester and will never provide any goods?
LTN is a lot more flexible than TSM, for example one stop may request iron ore AND provide iron plates.
Setting request threshold to 2^31 is the intended way of telling LTN a station is never a provider.

Re: Threshold and Stack Threshold

Posted: Wed Nov 17, 2021 10:48 pm
by mrvn
Optera wrote:
Wed Nov 17, 2021 7:40 pm
chugin_iv wrote:
Tue Nov 16, 2021 8:49 pm
Why yes, that's another problem with LTN - requester stations being able to suddenly be counted as provider stations. TSM has separate Supplier and Requester stations so that never happens. While LTN requires I either always request exactly full containers or rely on hacks like setting threshold to 1_000_000_000. Why is there no clear non-hacky way to tell LTN that this station is a requester and will never provide any goods?
LTN is a lot more flexible than TSM, for example one stop may request iron ore AND provide iron plates.
Setting request threshold to 2^31 is the intended way of telling LTN a station is never a provider.
In regards to the OPs request you can't have both a default to 2^31 and to a full train worth of goods. Which of the two you need depends on what type the station is going to be. Hence my suggestion to put this into the ltn-combinator, as it has checkboxes for provider/requester and can then pick the right default.