Page 1 of 1
[1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"
Posted: Wed Oct 21, 2020 3:20 pm
by Pi-C
This code should work,
according to Klonan.
Code: Select all
local fires = data.raw.fire
for name, entity in pairs(fires) do
entity.created_effect = {
type = "direct",
source_effects = {
type = "create-entity",
entity_name = acids[name] and WT.acid_dummy_name or WT.fire_dummy_name,
trigger_created_entity = true
}
}
end
However, when I use the flamethrower to create fire, nothing happens. If I ignite a fire in a forest and the fire is spreading on its own -- nothing happens. And if I spawn some spitters to attack me, their spit (which is based on fire) lands on the ground -- and nothing else happens.
I've attached an MWE that uses a version of the above code to create a small-lamp when a fire is spawned. It also listens to on_trigger_created_entity and prints a message to log and game if that event is triggered.
Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"
Posted: Wed Oct 21, 2020 4:56 pm
by Rseding91
Thanks for the report. Looking into it: you need to move "source_effects" 1 level deeper.
Code: Select all
local fires = data.raw.fire
for name, entity in pairs(fires) do
entity.created_effect = {
type = "direct",
action_delivery =
{
type = "instant",
source_effects = {
type = "create-entity",
entity_name = "small-lamp",
ignore_collision_condition = true,
trigger_created_entity = true
}
}
}
entity.selectable_in_game = true
end
And also it will crash if you use that in 1.0 so you just can't until 1.1 is released with the fix

Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"
Posted: Wed Oct 21, 2020 5:19 pm
by Pi-C
Rseding91 wrote: Wed Oct 21, 2020 4:56 pm
Thanks for the report. Looking into it: you need to move "source_effects" 1 level deeper.
Code: Select all
local fires = data.raw.fire
for name, entity in pairs(fires) do
entity.created_effect = {
type = "direct",
action_delivery =
{
type = "instant",
source_effects = {
type = "create-entity",
entity_name = "small-lamp",
ignore_collision_condition = true,
trigger_created_entity = true
}
}
}
entity.selectable_in_game = true
end
Thanks!
And also it will crash if you use that in 1.0
Yes,
I know …
so you just can't until 1.1 is released with the fix
I can hardly wait! Meanwhile, I'll start restructuring my tables for an easier transition …
Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"
Posted: Wed Oct 21, 2020 6:04 pm
by Klonan
Pi-C wrote: Wed Oct 21, 2020 5:19 pm
so you just can't until 1.1 is released with the fix
I can hardly wait! Meanwhile, I'll start restructuring my tables for an easier transition …
Until then, you can use `target_effects` instead of `source_effects`, which does the same thing in the case of `created_effect`
Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"
Posted: Wed Oct 21, 2020 10:31 pm
by Pi-C
Klonan wrote: Wed Oct 21, 2020 6:04 pm
Until then, you can use `target_effects` instead of `source_effects`, which does the same thing in the case of `created_effect`
Oh, great, that works! So, it looks like I can have self-registering fires in the next release. Thanks for your help, I really appreciate it!
