[1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"

This subforum contains all the issues which we already resolved.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

[1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"

Post 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.
Attachments
MWE_1.0.0.zip
(1.08 KiB) Downloaded 70 times
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"

Post 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 :P
If you want to get ahold of me I'm almost always on Discord.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"

Post 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:-D
so you just can't until 1.1 is released with the fix :P
I can hardly wait! Meanwhile, I'll start restructuring my tables for an easier transition …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"

Post 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 :P
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`

Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.0.0] created_effect doesn't seem to trigger for prototype "fire-flame"

Post 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! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Resolved Problems and Bugs”