Entity filter for player.disable_alert()?

Things that we aren't going to implement
ceresward
Inserter
Inserter
Posts: 26
Joined: Mon Dec 18, 2017 8:45 pm
Contact:

Entity filter for player.disable_alert()?

Post by ceresward »

Hi,

The only filter option currently provided for 'player.disable_alert()' is to filter by alert type. Would it be possible for this method to instead support the same filtering options that 'player.remove_alert()' has?

I'm particularly interested in disabling alerts by entity, it would fix a lot of problems for the mod I'm working on if I could disable 'no_material_for_construction' alerts for certain entities and not for others. It does sort of work to call `remove_alert()` instead, but the effect only lasts for a tick before the game updates and adds it back, and I don't think it would be practical to "fight" the game by constantly removing the alerts every tick as they get re-added. If I instead call `disable_alert()` the alerts do disappear for good, but of course that option is all or nothing, so it doesn't really work for me.

A prototype-based solution would also work for me, if that makes a difference (I'm picturing something like an 'EntityPrototype.disabled_alerts' property here)

Totally understand if the architecture doesn't allow for it, but I'm crossing my fingers for an easy solution here!

Thanks,
ceresward
ceresward
Inserter
Inserter
Posts: 26
Joined: Mon Dec 18, 2017 8:45 pm
Contact:

Re: Entity filter for player.disable_alert()?

Post by ceresward »

I realized on second thought it might help if I added some more context to what I'm trying to do. This is for my mod Construction Planner, and fundamentally what I'm trying to do is have entity ghosts be ignored by robots until the player has indicated they want to build them. Currently the mod uses force swapping to accomplish this, i.e. unapproved entities get swapped to a mod-created force so the player force's bot network won't see them. But this creates a lot of jankiness around blueprints, upgrade, deconstruction, etc. so I'm working toward moving to a new system based on 'shadow' prototypes instead, i.e. during the data stage I create clones of every buildable prototype adding an `-unapproved` suffix to the name, and the mod swaps ghosts back and forth between the original and unapproved prototypes as needed. Initial results are promising, but one downside I've discovered is that even though the robots have no way to build the unapproved entities, they still issue 'missing entity' alerts for them and there currently doesn't seem to be any way to turn the alert off just for those entities. Hence the request.

Actually, what really would make things easy for me would be if there was some sort of flag in EntityPrototype to control whether the entity should be buildable by robots or not. That would make the mod very straightforward to implement. But maybe it's be too niche of a feature, idk..
azaghal
Inserter
Inserter
Posts: 37
Joined: Sat Jun 27, 2020 11:13 am
Contact:

Re: Entity filter for player.disable_alert()?

Post by azaghal »

To chime in on this one since I have been maintaining a fork of the mentioned mod and faced similar issues as well (hello ceresward :) ), it would be even better if we could tell the game during runtime to ignore specific ghosts for bot-based construction. This would quite probably also trivialise the construction approval type of mod - the only thing that would be "missing" at that point would be ability to undo/redo the approval action, but we could live with that.

Best regards,
Branko
Rseding91
Factorio Staff
Factorio Staff
Posts: 15230
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Entity filter for player.disable_alert()?

Post by Rseding91 »

ceresward wrote: Sun Oct 27, 2024 5:59 am Hi,

The only filter option currently provided for 'player.disable_alert()' is to filter by alert type. Would it be possible for this method to instead support the same filtering options that 'player.remove_alert()' has?
It is not. The disable logic is a simple array of bools which say if a given alert type is enabled or not.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Won't implement”