Page 1 of 1

"On fluidbox flushed" event to fix fluid void exploits

Posted: Wed Jun 17, 2020 12:06 am
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.

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

Posted: Wed Jul 08, 2020 1:23 pm
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

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

Posted: Wed Jul 08, 2020 4:05 pm
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.

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

Posted: Wed Jul 08, 2020 4:40 pm
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