[MOD 0.15] SmartTrains 2.0.5

Topics and discussion about specific mods
Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.4

Post by Vin »

Choumiko wrote:
Vin wrote:Do I need to hard reset the mod to get the toggle to work?

And it's line 69 of control.lua, yeah?
Yeah, control.lua. No hard reset should be needed. And while you're at it, change line 421 in Train.lua to

Code: Select all

if s then self.train.carriages[1].surface.create_entity({name="flying-text", position=pos, text=msg, color=color}) end
Then it works, finally :D
Brilliant! Thanks for the support. Worth mentioning that reloading the save isn't sufficient, restarting the game is required.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

[0.12.2+] SmartTrains 0.3.5

Post by Choumiko »

Updated to 0.3.5
Changes:
  • added Smart trainstop:
    • Unlocks with normal trainstop, requires power for the "smart part"
    • Trainlines have a new rule: leave when signal. Makes the train leave when the lamps condition that is created with the smart train stop is fulfilled. If the trainstop has no power, the condition will always be false.
    • Rule can be set to wait forever, else it leaves after the time.
    • Additionally you can set a station number for the rule. If the signal is true, the train is going to the station with that number (number is shown before the station name in the rules window). Basically giving you a "If signal then goto Station x else goto next Station in the schedule"
  • fix toggleFlyingText having no effect
Image
When placing down a smart trainstop, it also places down a lamp. Connect it with wires and set the condition when the train should leave. For trains that don't have a rule set the trainstop behaves like the vanilla one.
Vin wrote:Brilliant! Thanks for the support. Worth mentioning that reloading the save isn't sufficient, restarting the game is required.
Strange, i didn't have to restart. Guess it doesn't matter since updating to 0.3.5 requires a restart anyways :D

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Vin »

Choumiko wrote:Updated to 0.3.5 ...
Smart Trains, with bonus Smart Train Stops?

Love the update. Going to work wonders on needless trains causing congestion.

Ninja edit: Does connecting the wire directly from the lamp to the stop work also? Or does it use the old style of requiring the pole?

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Choumiko »

Vin wrote:Ninja edit: Does connecting the wire directly from the lamp to the stop work also? Or does it use the old style of requiring the pole?
You don't need to connect the trainstop, only the lamp that comes with it. But yes, it doesn't need a pole to connect the wires

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Vin »

Just wanted to post with an endorsement - Smart Trains does exactly what it says on the tin and is amazing. Certainly sets a high bar for the base game in 0.13!

@Choumiko: You might want to mention in the OP somewhere that ST works by messing with the manual/automatic train modes. It didn't cause a problem once I realized what was happening, but it does cause some interesting behaviors like telling a train to wait for you while you mess with the train stop and having it leave, or having FAT controller tell you a train is on manual when it's waiting for a signal/empty/etc.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Choumiko »

Vin wrote:Just wanted to post with an endorsement - Smart Trains does exactly what it says on the tin and is amazing. Certainly sets a high bar for the base game in 0.13!.
Thanks :)

I will update the post tomorrow, only got the phone right now, and editing is a pain in it.
For now: They should only switch to manual mode when they arrive at a station where Wait forever is set in the rules. If you move one of these trains by hand, it should be in true manual mode and not go back to auto. If they do, please report.
About FAT: I've been toying with the idea to integrate the ui into it if it's installed, as it gets quite full with FAT, SmartTrains and vanilla ui. Might give it a shot tomorrow and see if I can find a way to disable the alerts for trains that are waiting.

Next up is making the trainstops output the content of a waiting train to the circuit network and/or a special signal if no train is waiting. Further suggestions are welcome.
How about an option to let the circuit rule decide to what station number to go? Imagine a supply train waiting at a station until an outpost got attacked and needs new turrets, repair packs, whatever. Have it send it's station index over the network and off goes the train. at the outpost: Another outpost needs supplies, Good that you setup logic to check whether the train still had supplies, send him to that outpost etc..
But connecting all outposts with wires is tedious.. Have you ever heard of FARL?! :mrgreen:

Edit: Excuse the wall of text, seems I got carried away a bit

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Vin »

If I was going to design an outpost system for resupply, I would probably do the reverse. I would have a small train (likely even a 1-1-1) sitting at each outpost. When the train becomes low in something from inserters taking out of it to supply the outpost, and the stop would send the train to a standard resupply station at the main base. Using combinators with a train stop that reports the contents would make it possible to tell if the train was low on anything, rather than just one item. It's much less elegant in the sense that you have an unused stack of items sitting in each train car at each outpost (not to mention the materials for the train itself), but it doesn't require a map wide circuit network with a proxy signal for each stop.

Your system would be extremely slick though. Very little waste, very little added traffic. The setup would be much more complex, but once you have a blueprint for the outpost it shouldn't be too hard to change the signal for each one. It makes me wish the biters (or something else) were a more persistent threat that required defense like that, not just exterminating them all with a shotgun whenever they start to annoy you. :D

