Page 1 of 1

fluid-wagon, user defined connection points

Posted: Fri May 15, 2020 12:57 pm
by bobingabout
I tried tried to make a 10 length wagon. Here is the code changes.

Code: Select all

    collision_box = {{-0.6, -4.6}, {0.6, 4.6}},
    selection_box = {{-1, -2.703125}, {1, 5.296875}},
    joint_distance = 8,
This is the result:
https://www.dropbox.com/s/jgbfhboz2c8tb ... 6.png?dl=0

As you can see, only 3 of the 5 pumps try to connect. It's not entirely unexpected, but not the desired behaviour, when placing the pump, the ground does highlight a yellow square around what would be the two far end tanks, they just don't actually connect.

In this specific example, simply having some sort of option to tell it that there should be 5 pump connections would be an acceptable solution, however...
if you're going to allow modders to change the number, why not also the position? (Some rules should still apply, such as them being placed in the middle between tiles, maybe also 2 tiles apart.)

What if a wagon has 2 connection points that are either side of the center? (Maybe it's only a 4 tile long wagon)
what if a wagon is large, but the graphics only have a single pipe connection point? (A lot of IRL fluid wagons look like this)
what if it's a non-symmetrical wagon, and the modder wants a single pipe connection at one of the ends?

Since the graphics for the pump connectors are basically fixed, you probably want to define the connection points only as whole numbers as an offset from the middle of the wagon, 0 being the center, and then increments of -1 or 1 to shift it 1 tile either way... possibly also with the rule that they need to be at least 2 tiles apart.
so, an example of default fluid wagon would be... pump_connection_offsets = -2, 0, 2
Other examples for the scenarios I listed above would be...
pump_connection_offsets = -4, -2, 0, 2, 4
pump_connection_offsets = -1, 1
pump_connection_offsets = 0
pump_connection_offsets = 2

Re: fluid-wagon, user defined connection points

Posted: Fri May 22, 2020 4:47 pm
by bobingabout
Just an update highlighting one of the issues with short wagons:
https://www.dropbox.com/s/0af7o8l0w4vj9 ... 2.png?dl=0

Re: fluid-wagon, user defined connection points

Posted: Sun May 31, 2020 8:49 am
by posila
Pump connector is unfortunatelly pretty much hardcoded for exactly our use case, because it turned out to be so complicated (and everybody now claims they weren't the one who wanted it to be this complicated - that is with pump connecting from the top) ... and I think it is pretty good candidate for the next thing to be reworked.

I don't see more connection points added for 1.0, but adding check that the pump is really next to a wagon _should_ be small safe change, I think. Can you PM the mod with short wagons (or is it already in one of your released mods), so I can see if I can do something about it.

Re: fluid-wagon, user defined connection points

Posted: Sun May 31, 2020 9:02 am
by Optera
posila wrote:
Sun May 31, 2020 8:49 am
I don't see more connection points added for 1.0, but adding check that the pump is really next to a wagon _should_ be small safe change, I think. Can you PM the mod with short wagons (or is it already in one of your released mods), so I can see if I can do something about it.
Depending on implementation of this check I foresee Cargo Ships breaking again.

Re: fluid-wagon, user defined connection points

Posted: Sun May 31, 2020 10:15 pm
by bobingabout
Small wagons having pumps connecting correctly would be a starting point.

PM sent, with mod link.

Re: fluid-wagon, user defined connection points

Posted: Wed Jun 03, 2020 12:58 pm
by boskid
This is kind of implemented in 0.18.30. FluidWagon prototype will have tank_count with allowed values of 1,2 or 3 and default value of 3. No mods should be broken.
Tank connection points will have spacing of 2 as always and set of connectors will be centered.

Re: fluid-wagon, user defined connection points

Posted: Wed Jun 03, 2020 6:27 pm
by Therax
boskid wrote:
Wed Jun 03, 2020 12:58 pm
This is kind of implemented in 0.18.30. FluidWagon prototype will have tank_count with allowed values of 1,2 or 3 and default value of 3. No mods should be broken.
Tank connection points will have spacing of 2 as always and set of connectors will be centered.
This name initially made me think that the initial fluid wagon implementation had been exposed again, that could actually have 3 separate fluidboxes to hold 3 different fluids. Perhaps this should be "tank_connection_count"?

Re: fluid-wagon, user defined connection points

Posted: Thu Jun 04, 2020 6:03 am
by boskid
Therax wrote:
Wed Jun 03, 2020 6:27 pm
This name initially made me think that the initial fluid wagon implementation had been exposed again, that could actually have 3 separate fluidboxes to hold 3 different fluids. Perhaps this should be "tank_connection_count"?
Oh no... this feature is 1 day old and it is already a legacy. Lets say this is minor issue, there are 3 tanks by default but they are all connected and there is no prototype flag to allow them being separated - that way it will be future proof just in case and i will not have to change it breaking mods released since yesterday (if any) that would depend on current name.

Re: fluid-wagon, user defined connection points

Posted: Thu Jun 04, 2020 11:07 am
by bobingabout
I don't mind either way, as long as somebody documents the correct functionality of whatever flag is used on the wiki. My mod that will make use of this isn't anywhere near complete yet.