Merge pull request #81 from mamoniot/beta

1.12.4
This commit is contained in:
Monica Moniot
2023-04-30 14:36:51 -04:00
committed by GitHub
24 changed files with 535 additions and 303 deletions

1
TODO
View File

@@ -33,3 +33,4 @@ compat:
cargo ships
editor extensions (test surface separation)
train fuel types for refuelers
automatic recipe creation

View File

@@ -1,13 +1,19 @@
---------------------------------------------------------------------------------------------------
Version: 1.2.14
Date: 2023-3-14
Date: 2023-4-30
Features:
- Added opt-in WIP trains, inventory, and station manager gui (highly experimental, use at your own risk)
Changes:
- Improved the recipe derivation logic for the cybernetic combinator, in all modpacks it should now consistently be about as difficult to craft as an arthmetic combinator. Vanilla recipe is unchanged, but several overhaul mods will receive new recipes.
- The automatic allow list now consistently looks 3 tiles down the first curved rail it finds along a station for inserters or pumps. Previously it would conditionally look only 1 tile down. This should lead to more intuitive allow list behaviour for stations with trains that park slightly on curved rails.
Bugfixes:
- Provider override thresholds now correctly override the required train capacity as well; fix contributed by shopt
- Fixed a rare crash relating to an uninitialized network mask on a new station
- Fixed a SE space elevator bug that caused incorrect orders when the provider and requester station had the same name
- Added an incompatibility error with picker dollies, proper compatibility to come in a later update
- Fixed entities not having the correct names in nullius contributed by Sharparam
Translation:
- lengua española (Spanish language) contributed by Majestuozzo
---------------------------------------------------------------------------------------------------
Version: 1.2.13
Date: 2023-2-5

View File

@@ -1,10 +1,30 @@
flib = require("__flib__.table")
require('scripts.constants')
--Credit to modo-lv for submitting the following code
if mods["nullius"] then
-- Place combinator in the same subgroup as the regular train stop
data.raw["recipe"][COMBINATOR_NAME].subgroup = data.raw["train-stop"]["train-stop"].subgroup
data.raw["item"][COMBINATOR_NAME].subgroup = data.raw["item"]["train-stop"].subgroup
-- Nullius makes modded technologies part of its research tree
-- Place combinator in the same place on the research tree as LTN
table.insert(data.raw.technology["nullius-broadcasting-1"].prerequisites, "cybersyn-train-network")
-- Place combinator in the same subgroup as the regular train stop
data.raw["recipe"][COMBINATOR_NAME].subgroup = data.raw["train-stop"]["train-stop"].subgroup
data.raw["item"][COMBINATOR_NAME].subgroup = data.raw["item"]["train-stop"].subgroup
-- Nullius makes modded technologies part of its research tree
-- Place combinator in the same place on the research tree as LTN
table.insert(data.raw.technology["nullius-broadcasting-1"].prerequisites, "cybersyn-train-network")
end
-- Reset the combinator recipe back to arithmetic combinator recipe in case a mod has changed it
local recipe = flib.deep_copy(data.raw["recipe"]["arithmetic-combinator"].ingredients)
for k, _ in pairs(recipe) do
local mult = 2
for i, _ in pairs(recipe) do
if recipe[k][i] == "copper-cable" then
mult = 4
break;
end
end
for i, _ in pairs(recipe) do
if type(recipe[k][i]) == "number" then
recipe[k][i] = mult*recipe[k][i]
end
end
end
data.raw["recipe"][COMBINATOR_NAME].ingredients = recipe

View File

@@ -11,7 +11,6 @@
"? space-exploration >= 0.6.94",
"? miniloader",
"? nullius",
"? pypostprocessing",
"! LtnManager"
"? pypostprocessing"
]
}

6
cybersyn/info.lua Normal file
View File

@@ -0,0 +1,6 @@
--- The number below is the debug revision number.
--- It is used in migrations.lua to determine if any migrations need to be run for beta testers.
--- It is expected these are only meaningful between releases during beta testing.
--- It should be set to nil for any release version.
return nil

View File

@@ -12,6 +12,9 @@ cybersyn-warmup-time=Aufwärmzeit für die Station (sec)
cybersyn-stuck-train-time=Zeitüberschreitung bei festgefahrenem Zug in Sekunden
cybersyn-allow-cargo-in-depot=Erlaube Züge mit Fracht in Depots
cybersyn-invert-sign=Invertieren der Kombinatorausgabe (veraltet)
#cybersyn-manager-enabled=
#cybersyn-manager-update-rate=
#cybersyn-manager-result-limit=
[mod-setting-description]
cybersyn-enable-planner=Aktivieren oder deaktivieren des zentralen Planungsalgorithmus. Wenn er deaktiviert ist, werden keine neuen Züge abgefertigt.
@@ -27,6 +30,7 @@ cybersyn-warmup-time=Wie viele Sekunden ein kybernetischer Kombinator wartet, be
cybersyn-stuck-train-time=So viele Sekunden nach der Abfertigung eines Zuges wird eine Warnung gesendet, um darauf hinzuweisen, dass der Zug wahrscheinlich stecken geblieben ist und seine Lieferung nicht abgeschlossen hat. Der Spieler muss dann wahrscheinlich sein Netzwerk debuggen, um den Zug wieder freizubekommen.
cybersyn-allow-cargo-in-depot=Wenn ausgewählt, dürfen Züge Fracht in Depots haben; es werden keine Warnungen erzeugt und der Zug wird nicht aufgehalten. Außerdem werden Züge mit Aufträgen zum Besuch von Anforderunngsstationen mit aktivierter "Inaktivitätsbedingung" auf Inaktivität warten, anstatt auf leere Fracht zu warten. Nützlich für die Erstellung von Zugsystemen, bei denen Depots überschüssige Fracht abfertigen. Nur für fortgeschrittene Benutzer.
cybersyn-invert-sign=Ändern Sie das Vorzeichen der Ausgabe von kybernetischen Kombinatoren, so dass es dasselbe ist wie in LTN oder in früheren Versionen von Project Cybersyn.
#cybersyn-manager-result-limit=
[item-name]
cybersyn-combinator=Kybernetischer Kombinator

View File

