Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
MrSmoothieHuman
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Sat Aug 05, 2023 1:20 am
Contact:

Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by MrSmoothieHuman »

As the title says, a feature i'd like to see implemented within the OffShorePump prototype is to let it be able to choose between, essenitally, how it worked in 1.0 and how it works in 2.0. Im my mind, this would be achievable by just having a new prototype type that lets you select any fluid, which is what the offshore pump would produce when placed down; if its not defined however? it'll just default to using the fluid that the tile currently is.

This would allow for a lot more customization within mods, e.g, if they wanted the player to get a type of water that has to be processed before being usable from offshore pump, instead of only being able to give the player water (Which is what I do in my mod, and is why im asking for this request). It would also save the hassle of having to recreate this in 2.0 without it being an innate feature of the pumps.
coder? i hardly know her!
braxbro
Inserter
Inserter
Posts: 35
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by braxbro »

You may be better suited (especially in this case) by using the much more powerful TileBuildabilityRules that all entities can now use to restrict placement.

With these rules you can make an assembling-machine with a fixed recipe serve as an offshore-pump… but you can also make it yield items in addition to fluids, or require power, or require heat, or any number of other fun things.
User avatar
picklock
Fast Inserter
Fast Inserter
Posts: 237
Joined: Sat Nov 09, 2019 6:49 am
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by picklock »

Yes, TileBuildabilityRules offers a solution and works well so far. However, in the example mentioned or, for example, in one of my mods, it has the disadvantage that when building the entity used as a pump, if it is not an offshore pump, the possible building sites (green squares) on the coast are not displayed.

Or is there a way to display these for other entities / prototypes as well?
My Mods: Picklocks Fusion Power | Picklocks Inserter | Picklocks Lithium Polymer Accumulator | Picklocks rocket silo stats | Picklocks Set Inventory Filters | Picklocks QuickBar Import/Export | Picklocks Nauvis Cliff-Explosives
MrSmoothieHuman
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Sat Aug 05, 2023 1:20 am
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by MrSmoothieHuman »

braxbro wrote: Sun Nov 24, 2024 11:44 pm You may be better suited (especially in this case) by using the much more powerful TileBuildabilityRules that all entities can now use to restrict placement.

With these rules you can make an assembling-machine with a fixed recipe serve as an offshore-pump… but you can also make it yield items in addition to fluids, or require power, or require heat, or any number of other fun things.
That is actually very good to know (and will be useful for future mods i have in mind), but as mentioned by as picklock it lacks some features (the outlined placability); but I would rather have OffShorePumps be more versatile in their usability rather then have to use a workaround.
I will most likely use this system for my buildings for now, thank you :D
coder? i hardly know her!
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3454
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by boskid »

I do not understand, offshore pumps only deduces fluid from tiles if the fluid box prototype does not have a filter set. If filter is set then it does not deduce fluid but sticks to what was given by the prototype - is this mechanism not working? or is it not documented?
User avatar
picklock
Fast Inserter
Fast Inserter
Posts: 237
Joined: Sat Nov 09, 2019 6:49 am
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by picklock »

Hi boskid,

My problem is as follows. In V1.1 of Factorio, I used a modified offshore pump as a dummy in order to be able to place my sewage pump, which also consists of a customized furnace. That worked. It was also possible to place my pump on a pipe with a liquid other than water without any problems.

In V2.0 of Factorio this still works in principle. However, if you want to manually attach my pump to a pipe filled with a fluid other than water, you get an error message and cannot set the pump. There is no filter set for fluids. As you can see from the screenshot, the offshore pump seems to automatically use water as a filter if no filter is set.
sewage-pump_placemant.png
sewage-pump_placemant.png (367 KiB) Viewed 372 times
Here is an excerpt from the code for the modified offshore pump.

