Flamethrower Mechanics

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2129
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Flamethrower Mechanics

Post by Ranakastrasz »

I cannot figure out how the Flamethrower works. It seems to create an entity, similar to the poison cloud. However, it also seems to move, and gets blocked by stuff. I can't see how that actually occurs. I want to make it pierce through objects.

I also want to extend it's duration, but I can't find where that is handled either.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Flamethrower Mechanics

Post by FreeER »

The flamethrower creates a flame-thrower-explosion entity (specified on the flame-thrower-ammo), beyond that it's controlled by C++...
You can extend the duration by tweaking the slow_down_factor on the explosion (1.5+ will lead to a definite 'chunk at unreasonable position' error, I tested up to 1.1 working but didn't test between 1.1 and 1.5) and I would expect the projectile_starting_speed on the ammo (but I didn't test that)
Still, even giving the explosion a collision_mask of nothing (via {}) didn't let it pierce objects... of course if you are willing to go a little crazy you can get this effect (note... you might want to turn down damage if you do.):
regular for scale (max-zoom): https://www.dropbox.com/s/cjtresit1l5xm ... r.png?dl=0
insane extended (max-zoom): https://www.dropbox.com/s/14v0bqkytkody ... r.png?dl=0
with

Code: Select all

{
    type = "flame-thrower-explosion",
    name = "flame-thrower-explosion2",
    flags = {"not-on-map"},
    collision_mask = {},
    animation_speed = 1,
    animations =
    {
      {
        filename = "__base__/graphics/entity/flame-thrower-explosion/flame-thrower-explosion.png",
        priority = "extra-high",
        width = 64,
        height = 64,
        frame_count = 64,
        line_length = 8
      }
    },
    light = {intensity = 0.2, size = 20},
    slow_down_factor = 1.1,
    smoke = "smoke-fast",
    smoke_count = 1,
    smoke_slow_down_factor = 0.95,
    damage = {amount = 0.25, type = "fire"}
  },
  
  {
    type = "ammo",
    name = "flame-thrower-ammo2",
    icon = "__base__/graphics/icons/flame-thrower-ammo.png",
    flags = {"goes-to-main-inventory"},
    ammo_type =
    {
      category = "flame-thrower",
      target_type = "direction",
      action =
      {
        type = "direct",
        action_delivery = (function() 
          res = {}
          for i=1,50 do
            table.insert(res, {
            type = "flame-thrower",
            explosion = "flame-thrower-explosion2",
            direction_deviation = 0.07,
            speed_deviation = 0.1,
            starting_frame_deviation = 0.07,
            damage = { amount = 20, type = "fire"},
            projectile_starting_speed = 0.2,
            starting_distance = 0.6,
          })
          end
          return res
        end)(),
      }
    },
    magazine_size = 100,
    subgroup = "ammo",
    order = "e[flame-thrower]",
    stack_size = 50
  },

Post Reply

Return to “Modding help”