@@ -1,77 +1,51 @@
[mod-name]
cybersyn=Project Cybersyn
[controls]
cybersyn-toggle-gui=LTN-Manager umschalten
#cybersyn-toggle-gui=LTN-Manager umschalten
[cybersyn-gui]
alert-delivery-failed=Lieferung fehlgeschlagen
alert-delivery-failed-description=Der Zug hat zu lange gebraucht, um seine Aufgabe zu erfüllen, und wurde von LTN aufgegeben, oder der Zug wurde aus anderen Gründen für ungültig erklärt. Sie können in den Mod-Einstellungen konfigurieren, wie lange LTN auf einen Zug wartet.\n\nDie geplante Lieferung wird in Grün aufgelistet.
alert-provider-missing-cargo-description=Nur ein Teil der vorgesehenen Fracht wurde verladen, bevor der Zug die Anbieterstation verließ.\n\nGrün kennzeichnet die vorgesehene Fracht, rot die tatsächliche Fracht.
alert-provider-missing-cargo=Anbieter - fehlende Fracht
alert-provider-unscheduled-cargo-description=Der Zug hat den Anbieter mit außerplanmäßiger/unbeabsichtigter Fracht verlassen.\n\nGrün zeigt die geplante Ladung an, rot die außerplanmäßige Ladung.
alert-provider-unscheduled-cargo=Anbieter - außerplanmäßige Fracht
alert-requester-remaining-cargo-description=Es wurden nicht alle Gegenstände aus dem Zug entladen, bevor er die Station verließ, und er ist mit der Restladung in sein Depot zurückgekehrt.\n\nDie Restposten sind in rot aufgeführt.
alert-requester-remaining-cargo=Anfrage - Restladung
alert-requester-unscheduled-cargo-description=Der Zug ist beim Anforderer mit außerplanmäßiger/unbeabsichtigter Fracht angekommen.\n\nGrün zeigt die geplante Ladung an, rot die außerplanmäßige Ladung.
alert-requester-unscheduled-cargo=Anforderer - außerplanmäßige Fracht
alerts=Warnungen
all-paren=(Alle)
clear-history=Verlauf löschen
composition=Zusammensetzung
composition-description=Layout des Zuges.\nL = Lokomotive\nC = Güterwagen\nF = Flüssigkeitswagen\nA = Artilleriewagen\n< > = Fahrtrichtung
control-signals=Kontrollsignale
delete-alert=Warnung löschen
delete-all-alerts=Alle Warnungen löschen
delivering-to=Belieferung an
depot=Depot
depots=Depots
dispatcher-disabled-description=Der LTN-Dispatcher ist deaktiviert; es werden keine neuen Lieferungen erstellt. Aktivieren Sie den Dispatcher wieder über die Karteneinstellungen oder über das Tastaturkürzel.
dispatcher-disabled=LTN-Disponent ist deaktiviert!
fetching-from=Abrufen aus
finished=Abgeschlossen
history=Verlauf
;history=Verlauf
in-transit=unterwegs
inventory=Inventar
keep-open=Offen halten
loading-at=Laden bei
layout=
name=Name
network-name-label=
network-id-label=Netzwerk ID:
network-id=Netzwerk ID
no-alerts=[img=warning-white] Keine Warnungen
no-depots=[img=warning-white] Keine Depots
no-history=[img=warning-white] Kein Verlauf
;no-history=[img=warning-white] Kein Verlauf
no-stations=[img=warning-white] Keine Stationen
not-available=Nicht verfügbar
;not-available=Nicht verfügbar
no-trains=[img=warning-white] Keine Züge
open-ltn-combinator-gui=[font=default-semibold][color=128,206,240]Control:[/color][/font] LTN Kombinator GUI öffnen
open-station-gui=Open station GUI\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Station auf der Karte öffnen
open-train-gui=Zug-GUI öffnen
parked-at-depot=Im Depot geparkt
parked-at-depot-with-residue=Geparkt im Depot mit Restladung
provided=angeboten
provided-requested-description=Green = provided\nRed = angefordert
;provided-requested-description=Green = provided\nRed = angefordert
provided-requested=angeboten / angefordert
refresh-tooltip=Refresh\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Automatisches Aktualisieren einschalten
;refresh-tooltip=Refresh\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Automatisches Aktualisieren einschalten
requested=angefordert
returning-to-depot=Rückkehr zum Depot
route=Route
runtime=Laufzeit
search-label=Suche:
shipments-description=Green = Eingehend\nBlue = Ausgehend
#search-item-label=
;shipments-description=Green = Eingehend\nBlue = Ausgehend
shipment=Lieferung
shipments=Lieferungen
stations=Stationen
status-description=[img=flib_indicator_green]1 = Normaler Status\n[img=flib_indicator_blue]n = LTN kontrollierter Zug parkt beim Halt, n = Anzahl der Züge\n[img=flib_indicator_yellow]n = Halt ist Teil einer geplanten Lieferung, n = Anzahl der Züge\n[img=flib_indicator_white]1 = Fehler - nicht initialisiert\n[img=flib_indicator_red]1 = Fehler - Kurzschluss\n[img=flib_indicator_red]2 = Fehler - Halt deaktiviert
status=Status
#status=Status
surface-label=Overfläche:
time=Zeit
train-id=Zug ID
trains=Züge
type=Typ
unloading-at=Entladung bei
[cybersyn-message]
error-ltn-combinator-not-found=Konnte keinen LTN Kombinator für diese Station finden.
#error-cybernetic-combinator-not-found=
#error-station-control-combinator-not-found=
error-station-is-invalid=Station ist ungültig, bitte aktualisiere die GUI
error-train-is-invalid=Zug ist ungültig, bitte aktualisiere die Gui
#error-cross-surface-camera-invalid=
[cybersyn-mod-setting-description]
iterations-per-tick=Verringern Sie diese Zahl, wenn Sie Probleme mit der Leistung haben.
@@ -81,4 +55,4 @@ history-length=Verlaufslänge
iterations-per-tick=Iterationen pro Tick [img=info]
[shortcut-name]
cybersyn-toggle-gui=LTN-Manager umschalten
#cybersyn-toggle-gui=LTN-Manager umschalten

View File

@@ -13,7 +13,7 @@ cybersyn-stuck-train-time=Stuck train timeout (sec)
cybersyn-allow-cargo-in-depot=Allow cargo in depots
cybersyn-invert-sign=Invert combinator output (deprecated)
cybersyn-manager-enabled=Enable the Cybersyn GUI.
cybersyn-manager-updates-per-second=Manager refreshes per second
cybersyn-manager-update-rate=Manager refresh tick interval
cybersyn-manager-result-limit=Max entities displayed on GUI pages.
[mod-setting-description]
@@ -30,7 +30,6 @@ cybersyn-warmup-time=How many seconds a cybernetic combinator will wait before c
cybersyn-stuck-train-time=After this many seconds from a train's dispatch, an alert will be sent to let you know a train is probably stuck and has not completed its delivery. The player will likely have to debug their network to get the train unstuck.
cybersyn-allow-cargo-in-depot=If checked, trains will be allowed to have cargo in depots; no alerts will be generated and the train will not be held. In addition, trains with orders to visit requester stations with "Inactivity condition" checked will wait for inactivity instead of waiting for empty cargo. Useful for creating train systems where depots handle excess cargo. For advanced users only.
cybersyn-invert-sign=Flip the sign of the output of cybernetic combinators to be the same as it is in LTN or in earlier versions of Project Cybersyn.
cybersyn-manager-updates-per-second=How many times per second should the Manager GUI update. This value will be rounded up to a divisor of 60.
cybersyn-manager-result-limit=Caps the number of matching enitities (e.g. stations, trains) to limit the amount of update time consumed when the list is refreshed.\n-1 means return all results.
[item-name]

View File

