LuaEntity.insert_fluid() does not account for active but empty filters on pumps

Bugs that are actually features.
jagoly
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon Dec 23, 2024 11:48 am
Contact:

LuaEntity.insert_fluid() does not account for active but empty filters on pumps

Post by jagoly »

If I manually set a filter on a pump, then pump.insert_fluid(some_fluid) will check that filter before inserting the fluid, and not insert anything if the fluid does not match. Likewise, if the pump is connected to the circuit network and set_filters is enabled, then if the pump is receiving a filter signal, it will also block the insertion if the fluid does not match.

However, if the pump is connected to the circuit network and set_filters is enabled, but the pump is not receiving a signal, then insertion is NOT prevented - the function acts as though the pump has no filter. This is incorrect and inconsistent with pumps' normal behaviour, which is to not accept any fluid.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3801
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaEntity.insert_fluid() does not account for active but empty filters on pumps

Post by boskid »

While i can see this being inconsistent with pumps normal behavior i am not sure if i agree with saying it is incorrect. Technically in this case a fluid box has no filter so any fluid can be put into it. Pump has 3 cases implemented when it does not pull fluids from the input: 1/ when it is out of energy, 2/ when disabled by control behavior, 3/ when there is no filter and filter is being set by control behavior. Given that pump also has buffer for 400 units of fluid, when filter set by control behavior is cleared, the content is not voided so it is a normal situation to have pump with fluid inside that does not match filter or sits there when there is no filter. What you are seeing is a difference between pump behavior (not taking fluid due to its logic) and fluid box behavior (accepting any fluid since there is no filter set). If we want to be super precise then should i also disallow taking fluids into the pump when pump has no energy, disallow taking fluids when pump is disabled by control behavior and preferably take energy from pump's energy buffer proportional to the amount of fluid inserted? What makes case "3" of no filter from control behavior so special that it needs to be covered by LuaEntity::insert_fluid while other cases would not? Personally i am not considering this to be a bug, i will let raiguard decide about this.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3801
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: LuaEntity.insert_fluid() does not account for active but empty filters on pumps

Post by boskid »

I am going to throw this to Not a bug because the pump logic and fluid box logic do not overlap here: it is just the pump that decides to not pull fluid when filter is set by control behavior but the fluidbox still has no filter and as such accepts any fluids.
Post Reply

Return to “Not a bug”