[2.1.9] CreatePollutionTriggerEffectItem fails to create pollution when use_entity_from_trigger=true and no entity

Bugs which we just recently fixed in our development version and will reach you in the next release.
User avatar
wagyekk
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat May 17, 2025 7:08 pm
Contact:

[2.1.9] CreatePollutionTriggerEffectItem fails to create pollution when use_entity_from_trigger=true and no entity

Post by wagyekk »

CreatePollutionTriggerEffectItem silently fails to create pollution when use_entity_from_trigger is true (default) and the trigger context does not provide a valid trigger entity.

Assign the following trigger to TilePrototype.default_destroyed_dropped_item_trigger:

Code: Select all

{
  type = "direct",
  action_delivery = {
    type = "instant",
    source_effects = {
      {
        type = "create-pollution",
        amount = 1000
      }
    }
  }
}
Enable destroys_dropped_items for the tile and drop an item onto it (e.g. into water).
Here's the code for mod that would reproduce the behavior:

Code: Select all

local effect = {
    type = "create-pollution",
    amount = 1000
}
if not settings.startup["test-use-trigger-entity"].value then
    effect.use_entity_from_trigger = false
end
data.raw.tile["water"].default_destroyed_dropped_item_trigger = {
    type = "direct",
    action_delivery = {
        type = "instant",
        source_effects = {
            effect
        }
    }
}
data.raw.tile["water"].destroys_dropped_items = true
Expected behavior

Pollution is created regardless of whether it is associated with an entity in the Pollution statistics.

Actual behavior

No pollution is created.

It's also possible that the API doc could be clarified. Currently it states:
use_entity_from_trigger :: boolean If not set, and entity is not set, the pollution does not show in statistics.
From this description, I expected that when no trigger entity is available, pollution would still be created, just without being attributed in the Pollution statistics. Instead, no pollution is created at all.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17134
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.9] CreatePollutionTriggerEffectItem fails to create pollution when use_entity_from_trigger=true and no entity

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved for the next release”