The problem is: how should we identify a specific tank to access?
Options:
- Use a number. 0 is the first tank, 1 is the second tank, etc. Invalid indices either throw an error or return nil. getliquid(2) returns the 3rd tank.
Pros: Easy to implement.
Cons: Not very useful. You don't even know which tank you're accessing. - Use a string identifier set in the prototype. getliquid("input") returns the tank called "input".
Pros: Easy to identify specific tanks - just pass the same string you set in the prototype.
Cons: Requires prototypes to be updated. How to handle combined fluid boxes? (e.g. chemical plant has two input fluidboxes, but if you select a recipe with only one input they get merged) - Use a defines.fluidbox identifier, like getinventory(). getliquid(defines.fluidbox.input1) returns the first input tank.
Pros: Special cases, like combined fluid boxes, can easily be handled separately.
Cons: Requires prototypes to be updated. You can't define your own types of fluid boxes, like you could if they were strings. - Use a string identifier from the prototype, but allow multiple fluid boxes to have the same identifier. getliquid("input") returns a list of all input tanks.
Pros: Combined fluid boxes work fine, as long as they have the same identifier - it just returns the combined fluid box instead of the individual ones.
Cons: Requires prototypes to be updated. It's still hard to get a particular input. - Anything else I didn't think of.