Train Automated Controller deprecated

by Hermios

The TAC lets you control trains behaviours, based on incoming signals

Content
4 years ago
0.17 - 0.18
9
Logistics
Owner:
Hermios
Source:
N/A
Homepage:
https://forums.factorio.com/viewtopic...
License:
MIT
Created:
5 years ago
Latest Version:
0.2.0 (4 years ago)
Factorio version:
0.17 - 0.18
Downloaded by:
9 users

This mod allows to you control trains behaviour using the logistic network.
The module TAC has an entry and an output for logistic network, (like combinators).
Then, it can be programmed according to different conditions (content of the train, of the logistic network, schedule etc.)
and can act in consequence.
It is composed of rules , and each rule is composed of conditions and actions
To display the content of a rule, click on its name
An action is executed only if all conditions are fulfilled
For technical reasons, the only way to close the graphical interface is to click on "close"

I will add more conditions and actions later, have already some plans (let's activate/deactivate manual mode, group/ungroup train, change scheduler), and am very pleased if some people wish to suggest some improvements
As always, my design is just ridiculous, please feel free to help me improve it
TAC is only activated if a train is in front of it.

For modders:

The TAC has a subsequent remote part.
This is possible to add/remove conditions, and actions:
- addToConditions, (input:method,parameters, text)
- removeFromCondition, (input:text)
- addToActions, (input:method,parameters, text)
- removeFromAction (input:text)

Explanation of inputs
Method is the function called .
For condition, It has 3 inputs: train,signals,params
train is the current train, signals the input signals, params refer to the parameters defined above (See below for further explanation)
The condition method must return a boolean or nil
For train, it has 2 parameters: train and params (Cf. above)
The method action must return a list of signals, or nil. Signals will be propagated on the output of the TAC

parameters: list of parameters, actually LuaGuiElement. Keep it simple (Avoid containers like flows, table etc.)!
some extra options available, like regexp, that allow you to check the content of your text before saving it.
For instance: {name="myText", type="textfield", regexp="%d+"} will force the text to have only digits
Don't use numbers as names, as this may occur some conflicts
The name of each LuaGuiElement will be used for reference in th function.
So, using the example above, I can check that myText value is 3 by writing
function (train,signals, params)
return params.myText=="3"
end

Text is the text (localisationtext possible) used to display the command. it is the reference of it as well (so it has to be unique). To remove a command, use the same text as the one used for adding it.

0.1.2:

Fix that TAC is not properly removed

0.1.1

  • Add new options for actions (Add/Remove station, clean planning, set manual mode, connect trains, go to station)
  • fix bugs
  • For modders: Add an option for parameters: OnInit can call an operation that will be executed before updating data. I use it to load dynamic data (like train stations) in a drop down list