"On fluidbox flushed" event to fix fluid void exploits

Post Reply
User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 582
Joined: Tue May 19, 2015 1:56 am
Contact:

"On fluidbox flushed" event to fix fluid void exploits

Post by Reika »

This one is kind of a massive thing for me.

Flushing fluidboxes is all well and good, but now that a player can choose to void large amounts of fluid at will, it creates a serious exploit in one of my mods. Basically, NauvisDay adds pollution management, a big part of which is dealing with the liquid byproduct of cleaning processes (eg deaerosolization), which needs appropriate processing (ineffective for large quantities) or storage (primarily pumping back down into depleted oil wells).

Now that a player can just void it for free, ad infinitum, none of that is necessary; they can and will be compelled to just keep flushing the tank periodically, forgoing any logistics or costs of actual dealing with the (large quantity of) effluent they generate.

An event to watch such a flush would solve my issue, as I can make flushing do what breaking the storage already does: spawn a big splat of spilled fluid that gradually emits pollution, effectively undoing the work of the original cleaning processes.



I can imagine there are other mods - Bobs and Angels come to mind - where the ability to destroy fluid at will breaks their recipe balancing as well.
Image

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: "On fluidbox flushed" event to fix fluid void exploits

Post by boskid »

Will this be enough?

Code: Select all

on_player_flushed_fluid
Called after player flushed fluid

Contains
player_index :: uint: Index of the player
fluid :: string: Name of a fluid that was flushed
amount :: double: Amount of fluid that was removed
entity :: LuaEntity: Entity from which flush was performed
only_this_entity :: boolean: True if flush was requested only on this entity

User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 582
Joined: Tue May 19, 2015 1:56 am
Contact:

Re: "On fluidbox flushed" event to fix fluid void exploits

Post by Reika »

boskid wrote:
Wed Jul 08, 2020 1:23 pm
Will this be enough?

Code: Select all

on_player_flushed_fluid
Called after player flushed fluid

Contains
player_index :: uint: Index of the player
fluid :: string: Name of a fluid that was flushed
amount :: double: Amount of fluid that was removed
entity :: LuaEntity: Entity from which flush was performed
only_this_entity :: boolean: True if flush was requested only on this entity
"Amount" would be the entire system amount flushed if the player chose the "entire system" option (ie only_this_entity is false)? If so, then this is perfect.
Image

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: "On fluidbox flushed" event to fix fluid void exploits

Post by boskid »

In case of single entity (clearing only storage tank) it will be amount of fluid removed from storage tank. In case of multiple entities (whole fluid system), it will be total amount removed from all fluid boxes.
Implemented for 0.18.36

Post Reply

Return to “Implemented mod requests”