It's probably also worth mentioning that with circuit integration, the playstyle of having production spread out into "towns" is much, much more managable. Trains only leaving to get resources when they're needed and knowing where to go to get them is incredible.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Boogieman14 »

This is a really cool mod! Only just started messing around with it and I'm already liking the possibilites :)

There's one thing I'm trying to do, but not quite sure how to approach this. I have coal storage in my main base. The storage places a signal on my circuit network for the amount of coal. In the mining outpost, I have a smart train stop connected to this circuit network to send the train on its way when coal < 8000. This works when coal has been > 8000 for a while, but if coal < 8000 when the train gets there, it obviously departs again straight away, leaving no time to load. Is there a simple way to make the train wait a minimum time in this case (or some other combination of factors?) I've seen the min waiting time and the interval for autodepart, but I expect those will also apply to checks for leave when empty, where I don't want the train to wait any second longer than required.

I suppose if there's a way to detect when a train is at the stop, it would be easy enough to build some kind of timer.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Vin »

It sounds like to me you're putting the smart stop in the wrong place.

If you only have one train, then it's fairly simple to put a smart stop at the unload and just have the train sit at unload until coal < 8000.

If you have multiple trains, you'll have to use an exit stacker. For example, your schedule would look something like Coal Mine > Coal Dropoff > Coal Stacker. Your stacker would be the one with the smart stops, only letting coal trains run when coal is < 8000.

The above system could even work in tiers, taking advantage of the stacker. If coal is < 8000, run all the trains. If coal is < 12000, run all but one of the trains, and so on.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by ssilk »

Instead of having a refuel station for every kind of train, I think it would be more useful to have a sensor, that emits true, if there is a locomotive. The programming of the smart inserters is then just a minute.

Eventually possible with the Rail logic system https://forums.factorio.com/forum/vie ... 93&t=14105
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Choumiko »

Vin wrote:It makes me wish the biters (or something else) were a more persistent threat that required defense like that, not just exterminating them all with a shotgun whenever they start to annoy you. :D

It's probably also worth mentioning that with circuit integration, the playstyle of having production spread out into "towns" is much, much more managable. Trains only leaving to get resources when they're needed and knowing where to go to get them is incredible.
Lowering the minimum distance for biter bases to player objects could help, as well as reducing time between expansions :D But yeah, if you clear enough bases resupply is a non issue most of the time i guess. Can't say it for 0.12 though, still haven't played much.
Yeah, i think the circuit integration can easily shift gameplay to be more like a transport/logistics simulation of sorts if one wants to go that route :)
Boogieman14 wrote:This is a really cool mod! Only just started messing around with it and I'm already liking the possibilites :)

There's one thing I'm trying to do, but not quite sure how to approach this. I have coal storage in my main base. The storage places a signal on my circuit network for the amount of coal. In the mining outpost, I have a smart train stop connected to this circuit network to send the train on its way when coal < 8000. This works when coal has been > 8000 for a while, but if coal < 8000 when the train gets there, it obviously departs again straight away, leaving no time to load. Is there a simple way to make the train wait a minimum time in this case (or some other combination of factors?) I've seen the min waiting time and the interval for autodepart, but I expect those will also apply to checks for leave when empty, where I don't want the train to wait any second longer than required.
I suppose if there's a way to detect when a train is at the stop, it would be easy enough to build some kind of timer.
For the current version i'd suggest something like Vin in the post below yours.
Next release will have at least one of the following ways:
  • Set a minimum waiting time per station, the train waits for that time, no matter what.
  • Read the cargo of the train, pseudo code: signal = train at station AND cargo(coal>8000) AND coalstorage < 8000
I didn't mention it in the release, but right now the circuit condition is checked half a second after the train arrives, and then it uses the interval from the settings. Guess i'll add a setting to have different intervals for the rules.

I think i should allow the full/empty rule being combined via AND/OR with the circuit rule, this should enable a lot of contraptions with combinators
ssilk wrote:Instead of having a refuel station for every kind of train, I think it would be more useful to have a sensor, that emits true, if there is a locomotive. The programming of the smart inserters is then just a minute.
Eventually possible with the Rail logic system https://forums.factorio.com/forum/vie ... 93&t=14105
That would be the best solution. Since 0.3.4 i think, SmartTrains uses Refuel as a default station name if it doesn't find the "correct" one. So if you're using Rail logic system you can already do that. Different refueling stations are only really needed if you use double headed trains with different numbers of locomotives/cargo wagons. Single headers only need one if the # of locos is the same.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.5

Post by Boogieman14 »