@@ -5,73 +5,39 @@ cybersyn=Project Cybersyn
cybersyn-toggle-gui=Toggle Cybersyn Manager
[cybersyn-gui]
alert-delivery-failed=Delivery failed
alert-delivery-failed-description=The train took too long to perform its task and was abandoned by LTN, or the train was otherwise invalidated. You can configure how long LTN will wait for a train in the mod settings.\n\nThe planned shipment is listed in green.
alert-provider-missing-cargo-description=Not all of the intended cargo was loaded before the train left the provider.\n\nGreen indicates the intended shipment, red indicates the actual shipment.
alert-provider-missing-cargo=Provider - missing cargo
alert-provider-unscheduled-cargo-description=The train left the provider with unscheduled / unintended cargo.\n\nGreen indicates the planned shipment, red indicates the unscheduled load.
alert-provider-unscheduled-cargo=Provider - unscheduled cargo
alert-requester-remaining-cargo-description=Not all materials were unloaded from the train before it left the station, and it has returned to its depot with the leftover cargo.\n\nThe leftover items are listed in red.
alert-requester-remaining-cargo=Requester - remaining cargo
alert-requester-unscheduled-cargo-description=The train arrived at the requester with unscheduled / unintended cargo.\n\nGreen indicates the planned shipment, red indicates the unscheduled load.
alert-requester-unscheduled-cargo=Requester - unscheduled cargo
alerts=Alerts
all-paren=(All)
clear-history=Clear history
composition=Composition
composition-description=The train's layout.\nL = Locomotive\nC = Cargo wagon\nF = Fluid wagon\nA = Artillery wagon\n< > = Direction
control-signals=Control signals
delete-alert=Delete alert
delete-all-alerts=Delete all alerts
delivering-to=Delivering to
depot=Depot
depots=Depots
dispatcher-disabled-description=The LTN dispatcher is disabled; no new deliveries will be created. Re-enable the dispatcher via the map settings or by using the hotkey.
dispatcher-disabled=LTN dispatcher is disabled!
fetching-from=Fetching from
finished=Finished
history=History
;history=History
in-transit=In transit
inventory=Inventory
keep-open=Keep open
layout=Train Layout
loading-at=Loading at
name=Name
network-name-label=Network Filter:
network-id-label=Network ID:
network-id=Network ID
no-alerts=[img=warning-white] No alerts
no-depots=[img=warning-white] No depots
no-history=[img=warning-white] No history
;no-history=[img=warning-white] No history
no-stations=[img=warning-white] No stations
not-available=Not available
;not-available=Not available
no-trains=[img=warning-white] No trains
open-station-gui=Open station GUI\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Open station on map\n[font=default-semibold][color=128,206,240]Control:[/color][/font] Open Station Cybernetic Combinator\n[font=default-semibold][color=128,206,240]Alt:[/color][/font] Open Station Control Cybernetic Combinator
open-train-gui=Open train GUI
parked-at-depot=Parked at depot
parked-at-depot-with-residue=Parked at depot with residue
provided=Provided
provided-requested-description=Green = provided\nRed = requested
;provided-requested-description=Green = provided\nRed = requested
provided-requested=Provided / requested
refresh-tooltip=Refresh\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Toggle auto-refresh
;refresh-tooltip=Refresh\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Toggle auto-refresh
requested=Requested
returning-to-depot=Returning to depot
route=Route
runtime=Runtime
search-label=Station Name:
search-item-label=Item Filter:
shipments-description=Green = Inbound\nBlue = Outbound
shipment=Shipment
shipments=Shipments
stations=Stations
status-description=[img=flib_indicator_green]1 = normal status\n[img=flib_indicator_blue]n = LTN Controlled Train parked at stop, n = number of trains\n[img=flib_indicator_yellow]n = Stop is part of a scheduled delivery, n = number of trains\n[img=flib_indicator_white]1 = Error - not initialized\n[img=flib_indicator_red]1 = Error - short circuit\n[img=flib_indicator_red]2 = Error - deactivated stop
status=Network Signal
surface-label=Surface:
time=Time
train-id=Train ID
trains=Trains
type=Type
unloading-at=Unloading at
[cybersyn-message]
error-cybernetic-combinator-not-found=Could not find a cybernetic combinator for this station.

View File

@@ -0,0 +1,98 @@
[mod-setting-name]
cybersyn-enable-planner=Habilitar planificador central
cybersyn-ticks-per-second=Planificador central actualizaciones por minuto
cybersyn-update-rate=Planificador central velocidad de actualización
cybersyn-request-threshold=Umbral de pedido por defecto
cybersyn-priority=Prioridad por defecto
cybersyn-locked-slots=Espacios bloqueados por vagón de carga por defecto
cybersyn-network-flag=Redes ocultas por defecto
cybersyn-fuel-threshold=Umbral de combustible
cybersyn-depot-bypass-enabled=Evitar depósito habilitado
cybersyn-warmup-time=Tiempo de calentamiento de estación (seg)
cybersyn-stuck-train-time=Tren atascado tiempo de espera (seg)
cybersyn-allow-cargo-in-depot=Permitir carga en depositos
cybersyn-invert-sign=Invertir salida del combinador (obsoleto)
cybersyn-manager-enabled=Habilitar la GUI de Cybersyn.
cybersyn-manager-update-rate=Actualizar manager intervalo de tick
cybersyn-manager-result-limit=Máxima cantidad de entidades mostradas en las páginas GUI.
[mod-setting-description]
cybersyn-enable-planner=Habilitar o deshabilitar el planificador central del algoritmo. Si esta deshabilitado, no se haran envíos de nuevos trenes.
cybersyn-ticks-per-second=Cuantas veces por segundo el planificador central debería actualizar el estado de la red y programar entregas. Este valor se rendondea para arriba hasta un divisor de 60. Configurar esto como 0 frenara todos los envíos.
cybersyn-update-rate=Cuantas estaciones por tick pueden ser sondeadas a la vez, o pueden tener envíos programados a la vez. Un número más alto le permite al planificador central estar más actualizado con el estado actual de la red, pero a costa del rendimiento.
cybersyn-request-threshold=El umbral de pedido por defecto cuando no se le da una señal de umbral de pedido a una estación. Cuando una estación recive un valor negativo que supera el umbral de pedido, se programará una entrega de dicho item entre dos estaciones, siempre y cuando haya una estación con una señal positiva mayor que el umbral de pedido.
cybersyn-priority=La prioridad por defecto cuando no se envía una señal de prioridad a una estación, depósito o reabastecedor de combustible. Estaciones con mayor prioridad, recibiran envíos antes que aquellos con menor prioridad.
cybersyn-locked-slots=La cantidad por defecto de espacios bloquador por vagón de carga, cuando no se le da a la estación una señal de "espacios bloqueados por vagón de carga". Cuando una estación proveedora tiene X espacios bloqueados por vagón de carga, cualquier tren intentando hacer una entrega desde ella, tendra su orden modificada para que cada vagón tenga al menos X espacios libres. Esto es necesario para que las estaciones que proveen múltiples items funcionen correctamente.
cybersyn-network-flag=La cantidad por defecto de sub-redes a las que una estación va a atender, cuando no se le da a la estación una señal. Este número entero es interpretado como bit, para dar 32 posibles sub-redes de las cuales elegir.
cybersyn-fuel-threshold=Que porcentaje del inventario del tren tiene que estar lleno para saltearse el reabastecedor de combustible. Si el valor es 1, los trenes siempre van a ir a ser reabastecidos después de terminar una entrega.
cybersyn-depot-bypass-enabled=Si está marcado, cuando un tren completa la entrega y el reabastecimiento de combustible, puede recibir una nueva orden en vez de volver al depósito.
cybersyn-warmup-time=Cuantos segundos esperará el combinador cibernético, antes de conectarse a la red de Cybersyn. Este es un período de gracia para modificar o corregir el circuito de red antes de que los trenes comienzen a ser despachados hacia la nueva estación.
cybersyn-stuck-train-time=Después de esta cantidad de segundos de ser despachado el tren, una alerta será enviada para informar que el tren probablemente esté atascado y no completó su entrega. El jugador seguramente tenga que arreglar su red para desbloquar al tren.
cybersyn-allow-cargo-in-depot=Si está marcado, se le permitirá a los trenes tener carga en los depósitos. Ninguna alerta será generada, y el tren no será detenido. Adicionalmente, trenes con ordenes de visitar estaciones solicitantes con "Condiciones de inactividad" marcados esperarán por inactividad en vez de carga vacia. Útil para crear sistemas de trenes donde los depósitos se ocupan del exceso de carga. Para jugadores avanzados unicamente.
cybersyn-invert-sign=Cambia el signo de salida de los combinadores cibernéticos para que sean iguales a LTN o a versiones anteriores de Project Cybersyn.
cybersyn-manager-result-limit=Limita el número de entidades iguales (p.ej. estaciones, trenes) para limitar la cantidad de tiempo consumido en actualizaciones cuando la lista es renovada. \n-1 devuelve todos los resultados.
[item-name]
cybersyn-combinator=Combinador cibernético
[item-description]
cybersyn-combinator=Colocar al lado de una parada de tren para agregarla a la red de trenes de Cybersyn. Esta parada ahora puede solicitar o proveer items que son reportados a ella por el circuito de red.
[entity-name]
cybersyn-combinator=Combinador cibernético
cybersyn-combinator-output=Salida del combinador cibernético
[entity-description]
cybersyn-combinator=Tiene 5 modos diferentes. Solo se necesitan los modos de estación y depósito para empezar.
[technology-name]
cybersyn-train-network=Red de trenes Cybersyn
[technology-description]
cybersyn-train-network=Controladores de paradas del tren capaces de coordinar las salidas y entradas de una economía entera.
[virtual-signal-name]
cybersyn-priority=Prioridad de estación
cybersyn-request-threshold=Umbral de pedido
cybersyn-locked-slots=Espacios bloqueados por vagón de carga
[cybersyn-messages]
nonempty-train=A train is being held in the depot because it still has cargo Un tren esta siendo retenido en el depósito porque todavía tiene carga
unexpected-train=Un tren volvio inesperadamente al depósito antes de completar su entrega
stuck-train=Un tren está atascado
cannot-path-between-surfaces=Un tren está intentando realizar una entrega entre dos superficies desconectadas. Intente ponerlas en redes separadas
depot-broken=Un tren está perdido porque su depósito fue destruido
refueler-broken=Un tren está perdido porque su reabastecedor de combustible fue destruido
station-broken=Un tren está perdido porque una de sus estaciones del envío esta rota
train-at-incorrect=Un tren está detenido en una estación para la cuál no tenía un envío programado
missing-train=No se pudo encontrar ningún tren en la red correcta para hacer un envío desde __2__ hasta __1__
no-train-has-capacity=No se pudo encontrar ningún tren con capacidad de carga suficiente para hacer un envío desde __2__ hasta __1__
no-train-matches-r-layout=No se pudo encontrar ningún tren en la lista de permitidos de __1__ para hacer una entrega
no-train-matches-p-layout=No se pudo encontrar ningún tren en la lista de permitidos de __1__ para hacer una entrega a __1__
[cybersyn-gui]
combinator-title=Combinador cibernético
operation=Modo
comb1=Estación
depot=Depósito
refueler=Reabastecedor de combustible
comb2=Control de estación
wagon-manifest=Control de vagón
switch-provide=Solo proveer
switch-request=Solo solicitar
switch-provide-tooltip=Bloquear la estación para que solo provea items a la red. La estación provee y solicita al mismo tiempo por defecto.
switch-request-tooltip=Bloquear la estación para que solo solicite items de la red. La estación provee y solicita al mismo tiempo por defecto.
network=Red
network-tooltip=La señal indica a que red pertenece este combinador. Los trenes serán despachados desde depósitos a estaciones proveedoras y solicitadoras, solo si comparten la misma señal.
allow-list-description=Lista de permitidos automática
allow-list-tooltip=Si está marcado, los trenes de la red serán agregados automáticamente a la lista de permitidos, si cada vagón del tren puede ser cargado o descargado por esta estación. Si no está marcado, la lista de permitidos no será utilizada, y todos los trenes podrán frenar aquí.
is-stack-description=Umbrales de pila
is-stack-tooltip=Si está marcado, todos los umbrales de solicitud para esta estación serán interpretados como una cuenta de pilas de items en vez de una cuenta de total de items. El umbral para líquidos no es afectado.
enable-inactive-description=Condición de inactividad
enable-inactive-tooltip=Si está marcado, un tren en un proveedor deberá esperar por inactividad, incluso si su orden ya fue completada. Esto es util frecuentemente para prevenir que los insertadores queden trabados con items en sus manos.
use-same-depot-description=Requerir mismo depósito
use-same-depot-tooltip=Si está marcado, los trenes de este depósito, siempre deben volver al mismo depósito. Si no está marcado, el tren puede volver a cualquier depósito con el mismo nombre que esta.
depot-bypass-description=Evitar depósito
depot-bypass-tooltip=Si está marcado, los trenes de este depósito no tienen que estar frenados aquí para recibir nuevas ordenes, solo tienen que no tener ordenes activas. El tren volverá igualmente a este depósito si tiene poco combustible y no hay reabastecedores de combustible disponibles.
enable-slot-barring-description=Bloquear espacios sin filtrar
enable-slot-barring-tooltip=Si está marcado, cualquier espacio de un vagón adjacente que no este filtrado será bloqueado para que no pueda ser cargado con ningún item.

