[2.1.9] CreatePollutionTriggerEffectItem fails to create pollution when use_entity_from_trigger=true and no entity
Posted: Fri Jul 03, 2026 10:07 pm
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:
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:
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:
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
}
}
}
}
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
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:
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.use_entity_from_trigger :: boolean If not set, and entity is not set, the pollution does not show in statistics.