Changing fluid_boxes / Get output liquid

Place to get help with not working mods / modding interface.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Changing fluid_boxes / Get output liquid

Post by SHiRKiT »

Hello everyone,

I'm trying to make a small mod, but I wanted to solve a few things:
- my custom assembling machine have recipes that outputs sometimes 2, sometimes 3 liquids, depending on the recipe chosen. Can I change the amount of output fluid_boxes on the fly, for a single prototype? Or do I need to have 2 different prototypes?
< - > I thought of making one prototype for recipes with 2 outputs, and another for 3 outputs. I don't mind doing this way, but it's just annoying.
- I want to retrieve the current stack or amount of fluid in the output slots of the assembling machine. Doing an 'entity.getliquid()' gives me the liquid in the input inventory, but nothing gives me the output inventory. I've tried doing 'entity.getinventory' from 1 to 5, but I can only get the modules that are inside it.

Thanks for the help.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by SHiRKiT »

Even if I could somehow edit the contents of the output inventory of the assembling machine would be good enough through lua, I could do a control that handles and actually does the processing of the materials, I just need to be able to manipulate those output inventory slots. Any ideas at all?
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by FreeER »

hm, I thought you could set them to not show the connections that weren't needed for the recipe with off_when_no_fluid_recipe, or is that an 'all or nothing' effect? But I know for a fact that you can't change prototypes on the fly, you'd need two prototypes (though I imagine it would be possible to swap between them as needed using control.lua...that's even more work)
SHiRKiT wrote:Doing an 'entity.getliquid()' gives me the liquid in the input inventory, but nothing gives me the output inventory
I haven't used the liquid stuff since it was added, and at the time it was pretty limited (I don't think you could do much more than get the liquid that was in a pipe)...not sure if it's had any additions/changes since to be honest.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by SHiRKiT »

FreeER wrote:hm, I thought you could set them to not show the connections that weren't needed for the recipe with off_when_no_fluid_recipe, or is that an 'all or nothing' effect?
It doesn't work that way. Even if I put a recipe that has only 2 liquid outputs and I define 3 connections on the prototype, it still shows the 3 exits, even with a 2 output recipe.
FreeER wrote:But I know for a fact that you can't change prototypes on the fly, you'd need two prototypes (though I imagine it would be possible to swap between them as needed using control.lua...that's even more work)
That's a good idea actually, and may be the only solution that seems smooth enough to the gamer to me, since I'm already using control.lua to manage some aspects of the logic.
FreeER wrote:I haven't used the liquid stuff since it was added, and at the time it was pretty limited (I don't think you could do much more than get the liquid that was in a pipe)...not sure if it's had any additions/changes since to be honest.
Yeah, I can't even manage the input/output inventory. I can with regular items, but not with liquids. Doesn't make sense why liquids are not part of a super shared interface with items.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by SHiRKiT »

I still wanted to change the fluids inside my inventory. I just can't figure it out how. I'm pretty sure there's a method somewhere out there that's just hidden, but I can't get a list of all methods since the datastructure is an userdata. Maybe someone has some idea on how to find available methods from Lua, since I have no experience at all on it.
drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by drs9999 »

Quote from another thread:
slpwnd wrote:

Code: Select all

game.player.print(game.player.help())
The help() method should work for any rich lua object.
help() will list any available methods/keys that are available for the object it was called from (the player in the example above).

At the moment you can't interact with fluids, they're read-only via getliquid()-method.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by SHiRKiT »

drs9999 wrote:Quote from another thread:
slpwnd wrote:

Code: Select all

game.player.print(game.player.help())
The help() method should work for any rich lua object.
help() will list any available methods/keys that are available for the object it was called from (the player in the example above).

At the moment you can't interact with fluids, they're read-only via getliquid()-method.
Well, can't build my liquid splitter hack then =\ I needed a way to change fluids at the very least, any way would do the trick.
drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by drs9999 »

Just an idea:
Have you tried a asembly machine type building?

The machine has one input and two outputs. You can create recipes that will "transfer" e.g. 0.5 unit of liquid to each output from 1 unit of liquid in the input.

Drawback is that you have to create a recipe for each liquid (could be done in a generic way) and the user have to choose it after building to make it work.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by SHiRKiT »

drs9999 wrote:Just an idea:
Have you tried a asembly machine type building?

The machine has one input and two outputs. You can create recipes that will "transfer" e.g. 0.5 unit of liquid to each output from 1 unit of liquid in the input.

Drawback is that you have to create a recipe for each liquid (could be done in a generic way) and the user have to choose it after building to make it work.
Yeah I did exactly that, but here's the issue: it doesn't balance outputs, like the rest of the pressure system. When one side get's bottlenecked, the assembling machine stops working. I wanted to transfer from one output slot to the other output slot, that's why I needed some way to change fluid's stacksize on those output inventory slots.

Can we somehow summon a dev to take a look at this topic? I think he's the one who can answer this.
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by SHiRKiT »

I'm bumping this to hopefully call the att of devs someday.
User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: Changing fluid_boxes / Get output liquid

Post by cube »

SHiRKiT wrote:I'm bumping this to hopefully call the att of devs someday.
And it worked!

... unfortunately I can't help you with this, because this isn't so easy to be done in half a day and we don't have time for large changes in this part of Factorio.... We plan on doing one feature release with focus on modding improvements, but that is far in the future. 0.13.0? 0.14.0? who knows... sorry.
Post Reply

Return to “Modding help”