-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Intro
Love your mod!
I tried to make this bug report as detailed as possible, please forgive my mistakes and keep up the great work!
Bug description
If a train is overloaded at a station and the overloaded items are then removed again, then the ltn-message.provider_missing_cargo
might appear even if the actual contents are still more than the original request.
Lines causing the warning:
https://github.com/Yousei9/Logistic-Train-Network/blob/1d237981a0da80b6d6911d5a589f77ee4a7bd2cf/script/train-events.lua#L183-L186
https://github.com/Yousei9/Logistic-Train-Network/blob/1d237981a0da80b6d6911d5a589f77ee4a7bd2cf/script/train-events.lua#L213-L216
I don't think this causes the problem.
Lines updating the delivery:
https://github.com/Yousei9/Logistic-Train-Network/blob/1d237981a0da80b6d6911d5a589f77ee4a7bd2cf/script/stop-update.lua#L289-L293
Introduced in:
https://github.com/Yousei9/Logistic-Train-Network/blob/da3676c944be490aa8164a4783248b379ee44cd0/control.lua#L1253-L1257
The commit message was:
- overloading trains updates delivery size once per update interval (before update was only done once train leaves provider)
The previous behavior describes what I expect the mod to do, the updated behavior describes the cause of the bug (in my opinion). I am not sure where to find the reason of this change. Please forgive me if I missed something obvious.
The delivery is increased to match the overload whenever it occurs, which means that any overload correction (reducing the contents of a train) by the player will generate warnings even if the contents is more than the original request.
Expected behaviour
The station provides the requested amount, so anything equal to or more than than that should be acceptable. This is why I do not expect the missing cargo warning.
Reducing the train overload is important if the requested item is costly to produce. You would not want to overload nuclear reactors.
Also, a station with both loading and unloading is easier to create if it does not have to check if an item is unnecessary or just overloaded.
To Reproduce
Savegame with example station: ltn-test.zip
Might not provide instant results, so please wait for about 3 deliveries.
Alternatively, create a station that loads with (stack) inserters and unloads the overloaded materials.
LTN version
1.15.2
Log file
factorio-current.log
Extra logging of all deliveries included. Also logs the expected vs. actual amount if there is missing cargo.
Lines added to dispatcher.lua:24
:
for train_id, delivery in pairs(global.Dispatcher.Deliveries) do
log("Train: " .. train_id .. " Has schedule: " .. serpent.line(delivery.shipment))
end
Line added to train-events.lua:184
:
log("Train: " .. trainID .. " Item: " .. name .. " Should have: " .. planned_count .. " Has: " .. count)
Timestamps of an erroneous run:
- Delivery created: 774.281
- Overload correction: 782.859
- Warning creation: 785.626