Tenders.

Place to get help with not working mods / modding interface.
Post Reply
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Tenders.

Post by bobingabout »

I'm looking at making some train related things, one of the ideas is a steam powered tender engine, of which you'd actually need 2 tenders (one for coal, the other for water) because it's not possible to put both items and fluids in the same cargo wagon... (Looking at the wiki, Cargo wagons and Fluid wagons, along with all other train related entities (locomotive and artillery wagon) inherit nearly all properties from rolling stock, only one adds inventory size, and the other (fluid) capacity, so the only real reason why you can't do both in one is because the devs said so) Anyway, that's besides the point.

The issue is... Orders. "Wait until full" and "Wait until empty" check the contents vs capacity of all cargo and fluid wagons in the train... Tenders carry fuel, not cargo. The answer to this question is probably no, but... is there any way to make these order conditions ignore the contents of certain wagons? (I've looked and see no reference for this)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Tenders.

Post by darkfrei »

bobingabout wrote:
Fri May 29, 2020 6:18 pm
The issue is... Orders. "Wait until full" and "Wait until empty" check the contents vs capacity of all cargo and fluid wagons in the train... Tenders carry fuel, not cargo. The answer to this question is probably no, but... is there any way to make these order conditions ignore the contents of certain wagons? (I've looked and see no reference for this)
We can ask modding interface request about the new entity attribute for wagons, something like:
wagon_entity.ignore_content_wait_condition = true
Or periodically full the cargo, and on next tick delete this added amount.
Or manually read contents and skip the wait condition.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Tenders.

Post by bobingabout »

darkfrei wrote:
Fri May 29, 2020 7:52 pm
bobingabout wrote:
Fri May 29, 2020 6:18 pm
The issue is... Orders. "Wait until full" and "Wait until empty" check the contents vs capacity of all cargo and fluid wagons in the train... Tenders carry fuel, not cargo. The answer to this question is probably no, but... is there any way to make these order conditions ignore the contents of certain wagons? (I've looked and see no reference for this)
We can ask modding interface request about the new entity attribute for wagons, something like:
wagon_entity.ignore_content_wait_condition = true
Or periodically full the cargo, and on next tick delete this added amount.
Or manually read contents and skip the wait condition.
Something like that would be useful. I'd open another request, but I already have 4 open bug reports and 3 interface requests that are pretty much all just being ignored. (Okay, 1 bug report is me just being picky about a graphics inconsistency, and 1 is assigned to Posila... but the rest seem like they're being ignored)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

mrvn
Smart Inserter
Smart Inserter
Posts: 5703
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Tenders.

Post by mrvn »

How would you make those tenders work? Have a script go through all locomotive, check their internal fuel level and if low pull some solid and liquid from the tenders and convert it to internal fuel?

I think this should be a larger modding interface request making it possible to define both a solid and liquid fuel source for the locomotive directly and their access positions (where does the pump connect, where does the inserter go). Unless you design a very long locomotive it's probably needless to have the tender(s) as separate wagon. Just draw the locomotive with a tender attached.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Tenders.

Post by bobingabout »

mrvn wrote:
Wed Aug 12, 2020 1:24 pm
How would you make those tenders work? Have a script go through all locomotive, check their internal fuel level and if low pull some solid and liquid from the tenders and convert it to internal fuel?

I think this should be a larger modding interface request making it possible to define both a solid and liquid fuel source for the locomotive directly and their access positions (where does the pump connect, where does the inserter go). Unless you design a very long locomotive it's probably needless to have the tender(s) as separate wagon. Just draw the locomotive with a tender attached.
For starters, it would be for a specific locomotive (name in the prototype), so, the script would probably have a list of all prototypes it's supposed to effect (not just ALL locomotives)
Then, similar to how (I think) electric locomotives work, would have no fuel box, but a currently burning dummy fuel item that is topped up via script, so if a solid fuel item, and water is present in the tender(s), then items/fluid are deducted to increase the currently burning energy level.

As for the tender itself, having an actual tender Entity type that can hold a fluid AND items (combination of fluid-wagon and cargo-wagon) would be preferable, but as it stands, you'd need to use a fluid-wagon and cargo-wagon, which would result in wait conditions looking at these two wagons, and waiting for them to be filled/emptied before the train leaves the station.

In theory, if you look at the entity structure on the wiki, both wagons have a parent of type rolling-stock that does all of the train logic, and each just adds a couple of tags(inventory-size for cargo-wagon, capacity for the fluid wagon), so it shouldn't be too hard to make a single entity that does both jobs, the hard part would be writing the GUI, as in theory it would need to show both the fluid and items. then you'd also exclude this new entity from the station conditions, and you've solved the other main issue.
if somebody did have source access to be able to write that, might as well have a go at automatic fuel transfer to the locomotive too.

Also, as for just drawing the locomotive with the tender attached... well, then the tender wouldn't be able to turn independent of the locomotive, would just look like one long block. Also with no wheels in the middle unless you put them in the base layer yourself. The game is pretty much hard-wired to draw a bogie at the front and back end of a locomotive/wagon, and pivots the turning of the entire unit around those. to do anything else is trickery. The longer the entity, the worse the trickery looks.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Tenders.

Post by darkfrei »

The tender is locomotive without acceleration and fuel consuming, it can already accept items, but fluid handling can be done with the same way as https://mods.factorio.com/mod/oil-hauler or https://mods.factorio.com/mod/fluidTrains.

The script takes values from inventory and global saved data, make calculations and sometimes create hidden fuel items in the hidden locomotive fuel inventory or just direct locomotive.energy.
https://lua-api.factorio.com/latest/Lua ... ity.energy

mrvn
Smart Inserter
Smart Inserter
Posts: 5703
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Tenders.

Post by mrvn »

Bob: I know the effect of having a single long entity from the cargo-ships mod I've been playing recently. The cargo/fluid wagon and locomotive is all combined into a single sprite, a rather long one at that at about 3 wagons length. Even without the problems of drawing wheels it looks funny when it turns. Also the position of the hit boxes wanders from the sprite position.

I was thinking more of something like this:
Image

You have the water tank at the front, coal in the middle and the conductor at the back. Something like that should be the same size as our current locomotive and render perfectly fine. I'm looking more for the functionality of a water + fuel using steam locomotive.

None the less you suggestion of having wagons that aren't counted as cargo is perfectly valid. There are plenty of larger steam locomotives with separate tender that this would allow modeling. It just isn't something I crave.


Darkfrei: Ahh, nice trick. Yeah, there is no reason I see why the tender must be a cargo wagon.

So for Bobs separate entities design you would have one locomotive using water, one using coal (or other burnables) and a script to consume both to top off the internal fuel source. Since water has no fuel value the water locomotive wouldn't consume any (maybe you also need a min temperature) so that locomotive could have acceleration and get the internal fuel from the script. So you only need 2 locomotives, not 3.

Bob: thoughts?

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Tenders.

Post by steinio »

The Cargo ship has an invisible loco behind the cargo wagon (ship).
Image

Transport Belt Repair Man

View unread Posts

pleegwat
Filter Inserter
Filter Inserter
Posts: 258
Joined: Fri May 19, 2017 7:31 pm
Contact:

Re: Tenders.

Post by pleegwat »

mrvn wrote:
Thu Aug 13, 2020 3:43 pm
Since water has no fuel value the water locomotive wouldn't consume any
Though historically there were locomotives which ran on only (superheated) water

https://en.wikipedia.org/wiki/Fireless_locomotive#Steam

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Tenders.

Post by bobingabout »

mrvn wrote:
Thu Aug 13, 2020 3:43 pm
I was thinking more of something like this:
Image
That's a Tank engine, not a Tender engine...


Of course, that kind of locomotive would work too, if you use a lot of scripts (and pretty much any solution would), and I wouldn't mind making one, but this topic was supposed to be more about tender engines, where there's an actual separate entity pulled directly behind the locomotive that carries it's fuel.


And yes, I looked at some of the mods Darkfrei linked too (So, I get that there are some script-based solutions), but none really addressed the issue of Tenders.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

mrvn
Smart Inserter
Smart Inserter
Posts: 5703
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Tenders.

Post by mrvn »

bobingabout wrote:
Thu Aug 13, 2020 9:01 pm
And yes, I looked at some of the mods Darkfrei linked too (So, I get that there are some script-based solutions), but none really addressed the issue of Tenders.
It seems to solve the problem of breaking the "wait until full" check. Obviously it doesn't solve the fuel problem. But your initial post only listed the check as problem.

For the fuel you need something else (if it's not to be scripted):

1) allowing items and liquids in a single entity or a way to say fuel sources are shared between entities.
2) an energy source that consumes multiple things, more like a recipe: {input = {{"water", 100}, {"burnable", 1MJ}}, output=2MJ}

Or is there already something like that?

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Tenders.

Post by bobingabout »

mrvn wrote:
Thu Aug 13, 2020 9:37 pm
bobingabout wrote:
Thu Aug 13, 2020 9:01 pm
And yes, I looked at some of the mods Darkfrei linked too (So, I get that there are some script-based solutions), but none really addressed the issue of Tenders.
It seems to solve the problem of breaking the "wait until full" check. Obviously it doesn't solve the fuel problem. But your initial post only listed the check as problem.

For the fuel you need something else (if it's not to be scripted):

1) allowing items and liquids in a single entity or a way to say fuel sources are shared between entities.
2) an energy source that consumes multiple things, more like a recipe: {input = {{"water", 100}, {"burnable", 1MJ}}, output=2MJ}

Or is there already something like that?
Yeah, I was honestly thinking about the recipe thing myself there.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding help”