Can someone explain fluid boxes to me?

Place to get help with not working mods / modding interface.
Post Reply
ATMunn
Inserter
Inserter
Posts: 37
Joined: Thu Jan 12, 2017 2:22 am
Contact:

Can someone explain fluid boxes to me?

Post by ATMunn »

This is now the third time I've posted here for modding help. Is that a good or bad thing?

Anyways, onto the subject. Fluid boxes. I don't understand them well. I was making a machine that melts metals into liquids and vice versa. For the fluid boxes, I decided to just copy it from the assembling machine. I got an error, and in fact the same error I got when I tried changing stuff around. It says this:

Code: Select all

Error while loading entity prototype "melter" (assembling-machine):
Invalid pipe connections specification for offset {0.0, 3.0}.
Modifications: item-group-test
The {0.0, 3.0} bit was specific to a crap ton of decimal places for some reason, but I shortened it for this.
(Also, the name of my mod is item-group-test. That's what it originally was, but it eventually became a mod where I added stuff to it whenever I wanted to try something new XD)
So basically, what I'm saying is, what am I doing wrong? I don't even understand the whole fluid box thing in the first place. And why is it complaining about the pipe connections? It seems whatever value I set them to it still gives an error. This is what I currently have for the fluid boxes section in the entity, if that helps:

Code: Select all

fluid_boxes =
		{
			{
				production_type = "input",
				pipe_covers = pipecoverspictures(),
				base_area = 10,
				base_level = -1,
				pipe_connections = {{ type="input", position = {0, 3} }}
			},
			{
				production_type = "input",
				pipe_covers = pipecoverspictures(),
				base_area = 10,
				base_level = -1,
				pipe_connections = {{ type="input", position = {0, -3} }}
			},
		}

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

Re: Can someone explain fluid boxes to me?

Post by darkfrei »

Why not 2,5 or 3,5?

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Can someone explain fluid boxes to me?

Post by posila »

What is collision box of the melter entity?

In case of assembling machine, green areas represent valid position for fluid box connection. But in reality it has to be in center of tile for pipe to be able to connect to it (represented by blue dots)
fluid-box-restriction2.png
fluid-box-restriction2.png (126.15 KiB) Viewed 2308 times

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

Re: Can someone explain fluid boxes to me?

Post by bobingabout »

base area is how much fluid it can hold, I think it's 10x, so an area of 10 means it can hold 100 fluid.
base level is basically, the height of the box. 0 is ground level, 1 is the top of a standard pipe. setting a value of -1 puts the top of the box at the bottom of a pipe, so, fluid "Falls" in, and can't get out (since the top is level with the bottom of the pipe). a value of 1 would do the reverse, put the bottom of the box at the top of a pipe, so fluids "fall" out of it.
in other words: 1 = output only (and will attempt to empty as fast as possible). -1 = input only (and will attempt to fill as fast as possible). 0 means fluids can freely flow in and out. (and like a pipe, will balance to the level of the pipe next to it)

production_type obviously is to specify if it should be used as a recipe ingredient (input), or a product (output)

pipe_connections holds that array :
type="input" means fluids can only flow into this connection output would mean it can only flow out of it.
position = {0, 3} is an offset from the center. as pointed out by Posila should be in the middle of a tile.
therefore, for Posila's 3x3 example, the range is -2 to 2 in both the X and Y in steps of 1 (so -1, 0 and 1 are valid too). other structures like a 2x2 would be -1.5 to 1.5. (in steps of 1, so that's -0.5 and 0.5) Since it must be at the edge, that means one of the two variables MUST be -2 or 2. And since you can't put it in a corner, the other must not be.

it is possible that multiple connections can be specified on the same box (This is how the steam engine works like a pipe allowing water to pass through into the next in the chain)


I think that's everything important.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

ATMunn
Inserter
Inserter
Posts: 37
Joined: Thu Jan 12, 2017 2:22 am
Contact:

Re: Can someone explain fluid boxes to me?

Post by ATMunn »

To answer posila's question: I copied the code from the electric furnace (because that's what the sprite is based off of) so it's the same as the electric furnace.
After looking through bobingabout's post, I figured out what was wrong with mine. I couldn't actually specify values of 3 or -3 for the pipe connections. I also had both base levels as -1, when the output should have been 1.
This is the new code (which doesn't give me an error)

Code: Select all

fluid_boxes =
		{
			{
				production_type = "input",
				pipe_covers = pipecoverspictures(),
				base_area = 10,
				base_level = -1,
				pipe_connections = {{ type="input", position = {0, 2} }}
			},
			{
				production_type = "input",
				pipe_covers = pipecoverspictures(),
				base_area = 10,
				base_level = 1,
				pipe_connections = {{ type="input", position = {0, -2} }}
			},
		}
I have yet to test it ingame to see if it does what I want, though.
Edit: Derp. I forgot to set the second one to output. That was easy to fix though.

Post Reply

Return to “Modding help”