View File

@@ -0,0 +1,59 @@
[mod-name]
cybersyn=Project Cybersyn
[controls]
cybersyn-toggle-gui=Alternar Cybersyn Manager
[cybersyn-gui]
alerts=Alertas
all-paren=(Todos)
clear-history=Limpiar historial
control-signals=Señales de control
;history=Historial
in-transit=En tránsito
inventory=Inventario
layout=Disposición del tren
name=Nombre
network-name-label=Filtro de la red:
network-id-label=ID de la red:
network-id=ID de la red
no-alerts=[img=warning-white] No hay alertas
;no-history=[img=warning-white] No hay historial
no-stations=[img=warning-white] No hay estaciones
;not-available=No disponible
no-trains=[img=warning-white] No hay trenes
open-station-gui=Abrir GUI de la estación\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Abrir estación en el mapa\n[font=default-semibold][color=128,206,240]Control:[/color][/font] Abrir Combinador Cibernético de la estación\n[font=default-semibold][color=128,206,240]Alt:[/color][/font] Abrir Combinador Cibernético de la estación de control
open-train-gui=Abrir GUI del tren
provided=Proveido
;provided-requested-description=Green = proveido\nRed = solicitado
provided-requested=Proveido / solicitado
;refresh-tooltip=Actualizar\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Alternar auto-actualizar
requested=Solicitado
search-label=Nombre de la estación:
search-item-label=Filtro del item:
;shipments-description=Green = Entrante\nBlue = Saliente
shipment=Envío
shipments=Envíos
stations=Estaciones
status=Señal de la red
surface-label=Superficie:
time=Tiempo
train-id=ID del tren
trains=Trenes
[cybersyn-message]
error-cybernetic-combinator-not-found=No se pudo encontrar combinador cibernético para esta estación.
error-station-control-combinator-not-found=No se pudo encontrar el control de estación combinador cibernético para esta estación.
error-station-is-invalid=La estación es inválida, por favor actualice la GUI.
error-train-is-invalid=El tren es inválido, por favor actualice la GUI.
error-cross-surface-camera-invalid=No se puede mover la cámara a una entidad en otra superficie!
[cybersyn-mod-setting-description]
iterations-per-tick=Reduzca este numero si esta teniendo problemas con el rendimiento.
[cybersyn-mod-setting-name]
history-length=Longitud del historial
iterations-per-tick=Iteraciones por tick [img=info]
[shortcut-name]
cybersyn-toggle-gui=Alternar Cybersyn Manager

View File

@@ -12,6 +12,9 @@ cybersyn-warmup-time=Время "прогрева" станции (сек)
cybersyn-stuck-train-time=Таймаут застревания поезда (сек)
cybersyn-allow-cargo-in-depot=Разрешить поезда с грузом в депо
cybersyn-invert-sign=Инвертировать вывод комбинатора (устаревший параметр)
#cybersyn-manager-enabled=
#cybersyn-manager-update-rate=
#cybersyn-manager-result-limit=
[mod-setting-description]
cybersyn-enable-planner=Включает или отключает алгоритм централизованного планирования. Если этот параметр отключен, новые поезда отправляться не будут.
@@ -27,6 +30,7 @@ cybersyn-warmup-time=Сколько секунд кибернетический
cybersyn-stuck-train-time=По истечении этого количества секунд с момента отправки поезда будет отправлено оповещение, сообщающее вам, что поезд, вероятно, застрял и не завершил свою доставку. Игроку, скорее всего, придется отлаживать свою сеть, чтобы освободить поезд.
cybersyn-allow-cargo-in-depot=Если этот параметр включен, поездам будет разрешено иметь груз во время стоянки в депо; никаких предупреждений генерироваться не будет, и поезд не будет приостановлен. Кроме того, поезда при посещении станций снабжения с включенной настройкой "Условие бездействия" будут ожидать бездействия вместо ожидания полной разгрузки. Полезно для создания железнодорожных систем, в которых депо обрабатывают избыточный груз. Только для продвинутых пользователей.
cybersyn-invert-sign=Изменяет знак сигналов вывода кибернетического комбинатора так, чтобы он был таким же, как в LTN или в более ранних версиях Project Cybersyn.
#cybersyn-manager-result-limit=
[item-name]
cybersyn-combinator=Кибернетический комбинатор