Code: Select all

	{
		type = "offshore-pump",
		name = "pi-sewage-pump-d",
		icon = myModName.."/graphics/icons/pi-sewage-pump.png", 
		flags = {"placeable-neutral", "player-creation", "filter-directions"},
		collision_mask = {layers={object=true, train=true, is_object=true, is_lower_object=true}}, -- collide just with object-layer and train-layer which don't collide with water, this allows us to build on 1 tile wide ground
		tile_buildability_rules =
		{
			{area = {{-0.4, -0.4}, {0.4, 0.4}}, required_tiles = {layers={ground_tile=true}}, colliding_tiles = {layers={water_tile=true}}, remove_on_collision = true},
			{area = {{-1, -2}, {1, -1}}, required_tiles = {layers={water_tile=true}}, colliding_tiles = {layers={}}},
		},
		minable = {mining_time = 0.1, result = "pi-sewage-pump-d"},
		fast_replaceable_group = "pi-sewage-pump",
		fluid_source_offset = {0, -1},
		collision_box = {{-0.6, -1.05}, {0.6, 0.3}},
		selection_box = {{-0.6, -1.49}, {0.6, 0.49}},
		damaged_trigger_effect = hit_effects.entity(),
		fluid_box =
		{
			volume = 100,
			pipe_covers = pipecoverspictures(),
			production_type = "input", -- Original "output"
			pipe_connections =
			{
				{
					position = {0, 0},
					direction = defines.direction.south,
					flow_direction = "input", -- Original "output"
				}
			}
		},
		...
I use it for the sewage pump in my Mod Picklocks Fusion Power .

If I enable the customized Furnace via TileBuildabilityRules to use building sites on the coast, I can build my entity, but the possible building sites on the coast are not displayed. So I have to move the mouse along the coast with the entity in my hand until it snaps into place and can be built.
My Mods: Picklocks Fusion Power | Picklocks Inserter | Picklocks Lithium Polymer Accumulator | Picklocks rocket silo stats | Picklocks Set Inventory Filters | Picklocks QuickBar Import/Export | Picklocks Nauvis Cliff-Explosives
braxbro
Inserter
Inserter
Posts: 35
Joined: Sun Jan 01, 2023 2:54 am
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by braxbro »

picklock wrote: Mon Nov 25, 2024 9:15 pmThere is no filter set for fluids.
This would seem to be your problem according to boskid.

Try using <offshore-pump>.fluid_box.filter
boskid wrote: Mon Nov 25, 2024 5:15 pm I do not understand, offshore pumps only deduces fluid from tiles if the fluid box prototype does not have a filter set. If filter is set then it does not deduce fluid but sticks to what was given by the prototype - is this mechanism not working? or is it not documented?
I can confirm it is not clearly documented (publicly, anyway) on the API reference.
User avatar
picklock
Fast Inserter
Fast Inserter
Posts: 237
Joined: Sat Nov 09, 2019 6:49 am
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by picklock »

braxbro wrote: Tue Nov 26, 2024 12:56 pm
picklock wrote: Mon Nov 25, 2024 9:15 pmThere is no filter set for fluids.
This would seem to be your problem according to boskid.

Try using <offshore-pump>.fluid_box.filter
Thanks for the answer. I have already tested this and it works. However, logically only for the fluid set in the filter. However, since you can only filter to a maximum of one fluid (only one fluid is allowed in the filter), this does not solve my problem. My sewage pump should work with any fluid (base game).

The problem mentioned only occurs when building manually. If you set the pump as a ghost and have it built by construction robots or if it is destroyed and rebuilt by construction robots, it works. The problem only occurs since version 2.0 of Factorio. Up to version 1.1, my pump could be connected to pipes with all permitted fluids without any problems.

From my point of view, there are 3 possible solutions to solve my problem:
  1. Restoring the behaviour of the offshore pump as it was in version 1.1.
  2. or displaying the possible building sites on the coast for entities where the tile_buildability_rules are set accordingly (my favourite)
  3. or recognising the fluid in the pipe when trying to set the pump so that you can adjust the filter accordingly. At least I have not found a way to recognise this. The events I already tried were on_built_entity and on_pre_build. Both are not triggered when trying to build the pump to the pipe. Instead theerror schon in my screenshot occours.
My Mods: Picklocks Fusion Power | Picklocks Inserter | Picklocks Lithium Polymer Accumulator | Picklocks rocket silo stats | Picklocks Set Inventory Filters | Picklocks QuickBar Import/Export | Picklocks Nauvis Cliff-Explosives
MrSmoothieHuman
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Sat Aug 05, 2023 1:20 am
Contact:

Re: Let OffshorePumpPrototypes be able to choose wether to give a fluid, or take the fluid from the tile

Post by MrSmoothieHuman »

boskid wrote: Mon Nov 25, 2024 5:15 pm I do not understand, offshore pumps only deduces fluid from tiles if the fluid box prototype does not have a filter set. If filter is set then it does not deduce fluid but sticks to what was given by the prototype - is this mechanism not working? or is it not documented?
currently testing this right now - this was essenitally what i was asking for, if it works how im imagining it too :lol:
I did check out the API docs for the OffshorePump, but theres nothing on there that seems to easily indicate this is possible? I could have missed it, but it does seem to be something that has occured more then once, judging by the replies in this thread - so something that does say this plain and clear on the API page would be very useful :]

tested it: it works! thank you so much, but yeah no this is essenitally what my forum post was asking for in game
coder? i hardly know her!
Post Reply

Return to “Modding interface requests”