Vin wrote:If you have multiple trains, you'll have to use an exit stacker.
I hadn't considered a stacker, but thinking about it, I think I dislike the concept :) Since I have a one-on-one relationship between my trains and my outpost train stops, it seems rather superfluous to have a separate holding area with room for all my trains when the perfect holding spot already exists at the outpost :)
Choumiko wrote: I think i should allow the full/empty rule being combined via AND/OR with the circuit rule, this should enable a lot of contraptions with combinators
That would certainly offer a solution to my problem. I already figured out (in thought anyway) a way to do it using the sensors from the mod Ssilk just linked to. Sense the contents of the train and only if > desired number AND storage < threshold send the train on its way (should be doable with two or three combinators at most).
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Choumiko »

Updated to 0.3.6
  • added signal output for cargo to smart train stop, with special signals for # of locomotives,cargowagons
    • locomotive signal is set to -1 when no train at a stop
    • every train at a smart stop updates signal, even if not on a line
  • setting for signal updates (every 30 ticks (0.5s) by default)
  • combine (AND) full/empty rule with circuit rule when both are set
  • optional dependency for color-coding, if installed uses the green lamp for smart train stops
The signal output is done by a constant combinator that gets placed like the lamp. Smart stops from the previous version should get updated.
It can output up to 48 different items/fluids (Railtanker mod) for now. I think it should be enough, though i can easily increase it.
Note that the cargo is only output if the train is in auto mode (or set into manual mode by SmartTrains)
You can now select the full/empty rule and the circuit rule, in this case the train will only leave if both are true.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Boogieman14 »

Choumiko wrote:Updated to 0.3.6
[*]combine (AND) full/empty rule with circuit rule when both are set
You Rock! :) Implementing it right now. Noticed one minor quirk: on my train that has Full and signal set as conditions, the floaty text says "waiting for circuit" when the circuit is already 'go' but the cargo isn't full yet. Also, the first time after loading this save with the new version of the mod, I had to manually set the train to go, but this was after changing the rule and the circuit connections, so maybe that's normal.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Choumiko »

Boogieman14 wrote:Noticed one minor quirk: on my train that has Full and signal set as conditions, the floaty text says "waiting for circuit" when the circuit is already 'go' but the cargo isn't full yet. Also, the first time after loading this save with the new version of the mod, I had to manually set the train to go, but this was after changing the rule and the circuit connections, so maybe that's normal.
I know about the floaty text, will fix that after i do some code cleaning. Do you remember the rule that was set before the upgrade and if it was set to wait forever?

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Boogieman14 »

Yeah, before the upgrade, it was set to wait for signal and wait forever. That signal was inactive at the moment I loaded the game (one of the inputs was from "that other" train related logic mod, which I had removed at the same time as this upgrade)


*edit*

Ran into another thingy (can't really call it a problem). After marking a smart train stop with the deconstruction planner, the bots remove the actual train stop but leave the lamp and the combinator behind. Manual removal also fails with a 'this item cannot be mined' message. And I can't even shoot it :roll: :lol:
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Vin »

I'm hesitating updating to 0.3.6 because I'm wondering if it will break my oil network. I currently have oil tanks at outposts connected to the smart stop so that when they are empty (but the train is not full), the train leaves. With the stop throwing the contents of the train onto the network, using an oil condition won't ever allow the train to leave.

If I want to update, do I have to go through to every train stop and use combinators to separate the signals?

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Boogieman14 »

The output is placed on a different part of the train stop (essentially a constant combinator bolted onto a train stop :) ), so the cargo contents aren't automatically broadcast over the network.

(of course, as a safety precaution, I always make a quick backup copy of my save before adding or upgrading any mod, you never know what's going to blow up in your face :) )
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Choumiko »

Boogieman14 wrote:Also, the first time after loading this save with the new version of the mod, I had to manually set the train to go, but this was after changing the rule and the circuit connections, so maybe that's normal.
It could have been the update, since i changed when the signal condition gets polled from the proxy. I just checked if a train that was waiting forever for a signal at the time of the save would leave after loading and setting the signal to true and that seems to work.
Boogieman14 wrote:After marking a smart train stop with the deconstruction planner, the bots remove the actual train stop but leave the lamp and the combinator behind. Manual removal also fails with a 'this item cannot be mined' message. And I can't even shoot it :roll: :lol:
The not being minable/shooting is intentional, thing is, i forgot to add one single line :D
Fixed: https://github.com/Choumiko/SmartTrains ... 0.3.61.zip
For the leftovers: point your mouse over them, and in console use /c game.local_player.selected.destroy()
Vin wrote:If I want to update, do I have to go through to every train stop and use combinators to separate the signals?
What boogieman said is correct, no need to worry (at least about that case). Copying the save before might be a good idea, you never know.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.6

Post by Choumiko »

Updated to 0.3.62
  • update trainline when train is not moving, regardless of state
  • added virtual signal for "train at station" (1 when train is at station, 0 when not)
  • reset signals when train is put into manual mode
The values the virtual signals are set to depending on train at station/not at station might change. Haven't used combinators really, so i'm not sure what would be the best values.

Post Reply

Return to “Mods”