Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate wait until full/empty #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions locale/de/settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ ltn-dispatcher-depot-inactivity(s)=Depotinaktivität (Sek.)
ltn-dispatcher-stop-timeout(s)=maximale Ladedauer (Sek.)
ltn-dispatcher-delivery-timeout(s)=maximale Lieferzeit (Sek.)
ltn-dispatcher-requester-delivery-reset=Fahrplan bei Anforderer abschließen
ltn-dispatcher-finish-loading=Beladung abschließen
ltn-dispatcher-finish-unloading=Beladung abschließen
ltn-dispatcher-finish-loading=Eintrag abgeschlossenßen
ltn-depot-reset-filters=Waggonfilter in Depots löschen
ltn-depot-fluid-cleaning=Automatisch entfernte Flüssigkeitsmenge
ltn-stop-default-network=Standard Netzwerk ID
Expand All @@ -36,7 +37,8 @@ ltn-dispatcher-depot-inactivity(s)=Dauer in Sekunden, bevor Züge das Depot wege
ltn-dispatcher-stop-timeout(s)=Dauer in Sekunden bevor Züge ihre Station verlassen müssen.\n0 schaltet diese Funktion aus.\nStandardwert = 120s
ltn-dispatcher-delivery-timeout(s)=Lieferzeit in Sekunden bevor Züge als vermisst gelten.\nStandardwert = 600s (10min)
ltn-dispatcher-requester-delivery-reset=Inaktiv: (Standardwert)\nLieferung und Fahrplan werden bei Ankunft im Depot zurück gesetzt.\nÄnderungen an Zügen in Anforderer-Haltestellen haben keine Auswirkung.\n\nAktiv:\nLieferung und Fahrplan werden bei verlassen der Anforderer-Haltestelle zurück gesetzt.\nÄnderungen an Zügen in Anforderer-Haltestellen löscht die Lieferung und setzt den Fahrplan zurück.
ltn-dispatcher-finish-loading=Aktiv: (Standardwert)\nVerhindert verlassen von Haltestellen während Greifarme/Pumpen arbeiten.\n\nInaktiv:\nZüge verlassen Haltestellen unmittelbar nach erreichen ihrer gewünschten Beladung.\nGreifarme bleiben Gegenstände haltend stecken, Tankwaggons enthalten Restmengen.
ltn-dispatcher-finish-unloading=Aktiv: (Standardwert)\n(Entladung)Verhindert verlassen von Haltestellen während Greifarme/Pumpen arbeiten.\n\nInaktiv:\nZüge verlassen Haltestellen unmittelbar nach erreichen ihrer gewünschten Beladung.\nGreifarme bleiben Gegenstände haltend stecken, Tankwaggons enthalten Restmengen.
ltn-dispatcher-finish-loading=Aktiv: (Standardwert)\n(Wird geladen)Verhindert verlassen von Haltestellen während Greifarme/Pumpen arbeiten.\n\nInaktiv:\nZüge verlassen Haltestellen unmittelbar nach erreichen ihrer gewünschten Beladung.\nGreifarme bleiben Gegenstände haltend stecken, Tankwaggons enthalten Restmengen.
ltn-depot-reset-filters=Aktiv: (Standardwert)\nFilter und Stapelbegrenzungen in Güterwaggons werden bei Ankunft im Depot gelöscht.
ltn-depot-fluid-cleaning=Maximale Flüssigkeitsmenge pro Waggon die bei Ankunft im Depot automatisch zerstört wird.\n0 schaltet diese Funktion aus.
ltn-stop-default-network=Netzwerk ID wenn kein Signal "Kodierte Netzwerk ID" existiert.
Expand All @@ -47,4 +49,4 @@ ltn-provider-show-existing-cargo=Aktiv: (Standardwert)\nExistierende Ladung von
ltn-interface-console-level-0=0: Aus
ltn-interface-console-level-1=1: Fehler & Warnungen
ltn-interface-console-level-2=2: Informationen
ltn-interface-console-level-3=3: Ausführliche Nachrichten
ltn-interface-console-level-3=3: Ausführliche Nachrichten
4 changes: 3 additions & 1 deletion locale/en/settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ltn-dispatcher-depot-inactivity(s)=Depot inactivity (sec)
ltn-dispatcher-stop-timeout(s)=Stop timeout (sec)
ltn-dispatcher-delivery-timeout(s)=Delivery timeout (sec)
ltn-dispatcher-requester-delivery-reset=Delivery completes at requester
ltn-dispatcher-finish-unloading=Finish unloading
ltn-dispatcher-finish-loading=Finish loading
ltn-depot-reset-filters=Depots reset filters
ltn-depot-fluid-cleaning=Depot fluid removal limit
Expand All @@ -37,6 +38,7 @@ ltn-dispatcher-depot-inactivity(s)=Duration in seconds of inactivity before trai
ltn-dispatcher-stop-timeout(s)=Duration in seconds before trains are forced out of a station.\n0 deactivates this feature.\ndefault = 120
ltn-dispatcher-delivery-timeout(s)=Duration in seconds deliveries can take before assuming the train was lost.\ndefault = 600 (10min)
ltn-dispatcher-requester-delivery-reset=False: (default)\nDelivery and schedule are reset when train arrives at depot.\nChanges to trains parked at requesting stops have no effect.\n\nTrue:\nDelivery and schedule are reset when train leaves requester.\nChanges to trains parked at requesting stops will remove delivery and reset schedule.
ltn-dispatcher-finish-unloading=True: (default)\nPrevents trains from leaving while inserters/pumps are unloading by adding 2s inactivity condition.\n\nFalse:\nTrains will leave immediately when all items have been unloaded.\nInserters at unloading stations will get stuck.
ltn-dispatcher-finish-loading=True: (default)\nPrevents trains from leaving while inserters/pumps are working by adding 2s inactivity condition.\n\nFalse:\nTrains will leave immediately when all items have been loaded.\nInserters at loading stations will get stuck.
ltn-depot-reset-filters=True: (default)\nCargo wagons have their filters and stack limitations cleared when entering a depot.
ltn-depot-fluid-cleaning=Maximum amount of fluid per wagon automatically destroyed when entering depots.\nSet to 0 to disable.
Expand All @@ -48,4 +50,4 @@ ltn-provider-show-existing-cargo=True: (default)\nCargo inside train when arrivi
ltn-interface-console-level-0=0: Off
ltn-interface-console-level-1=1: Errors & Warnings
ltn-interface-console-level-2=2: Notifications
ltn-interface-console-level-3=3: Detailed Messages
ltn-interface-console-level-3=3: Detailed Messages
5 changes: 4 additions & 1 deletion script/dispatcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,14 @@ function NewScheduleRecord(stationName, condType, condComp, itemlist, countOverr
-- itemlist = {first_signal.type, first_signal.name, constant}
local cond = {comparator = condComp, first_signal = {type = itemlist[i].type, name = itemlist[i].name}, constant = countOverride or itemlist[i].count}
record.wait_conditions[#record.wait_conditions+1] = {type = condFluid or condType, compare_type = "and", condition = cond }
if finish_unloading and condComp == "=" and countOverride == 0 then
record.wait_conditions[#record.wait_conditions+1] = condition_finish_loading
end
end

if waitEmpty then
record.wait_conditions[#record.wait_conditions+1] = condition_wait_empty
elseif finish_loading then -- let inserter/pumps finish
elseif finish_loading and not (condComp == "=" and countOverride == 0) then
record.wait_conditions[#record.wait_conditions+1] = condition_finish_loading
end

Expand Down
6 changes: 5 additions & 1 deletion script/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ depot_inactivity = settings.global["ltn-dispatcher-depot-inactivity(s)"].value *
stop_timeout = settings.global["ltn-dispatcher-stop-timeout(s)"].value * 60
condition_stop_timeout = {type = "time", compare_type = "or", ticks = stop_timeout }
delivery_timeout = settings.global["ltn-dispatcher-delivery-timeout(s)"].value * 60
finish_unloading = settings.global["ltn-dispatcher-finish-unloading"].value
finish_loading = settings.global["ltn-dispatcher-finish-loading"].value
requester_delivery_reset = settings.global["ltn-dispatcher-requester-delivery-reset"].value
dispatcher_enabled = settings.global["ltn-dispatcher-enabled"].value
Expand Down Expand Up @@ -63,6 +64,9 @@ script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if event.setting == "ltn-dispatcher-delivery-timeout(s)" then
delivery_timeout = settings.global["ltn-dispatcher-delivery-timeout(s)"].value * 60
end
if event.setting == "ltn-dispatcher-finish-unloading" then
finish_unloading = settings.global["ltn-dispatcher-finish-unloading"].value
end
if event.setting == "ltn-dispatcher-finish-loading" then
finish_loading = settings.global["ltn-dispatcher-finish-loading"].value
end
Expand Down Expand Up @@ -103,4 +107,4 @@ script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if event.setting == "ltn-provider-show-existing-cargo" then
provider_show_existing_cargo = settings.global["ltn-provider-show-existing-cargo"].value
end
end)
end)
9 changes: 8 additions & 1 deletion settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ data:extend({
setting_type = "runtime-global",
default_value = false
},
{
type = "bool-setting",
name = "ltn-dispatcher-finish-unloading",
order = "cf",
setting_type = "runtime-global",
default_value = true
},
{
type = "bool-setting",
name = "ltn-dispatcher-finish-loading",
Expand Down Expand Up @@ -163,4 +170,4 @@ data:extend({
setting_type = "runtime-global",
default_value = true
},
})
})