View File

@@ -0,0 +1,57 @@
[mod-name]
cybersyn=Project Cybersyn
[controls]
cybersyn-toggle-gui=Вкл/выкл Cybersyn Менеджер
[cybersyn-gui]
alerts=Тревоги
all-paren=(Все)
control-signals=Контрольные сигналы
;history=History
in-transit=В пути
inventory=Инвентарь
layout=Схема движения поезда
name=Название
network-name-label=Фильтр сети:
network-id-label=ID сети:
network-id=ID сети
no-alerts=[img=warning-white] Тревог нет
;no-history=[img=warning-white] No history
no-stations=[img=warning-white] Станций нет
;not-available=Not available
no-trains=[img=warning-white] Поездов нет
open-station-gui=Открыть интерфейс станции\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Открыть станцию на карте\n[font=default-semibold][color=128,206,240]Control:[/color][/font] Открыть интерфейс кибернетического комбинатора станции\n[font=default-semibold][color=128,206,240]Alt:[/color][/font] Открыть интерфейс кибернетического комбинатора контроля станции
open-train-gui=Открыть интерфейс поезда
provided=Снабжение
;provided-requested-description=Green = provided\nRed = requested
provided-requested=Снабжение / Запрос
;refresh-tooltip=Refresh\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] Toggle auto-refresh
requested=Запрос
search-label=Название станции:
search-item-label=Предметный фильтр:
shipment=Доставка
shipments=Доставки
stations=Станции
status=Сигнал сети
surface-label=Поверхность:
time=Время
train-id=ID поезда
trains=Поезда
[cybersyn-message]
error-cybernetic-combinator-not-found=Не удалось найти кибернетический комбинатор для этой станции.
error-station-control-combinator-not-found=Не удалось найти кибернетический комбинатор контроля станции для этой станции.
error-station-is-invalid=Ошибочная станция, пожалуйста, обновите интерфейс.
error-train-is-invalid=Ошибочный поезд, пожалуйста, обновите интерфейс.
error-cross-surface-camera-invalid=Невозможно переместить камеру на объект, находящийся на другой поверхности!
[cybersyn-mod-setting-description]
iterations-per-tick=Уменьшите это число, если у вас возникли проблемы с производительностью.
[cybersyn-mod-setting-name]
history-length=Длина истории
iterations-per-tick=Итераций за тик [img=info]
[shortcut-name]
cybersyn-toggle-gui=Вкл/выкл Cybersyn Менеджер

View File

@@ -12,6 +12,9 @@ cybersyn-warmup-time=站预热时间(秒)
cybersyn-stuck-train-time=卡住火车超时(秒)
cybersyn-allow-cargo-in-depot=允许仓库中的货物
cybersyn-invert-sign=反转组合器输出(已弃用)
#cybersyn-manager-enabled=
#cybersyn-manager-update-rate=
#cybersyn-manager-result-limit=
[mod-setting-description]
cybersyn-enable-planner=启用或禁用中央计划算法。 如果禁用,则不会派遣新列车。
@@ -27,6 +30,7 @@ cybersyn-warmup-time=Cybernetic 组合器在连接到 Cybersyn 网络之前将
cybersyn-stuck-train-time=在火车调度后的这么多秒后,将发送警报,让您知道火车可能被卡住并且尚未完成交付。 玩家可能必须调试他们的网络才能让火车脱困。
cybersyn-allow-cargo-in-depot=如果选中,火车将被允许在仓库中装载货物; 不会生成任何警报,也不会保留列车。 此外,在选中“不活动状态”的情况下,带有访问请求站点命令的列车将等待不活动状态,而不是等待空载货物。 可用于创建火车系统,其中仓库处理超额货物。 仅限高级用户。
cybersyn-invert-sign=将 Cybernetic 组合器的输出符号翻转为与 LTN 或早期版本的 Cybersyn 项目相同。
#cybersyn-manager-result-limit=
[item-name]
cybersyn-combinator=Cybersyn 组合器

View File

@@ -1,77 +1,49 @@
[mod-name]
cybersyn=Project Cybersyn
[controls]
cybersyn-toggle-gui=切换 LTN 管理器
#cybersyn-toggle-gui=切换 LTN 管理器
[cybersyn-gui]
alert-delivery-failed=发送失败
alert-delivery-failed-description=火车执行任务的时间太长,被 LTN 放弃,或者火车因其他原因而失效。 您可以在模组设置中配置 LTN 等待火车的时间。\n\n计划装运以绿色列出。
alert-provider-missing-cargo-description=在火车离开供应商之前,并未装载所有预定货物。\n\n绿色表示预定装运红色表示实际装运。
alert-provider-missing-cargo=供应商 - 货物丢失
alert-provider-unscheduled-cargo-description=火车离开供应商没有计划/意外的货物。\n\n绿色表示计划装运红色表示计划外装载。
alert-provider-unscheduled-cargo=提供商 - 不定期货物
alert-requester-remaining-cargo-description=在火车离开车站之前,并不是所有的材料都从火车上卸下来,并且它已经带着剩余的货物返回了它的仓库。\n\n剩余的物品以红色列出。
alert-requester-remaining-cargo=请求者 - 剩余货物
alert-requester-unscheduled-cargo-description=火车带着计划外/意外的货物到达请求者。\n\n绿色表示计划装运红色表示计划外装载。
alert-requester-unscheduled-cargo=请求者 - 未安排的货物
alerts=警报
all-paren=(所有)
clear-history=清除历史记录
composition=布局
composition-description=火车的布局。\nL = 机车\nC = 货车\nF = 流体车\nA = 火炮车\n< > = 方向
control-signals=控制信号
delete-alert=删除警报
delete-all-alerts=删除所有警报
delivering-to=交付给
depot=仓库
depots=仓库
dispatcher-disabled-description=LTN 调度器被禁用; 不会创建新的交付。 通过地图设置或使用热键重新启用调度程序。
dispatcher-disabled=LTN 调度器被禁用!
fetching-from=从中获取
finished=完成
history=历史
in-transit=在途
inventory=库存
keep-open=保持开放
loading-at=加载中
#layout=
name=名字
#network-name-label=
network-id-label=网络ID
network-id=网络ID
no-alerts=[img=warning-white] 没有警报
no-depots=[img=warning-white] 没有仓库
no-history=[img=warning-white] 没有历史记录
;no-history=[img=warning-white] 没有历史记录
no-stations=[img=warning-white] 没有站
not-available=不可用
;not-available=不可用
no-trains=[img=warning-white] 没有火车
open-ltn-combinator-gui=[font=default-semibold][color=128,206,240]Control:[/color][/font] 打开 LTN 组合器 GUI
open-station-gui=开站GUI\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] 在地图上开站
open-train-gui=打开火车 GUI
parked-at-depot=停在仓库
parked-at-depot-with-residue=停在有残留物的仓库
provided=提供
provided-requested-description=绿色 = 提供\n红色 = 要求
;provided-requested-description=绿色 = 提供\n红色 = 要求
provided-requested=提供/请求
refresh-tooltip=刷新\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] 切换自动刷新
;refresh-tooltip=刷新\n[font=default-semibold][color=128,206,240]Shift:[/color][/font] 切换自动刷新
requested=请求
returning-to-depot=返回仓库
route=路线
runtime=运行时
search-label=搜索:
shipments-description=绿色 = 入站\n蓝色 = 出站
#search-item-label=
shipment=装运
shipments=出货量
stations=
status-description=[img=flib_indicator_green]1 = 正常状态\n[img=flib_indicator_blue]n = LTN 控制列车停在车站n = 列车数量\n[img=flib_indicator_yellow]n = 车站是预定交付的一部分 , n = 列车数量\n[img=flib_indicator_white]1 = 错误 - 未初始化\n[img=flib_indicator_red]1 = 错误 - 短路\n[img=flib_indicator_red]2 = 错误 - 停用停止
status=状态
#status=状态
surface-label=表面:
time=时间
train-id=列车编号
trains=火车
type=类型
unloading-at=卸载于
[cybersyn-message]
error-ltn-combinator-not-found=找不到该站的 LTN 组合器。
#error-cybernetic-combinator-not-found=
#error-station-control-combinator-not-found=
error-station-is-invalid=站点无效,请刷新 GUI。
error-train-is-invalid=火车无效,请刷新 GUI。
#error-cross-surface-camera-invalid=
[cybersyn-mod-setting-description]
iterations-per-tick=如果你有性能问题,减少这个数字。
@@ -81,4 +53,4 @@ history-length=历史长度
iterations-per-tick=每次滴答的迭代次数[img=info]
[shortcut-name]
cybersyn-toggle-gui=切换 LTN 管理器
#cybersyn-toggle-gui=切换 LTN 管理器

