[1.1.69] Worms spitting fire (instead of acid)

Things that we don't consider worth fixing at this moment.
Post Reply
User avatar
_CodeGreen
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Sat Mar 05, 2022 11:30 am
Contact:

[1.1.69] Worms spitting fire (instead of acid)

Post by _CodeGreen »

By chance I loaded up one of my mods, Chemical Rocket, and was having fun burning some nests when I saw a few worms spitting fire, and not in the musical sense.
Attempting to investigate further, I tried to isolate the behavior and ended up creating a demo mod to make it easier to reproduce.
Something worth noting is that when I was using the chemical rocket mod, sometimes the worms would spit fire multiple times in a row without me actively shooting at them, but when there was still fire on the ground.
I have no idea why this is happening, perhaps because the fire streams are being created from the worm as target, but here's the code of the demo mod and a couple videos demonstrating the effect.

Code: Select all

local ammo = table.deepcopy(data.raw.ammo["firearm-magazine"])
ammo.name = "fire-ammo"
ammo.ammo_type.action[1] = {
    type = "area",
    target_entities = false,
    trigger_from_target = true,
    repeat_count = 1,
    radius = 0,
    action_delivery = {
        type = "stream",
        stream = "flamethrower-fire-stream",
    }
}
data:extend{ammo}
Setting target_entities to true did not stop this from happening either.

Game speed = 0.5:


Setting radius to the rocket mod's value of 9 and game speed = 0.1 for a closer look:

I didn't show in the videos, but you can see regular acid on the ground; When I wasn't shooting the worm, they would spit normally.

To reproduce, install the mod, grab some of the fire ammo from the editor, fire it at some worms while they shoot and watch them become professional rappers in no time.
fire-ammo_0.0.1.zip
(651 Bytes) Downloaded 59 times
My Mods | If you can't make it perfect, make it adjustable

User avatar
_CodeGreen
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Sat Mar 05, 2022 11:30 am
Contact:

Re: [1.1.69] Worms spitting fire (instead of acid)

Post by _CodeGreen »

Why was this moved to Modding Help? The worm spit is being replaced with fire when it presumably shouldn't be doing so. I didn't touch the worm prototype, the acid shouldn't disappear. That looks like a bug to me, and if someone tells me it isn't one, then I can understand being moved to Not a Bug or something, but at least give me a reason.
My Mods | If you can't make it perfect, make it adjustable

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [1.1.69] Worms spitting fire (instead of acid)

Post by posila »

It indeed is bug, thanks for the report.

The cause is

Code: Select all

trigger_from_target = true,
This makes the flamethrower-fire-stream to be created as if it was shot by the worm, including it registering as worm's fluid stream. Since worm has attack_parameters.type = "stream", it will just keep its existing stream alive when shooting instead of invoking attack triggers.

Unfortunatelly, its not an easy fix due to how turrets, turret animations and trigger system works, so I don't think it is worth fixing. But I wonder, what is the use case? It seems to me, you just wanted to create fire under the cursor ... if so, you can just copy the action trigger from the stream.

Code: Select all

    action =
    {
      {
        type = "area",
        radius = 2.5,
        action_delivery =
        {
          type = "instant",
          target_effects =
          {
            {
              type = "create-sticker",
              sticker = "fire-sticker",
              show_in_tooltip = true
            },
            {
              type = "damage",
              damage = { amount = 3, type = "fire" },
              apply_damage_to_trees = false
            }
          }
        }
      },
      {
        type = "direct",
        action_delivery =
        {
          type = "instant",
          target_effects =
          {
            {
              type = "create-fire",
              entity_name = "fire-flame",
              show_in_tooltip = true
            }
          }
        }
      }
    },

User avatar
_CodeGreen
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Sat Mar 05, 2022 11:30 am
Contact:

Re: [1.1.69] Worms spitting fire (instead of acid)

Post by _CodeGreen »

Well I discovered this when messing around with my mod Chemical Rocket, which includes an incendiary rocket that would explode into a few streams that would leave fire on the ground, instead of just instantly creating fire in an area. The example mod above was from me isolating the cause, not actually the effect I intended to create. I can understand if it's not worth the effort to fix, it is extremely minor all things considered, but it was still interesting to find.

Excerpt from chemical rocket, rocket-fire-stream is a copy of flamethrower-fire-stream with the damage tweaked on the fire-flame.

Code: Select all

type = "direct",
action_delivery = {
    type = "instant",
    target_effects = {
        {
            type = "nested-result",
            action = {
                type = "area",
                target_entities = false,
                trigger_from_target = true,
                repeat_count = 60,
                radius = 9,
                action_delivery = {
                    type = "stream",
                    stream = "rocket-fire-stream",
                }
            }
        },{
            type = "play-sound",
            sound = capsule_explosion_sound
        },{
            type = "invoke-tile-trigger",
            repeat_count = 1
        }
    }
}
The above creates "pockets" of fire instead of a uniform blanket.
fire-go-boom.png
fire-go-boom.png (281.09 KiB) Viewed 1943 times

Setting trigger_from_target to false gives me temporary fire breath when a rocket hits.
me-after-taco-bell.png
me-after-taco-bell.png (827.67 KiB) Viewed 1943 times
My Mods | If you can't make it perfect, make it adjustable

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [1.1.69] Worms spitting fire (instead of acid)

Post by posila »

Interesting, thanks for the follow up. I didn't know the projectile would trigger its action with the original shooter as the source.

I can see there is legit use case for this ... I try to think about possibility of fix (easiest would be to provide some option to stream action delivery, to trigger it only from position, not from an entity; or option to not add it to shooter)

Note: If you care about performance at all, and expect your mod to be used in combat heavy games, I would try to achieve this effect using optimized-particle instead of stream. Particles have triggers for when they hit ground (so they could create fire on landing to ground), and are very light weight, compared to the stream entity. Purpose of stream entity is for when something is continuously shooting for longer period of time (I am not super happy that we also used it for worms ... we should make some "projectile with tail", really)

User avatar
_CodeGreen
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Sat Mar 05, 2022 11:30 am
Contact:

Re: [1.1.69] Worms spitting fire (instead of acid)

Post by _CodeGreen »

Hmm, I never considered using particles for the fire explosion. I actually made this mod at a friend's request for a world we were both playing on, and at the time I was still fairly new to the whole trigger system. Thanks for the tip!
My Mods | If you can't make it perfect, make it adjustable

Post Reply

Return to “Won't fix.”