[raiguard][2.0.11] LuaEntity::get_fluid returns wrong value

Bugs that are actually features.
User avatar
hgschmie
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Tue Feb 06, 2024 5:18 am
Contact:

[raiguard][2.0.11] LuaEntity::get_fluid returns wrong value

Post by hgschmie »

Consider this storage tank:
Screenshot 2024-10-26 at 14.23.55.png
Screenshot 2024-10-26 at 14.23.55.png (1.88 MiB) Viewed 292 times
Calling `get_fluid(1)` on the entity returns 26,000, not 25,000 :
Screenshot 2024-10-26 at 14.26.06.png
Screenshot 2024-10-26 at 14.26.06.png (216.51 KiB) Viewed 292 times
It seems that the call returns the contents of the pipeline, not of the storage tank.
przemo1232
Burner Inserter
Burner Inserter
Posts: 6
Joined: Fri Oct 18, 2024 9:48 am
Contact:

Re: [2.0.11] LuaEntity::get_fluid returns wrong value

Post by przemo1232 »

Same thing happens when calling fluidbox methods, entity.fluidbox.get_capacity(1) for example returns the capacity of the entire pipeline.
Similarly, setting the entity.fluidbox[1] field sets the amount for the entire pipeline instead of just the entity's fluidbox
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 661
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][2.0.11] LuaEntity::get_fluid returns wrong value

Post by raiguard »

This is correct. The fluid buffer of the entity is merged with the segment, so it reports the segment values.
Don't forget, you're here forever.
User avatar
hgschmie
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: [raiguard][2.0.11] LuaEntity::get_fluid returns wrong value

Post by hgschmie »

Thanks for the explanation!

How does one determine how much fluid is inside an entity? It seems that any call only returns the amount in the whole fluidbox.
Post Reply

Return to “Not a bug”