View File

@@ -13,6 +13,9 @@ combinator_entity.radius_visualisation_specification = {
}
combinator_entity.active_energy_usage = "10KW"
if mods["nullius"] then
combinator_entity.localised_name = { "entity-name.cybersyn-combinator" }
end
local COMBINATOR_SPRITE = "__cybersyn__/graphics/combinator/cybernetic-combinator.png"
local COMBINATOR_HR_SPRITE = "__cybersyn__/graphics/combinator/hr-cybernetic-combinator.png"

View File

@@ -7,6 +7,7 @@ combinator_item.subgroup = data.raw["item"]["train-stop"].subgroup
combinator_item.order = data.raw["item"]["train-stop"].order.."-b"
combinator_item.place_result = COMBINATOR_NAME
if mods["nullius"] then
combinator_item.localised_name = { "item-name.cybersyn-combinator" }
-- Enable item in Nullius and place next to the regular train stop
combinator_item.order = "nullius-eca"
end

View File

@@ -1,9 +1,10 @@
--By Mami
combinator_recipe = flib.copy_prototype(data.raw["recipe"]["arithmetic-combinator"], COMBINATOR_NAME)
combinator_recipe.ingredients = {
{"copper-cable", 20},
{"electronic-circuit", 10},
}
--- Recipe is set in data-fixes-final, but in vanilla it should match below
--combinator_recipe.ingredients = {
-- {"copper-cable", 20},
-- {"electronic-circuit", 10},aww
--}
combinator_recipe.enabled = false
combinator_recipe.subgroup = data.raw["recipe"]["train-stop"].subgroup

View File

@@ -66,13 +66,9 @@ function inventory_tab.build(map_data, player_data)
end
end
if search_network_name then
if search_network_name == (NETWORK_EACH or NETWORK_ANYTHING) then
goto has_match
end
if search_network_name ~= station.network_name then
goto continue
end
::has_match::
local train_flag = get_network_mask(station, station.network_name)
if not bit32.btest(search_network_mask, train_flag) then
goto continue
@@ -178,7 +174,7 @@ function inventory_tab.build(map_data, player_data)
tooltip = { "",
img_path,
" [font=default-semibold]",
{ item_string },
item_string,
"[/font]\n"..format.number(count),
},
}
@@ -202,7 +198,7 @@ function inventory_tab.build(map_data, player_data)
tooltip = { "",
img_path,
" [font=default-semibold]",
{ item_string },
item_string,
"[/font]\n"..format.number(count),
},
}
@@ -226,7 +222,7 @@ function inventory_tab.build(map_data, player_data)
tooltip = { "",
img_path,
" [font=default-semibold]",
{ item_string },
item_string,
"[/font]\n"..format.number(count),
},
}

View File

@@ -47,8 +47,14 @@ end
local manager_gui = {}
function manager_gui.on_lua_shortcut(e)
if e.prototype_name == "cybersyn-toggle-gui" or e.input_name == "cybersyn-toggle-gui" then
manager.wrapper(e, manager.handle.manager_toggle)
if e.prototype_name == "cybersyn-toggle-gui" or e.input_name == "cybersyn-toggle-gui" or e.element then
if e.element then
if e.element.name == "manager_window" then
manager.wrapper(e, manager.handle.manager_toggle)
end
else
manager.wrapper(e, manager.handle.manager_toggle)
end
end
end

View File

@@ -35,23 +35,23 @@ end
--- Builds a valid sprite path or returns nil
--- @param item string
--- @return string, string, string
--- @return string, string, LocalizedString
function util.generate_item_references(item)
local sprite = nil
local image_path = ""
local item_name = ""
local item_name
if game.is_valid_sprite_path("item/" .. item) then
sprite = "item/" .. item
image_path = "[img=item." .. item .. "]"
item_name = "item-name." .. item
item_name = {"?", { "item-name." .. item }, { "entity-name." .. item }, "LocalizedString failure: " .. item }
elseif game.is_valid_sprite_path("fluid/" .. item) then
sprite = "fluid/" .. item
image_path = "[img=fluid." .. item .. "]"
item_name = "fluid-name." .. item
item_name = {"?", { "fluid-name." .. item }, "LocalizedString failure: " .. item }
elseif game.is_valid_sprite_path("virtual-signal/" .. item) then
sprite = "virtual-signal/" .. item
image_path = "[img=virtual-signal." .. item .. "]"
item_name = "virtual-signal." .. item
item_name = {"?", { "virtual-signal." .. item }, "LocalizedString failure: " .. item }
end
return sprite, image_path, item_name
end
@@ -78,8 +78,8 @@ function util.slot_table_build_from_manifest(manifest, color)
number = count,
tooltip = {
"",
img_path,
{ item_string },
img_path,
item_string,
"\n"..format.number(count),
},
}
@@ -121,7 +121,7 @@ function util.slot_table_build_from_station(station)
tooltip = {
"",
img_path,
{ item_string },
item_string,
"\n"..format.number(count),
},
number = count
@@ -158,7 +158,7 @@ function util.slot_table_build_from_deliveries(station)
tooltip = {
"",
img_path,
{ item_string },
item_string,
"\n"..format.number(count),
},
number = count

View File

