Changing fluid_boxes / Get output liquid
Changing fluid_boxes / Get output liquid
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.
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.
Re: Changing fluid_boxes / Get output liquid
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?
Re: Changing fluid_boxes / Get output liquid
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)
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.SHiRKiT wrote:Doing an 'entity.getliquid()' gives me the liquid in the input inventory, but nothing gives me the output inventory
Re: Changing fluid_boxes / Get output liquid
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: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?
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: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)
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.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.
Re: Changing fluid_boxes / Get output liquid
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.
Re: Changing fluid_boxes / Get output liquid
Quote from another thread:
At the moment you can't interact with fluids, they're read-only via getliquid()-method.
help() will list any available methods/keys that are available for the object it was called from (the player in the example above).slpwnd wrote:The help() method should work for any rich lua object.Code: Select all
game.player.print(game.player.help())
At the moment you can't interact with fluids, they're read-only via getliquid()-method.
Re: Changing fluid_boxes / Get output liquid
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 wrote:Quote from another thread:help() will list any available methods/keys that are available for the object it was called from (the player in the example above).slpwnd wrote:The help() method should work for any rich lua object.Code: Select all
game.player.print(game.player.help())
At the moment you can't interact with fluids, they're read-only via getliquid()-method.
Re: Changing fluid_boxes / Get output liquid
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.
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.
Re: Changing fluid_boxes / Get output liquid
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.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.
Can we somehow summon a dev to take a look at this topic? I think he's the one who can answer this.
Re: Changing fluid_boxes / Get output liquid
I'm bumping this to hopefully call the att of devs someday.
Re: Changing fluid_boxes / Get output liquid
And it worked!SHiRKiT wrote:I'm bumping this to hopefully call the att of devs someday.
... 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.