@@ -6,6 +6,10 @@ local ceil = math.ceil
local min = math.min
local max = math.max
local bit_extract = bit32.extract
local defines_front = defines.rail_direction.front
local defines_back = defines.rail_direction.back
local defines_straight = defines.rail_connection_direction.straight
local search_type = {"straight-rail", "curved-rail"}
---@param layout_pattern (0|1|2|3)[]
@@ -417,7 +421,7 @@ function unset_wagon_combs(map_data, stop)
end
end
local type_filter = {"inserter", "pump", "arithmetic-combinator", "loader-1x1"}
---@param map_data MapData
---@param stop Station|Refueler
---@param is_station_or_refueler boolean
@@ -432,10 +436,10 @@ function reset_stop_layout(map_data, stop, is_station_or_refueler, forbidden_ent
return
end
local rail_direction_from_stop
if stop.entity_stop.connected_rail_direction == defines.rail_direction.front then
rail_direction_from_stop = defines.rail_direction.back
if stop.entity_stop.connected_rail_direction == defines_front then
rail_direction_from_stop = defines_back
else
rail_direction_from_stop = defines.rail_direction.front
rail_direction_from_stop = defines_front
end
local stop_direction = stop.entity_stop.direction
local surface = stop.entity_stop.surface
@@ -446,38 +450,67 @@ function reset_stop_layout(map_data, stop, is_station_or_refueler, forbidden_ent
local area_delta
local is_ver
if stop_direction == defines.direction.north then
search_area = {left_top = {x = middle_x - reach, y = middle_y}, right_bottom = {x = middle_x + reach, y = middle_y + 6}}
area_delta = {x = 0, y = 7}
search_area = {{middle_x - reach, middle_y}, {middle_x + reach, middle_y + 6}}
area_delta = {0, 7}
is_ver = true
elseif stop_direction == defines.direction.east then
search_area = {left_top = {y = middle_y - reach, x = middle_x - 6}, right_bottom = {y = middle_y + reach, x = middle_x}}
area_delta = {x = -7, y = 0}
search_area = {{middle_x - 6, middle_y - reach}, {middle_x, middle_y + reach}}
area_delta = {-7, 0}
is_ver = false
elseif stop_direction == defines.direction.south then
search_area = {left_top = {x = middle_x - reach, y = middle_y - 6}, right_bottom = {x = middle_x + reach, y = middle_y}}
area_delta = {x = 0, y = -7}
search_area = {{middle_x - reach, middle_y - 6}, {middle_x + reach, middle_y}}
area_delta = {0, -7}
is_ver = true
elseif stop_direction == defines.direction.west then
search_area = {left_top = {y = middle_y - reach, x = middle_x}, right_bottom = {y = middle_y + reach, x = middle_x + 6}}
area_delta = {x = 7, y = 0}
search_area = {{middle_x, middle_y - reach}, {middle_x + 6, middle_y + reach}}
area_delta = {7, 0}
is_ver = false
else
assert(false, "cybersyn: invalid stop direction")
end
local length = 2
local length = 1
---@type LuaEntity?
local pre_rail = stop_rail
local layout_pattern = {0}
local type_filter = {"inserter", "pump", "arithmetic-combinator", "loader-1x1"}
local wagon_number = 0
for i = 1, 112 do
local rail, rail_direction, rail_connection_direction = pre_rail.get_connected_rail({rail_direction = rail_direction_from_stop, rail_connection_direction = defines.rail_connection_direction.straight})
if not rail or not rail.valid then
is_break = true
break
if pre_rail then
local rail, rail_direction, rail_connection_direction = pre_rail.get_connected_rail({rail_direction = rail_direction_from_stop, rail_connection_direction = defines_straight})
if not rail or rail_connection_direction ~= defines_straight then
-- There is a curved rail or break in the tracks at this point
-- We are assuming it's a curved rail, maybe that's a bad assumption
-- We stop searching to expand the allow list after we see a curved rail
-- We are allowing up to 3 tiles of extra allow list usage on a curved rail
length = length + 3
pre_rail = nil
else
pre_rail = rail
length = length + 2
end
end
pre_rail = rail
length = length + 2
if length%7 <= 1 then
if length >= 6 or not pre_rail then
if not pre_rail then
if length <= 0 then
-- No point searching nothing
-- Once we hit a curve and process the 3 extra tiles we break here
-- This is the only breakpoint in this for loop
break
end
-- Minimize the search_area to include only the straight section of track and the 3 tiles of the curved rail
local missing_rail_length = 6 - length
if missing_rail_length > 0 then
if stop_direction == defines.direction.north then
search_area[2][2] = search_area[2][2] - missing_rail_length
elseif stop_direction == defines.direction.east then
search_area[1][1] = search_area[1][1] + missing_rail_length
elseif stop_direction == defines.direction.south then
search_area[1][2] = search_area[1][2] + missing_rail_length
else
search_area[2][1] = search_area[2][1] - missing_rail_length
end
end
end
length = length - 7
wagon_number = wagon_number + 1
local supports_cargo = false
local supports_fluid = false
@@ -486,7 +519,7 @@ function reset_stop_layout(map_data, stop, is_station_or_refueler, forbidden_ent
type = type_filter,
})
for _, entity in pairs(entities) do
if entity.valid and entity ~= forbidden_entity then
if entity ~= forbidden_entity then
if entity.type == "inserter" then
if not supports_cargo then
local pos = entity.pickup_position
@@ -566,10 +599,6 @@ function reset_stop_layout(map_data, stop, is_station_or_refueler, forbidden_ent
end
search_area = area.move(search_area, area_delta)
end
if rail_connection_direction ~= defines.rail_connection_direction.straight then
is_break = true
break
end
end
stop.layout_pattern = layout_pattern
if is_station_or_refueler then
@@ -593,47 +622,55 @@ function update_stop_if_auto(map_data, stop, is_station_or_refueler, forbidden_e
end
end
---@param map_data MapData
---@param entity LuaEntity
---@param forbidden_entity LuaEntity?
---@param force boolean?
local function resolve_update_stop_from_rail(map_data, entity, forbidden_entity, force)
local id = entity.unit_number--[[@as uint]]
local is_station = true
---@type Station|Refueler
local stop = map_data.stations[id]
if not stop then
stop = map_data.refuelers[id]
is_station = false
end
if stop and stop.entity_stop.valid then
if force then
reset_stop_layout(map_data, stop, is_station, forbidden_entity)
elseif not stop.allows_all_trains then
reset_stop_layout(map_data, stop, is_station, forbidden_entity)
end
end
end
---@param map_data MapData
---@param rail LuaEntity
---@param forbidden_entity LuaEntity?
---@param force boolean?
function update_stop_from_rail(map_data, rail, forbidden_entity, force)
--NOTE: is this a correct way to figure out the direction?
---@type LuaEntity?
local rail_front = rail
---@type LuaEntity?
local rail_back = rail
---@type defines.rail_direction
local rail_direction = defines.rail_direction.back
local entity = rail.get_rail_segment_entity(rail_direction, false)
if not entity then
rail_direction = defines.rail_direction.front
entity = rail.get_rail_segment_entity(rail_direction, false)
end
for i = 1, 112 do
if not entity or not entity.valid then
return
end
if entity.name == "train-stop" then
local id = entity.unit_number--[[@as uint]]
local is_station = true
---@type Station|Refueler
local stop = map_data.stations[id]
if not stop then
stop = map_data.refuelers[id]
is_station = false
if rail_back then
local entity = rail_back.get_rail_segment_entity(defines_back, false)
if entity and entity.name == "train-stop" then
resolve_update_stop_from_rail(map_data, entity, forbidden_entity, force)
return
end
if stop and stop.entity_stop.valid then
if force then
reset_stop_layout(map_data, stop, is_station, forbidden_entity)
elseif not stop.allows_all_trains then
reset_stop_layout(map_data, stop, is_station, forbidden_entity)
end
rail_back = rail_back.get_connected_rail({rail_direction = defines_back, rail_connection_direction = defines_straight})
end
if rail_front then
local entity = rail_front.get_rail_segment_entity(defines_front, false)
if entity and entity.name == "train-stop" then
resolve_update_stop_from_rail(map_data, entity, forbidden_entity, force)
return
end
return
rail_front = rail_front.get_connected_rail({rail_direction = defines_front, rail_connection_direction = defines_straight})
end
rail = rail.get_connected_rail({rail_direction = rail_direction, rail_connection_direction = defines.rail_connection_direction.straight})--[[@as LuaEntity]]
if not rail or not rail.valid then
return
end
entity = rail.get_rail_segment_entity(rail_direction, false)
end
end
@@ -650,20 +687,46 @@ end
---@param forbidden_entity LuaEntity?
function update_stop_from_inserter(map_data, inserter, forbidden_entity)
local surface = inserter.surface
local pos0 = inserter.position
local pos1 = inserter.pickup_position
local pos2 = inserter.drop_position
local has_found = false
--NOTE: we don't use find_entity solely for miniloader compat
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = inserter.pickup_position,
radius = 1,
type = search_type,
position = pos1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
has_found = true
end
rails = surface.find_entities_filtered({
type = search_type,
position = pos2,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
has_found = true
end
if has_found then
return
end
-- We need to check secondary positions because of weird modded inserters.
-- Mostly because of miniloaders not aligning with the hitbox of a rail by default.
pos1.x = pos1.x + 0.2*(pos1.x - pos0.x)
pos1.y = pos1.y + 0.2*(pos1.y - pos0.y)
pos2.x = pos2.x + 0.2*(pos2.x - pos0.x)
pos2.y = pos2.y + 0.2*(pos2.y - pos0.y)
rails = surface.find_entities_filtered({
type = search_type,
position = pos1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
rails = surface.find_entities_filtered({
type = "straight-rail",
position = inserter.drop_position,
radius = 1,
type = search_type,
position = pos2,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
@@ -681,86 +744,29 @@ function update_stop_from_loader(map_data, loader, forbidden_entity)
if loader_type == "input" then --loading train
if direction == defines.direction.east then
position.x = position.x + 1 -- input and facing east -> move on X axis 1 to the right
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
elseif direction == defines.direction.south then
position.y = position.y + 1 -- input and facing south -> move on Y axis down 1 unit
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
elseif direction == defines.direction.west then
position.x = position.x - 1 -- input and facing west -> move on X axis 1 to the left
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
elseif direction == defines.direction.north then
position.y = position.y - 1 -- input and facing south -> move on Y axis up 1 unit
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
end
elseif loader_type == "output" then --unloading train
if direction == defines.direction.east then
position.x = position.x - 1 -- output and facing east -> move on X axis 1 to the left
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
elseif direction == defines.direction.south then
position.y = position.y - 1 -- output and facing south -> move on Y axis up 1 unit
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
elseif direction == defines.direction.west then
position.x = position.x + 1 -- output and facing west -> move on X axis 1 to the right
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
elseif direction == defines.direction.north then
position.y = position.y + 1 -- output and facing south -> move on Y axis down 1 unit
local rails = surface.find_entities_filtered({
type = "straight-rail",
position = position,
radius = 1,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
end
end
end
local rails = surface.find_entities_filtered({
type = search_type,
position = position,
})
if rails[1] then
update_stop_from_rail(map_data, rails[1], forbidden_entity)
end
end

View File

@@ -624,7 +624,7 @@ local function on_built(event)
update_stop_from_loader(global, entity)
elseif entity.type == "pump" then
update_stop_from_pump(global, entity)
elseif entity.type == "straight-rail" then
elseif entity.type == "straight-rail" or entity.type == "curved-rail" then
update_stop_from_rail(global, entity)
end
end
@@ -642,7 +642,7 @@ local function on_broken(event)
update_stop_from_loader(global, entity, entity)
elseif entity.type == "pump" then
update_stop_from_pump(global, entity, entity)
elseif entity.type == "straight-rail" then
elseif entity.type == "straight-rail" or entity.type == "curved-rail" then
update_stop_from_rail(global, entity, nil)
elseif entity.train then
local train_id = entity.train.id
@@ -847,17 +847,26 @@ local function grab_all_settings()
end
local function register_tick()
script.on_nth_tick(nil)
if mod_settings.tps > DELTA then
local nth_tick_main = ceil(60/mod_settings.tps)--[[@as uint]]
script.on_nth_tick(nth_tick_main, function()
--edge case catch to register both main and manager tick if they're scheduled to run on the same ticks
if mod_settings.manager_enabled and mod_settings.manager_ups == mod_settings.tps and mod_settings.tps > DELTA then
local nth_tick = ceil(60/mod_settings.tps)
script.on_nth_tick(nth_tick, function()
tick(global, mod_settings)
end)
end
if mod_settings.manager_enabled and mod_settings.manager_ups > DELTA then
local nth_tick_manager = ceil(60/mod_settings.manager_ups)--[[@as uint]]
script.on_nth_tick(nth_tick_manager, function()
manager.tick(global)
end)
else
if mod_settings.tps > DELTA then
local nth_tick_main = ceil(60/mod_settings.tps)--[[@as uint]]
script.on_nth_tick(nth_tick_main, function()
tick(global, mod_settings)
end)
end
if mod_settings.manager_enabled and mod_settings.manager_ups > DELTA then
local nth_tick_manager = ceil(60/mod_settings.manager_ups)--[[@as uint]]
script.on_nth_tick(nth_tick_manager, function()
manager.tick(global)
end)
end
end
end
local function on_settings_changed(event)
@@ -876,6 +885,7 @@ local filter_built = {
{filter = "type", type = "inserter"},
{filter = "type", type = "pump"},
{filter = "type", type = "straight-rail"},
{filter = "type", type = "curved-rail"},
{filter = "type", type = "loader-1x1"},
}
local filter_broken = {
@@ -884,6 +894,7 @@ local filter_broken = {
{filter = "type", type = "inserter"},
{filter = "type", type = "pump"},
{filter = "type", type = "straight-rail"},
{filter = "type", type = "curved-rail"},
{filter = "type", type = "loader-1x1"},
{filter = "rolling-stock"},
}
@@ -953,6 +964,7 @@ local function main()
script.on_event(defines.events.on_player_removed, manager.on_player_removed)
script.on_event(defines.events.on_player_created, manager.on_player_created)
script.on_event(defines.events.on_lua_shortcut, manager.on_lua_shortcut)
script.on_event(defines.events.on_gui_closed, manager.on_lua_shortcut)
script.on_event("cybersyn-toggle-gui", manager.on_lua_shortcut)
end

View File

@@ -1,6 +1,8 @@
--By Mami
local flib_migration = require("__flib__.migration")
local manager_gui = require('gui.main')
local debug_revision = require('info')
local check_debug_revision
local migrations_table = {
@@ -298,7 +300,9 @@ local migrations_table = {
---@type MapData
local map_data = global
manager_gui.on_init()
map_data.manager = {
players = {},
}
for i, v in pairs(game.players) do
manager_gui.on_player_created({player_index = i})
end
@@ -318,18 +322,52 @@ local migrations_table = {
end,
}
--STATUS_R_TO_D = 5
---@param data ConfigurationChangedData
function on_config_changed(data)
for i, v in pairs(global.manager.players) do
manager_gui.reset_player(i, v)
end
global.tick_state = STATE_INIT
global.tick_data = {}
flib_migration.on_config_changed(data, migrations_table)
for i, v in pairs(global.manager.players) do
manager_gui.reset_player(i, v)
end
IS_SE_PRESENT = remote.interfaces["space-exploration"] ~= nil
if IS_SE_PRESENT and not global.se_tele_old_id then
global.se_tele_old_id = {}
end
if global.debug_revision ~= debug_revision then
global.debug_revision = debug_revision
if debug_revision then
on_debug_revision_change()
end
end
end
---NOTE: this runs before on_config_changed
---It does not have access to game
---NOTE 2: Everything in this section must be idempotent
function on_debug_revision_change()
local map_data = global
if debug_revision == 1 then
for _, e in pairs(map_data.refuelers) do
if e.network_flag ~= nil then
e.network_mask = e.network_flag
e.network_flag = nil
end
end
for _, e in pairs(map_data.stations) do
if e.network_flag ~= nil then
e.network_mask = e.network_flag
e.network_flag = nil
end
end
for _, e in pairs(map_data.trains) do
if e.network_flag ~= nil then
e.network_mask = e.network_flag
e.network_flag = nil
end
end
end
end