Also, is it possible to run a data-event from script, or apply damage of a type (such that resistances and so on are all respected)
I have a flamethrower mod, which broke with one of the last 5 or so updates, since it worked for 12.10, but not now at 12.21.
Essentially, I had attached several line-damage effects, which used the railgun's targeting logic to damage everything in the area, and simulated a sort of cone via several layers. However, in the current game version, the railgun's logic is entirely nonfunctional, so the flamethrower is nonfunctional.
The flamethrower weapon itself is a modified shotgun, since the flamethrower type has pretty much zero customization support.
This is the code I've been using.
code
Code: Select all
data.raw["ammo"]["flame-thrower-ammo"].ammo_type =
{
category = "flame-thrower",
target_type = "direction",
action =
{
{
type = "line",
range =3,
width = 1,
source_effects =
{
type = "create-entity",
entity_name = "railgun-beam"
},
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "flame-thrower-cloud"
},
{
type = "damage",
damage = { amount = 3, type="fire"}
}
}
}
},
{
type = "line",
range = 6,
width = 2,
source_effects =
{
type = "create-entity",
entity_name = "railgun-beam"
},
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "flame-thrower-cloud"
},
{
type = "damage",
damage = { amount = 3, type="fire"}
}
}
}
},
{
type = "line",
range = 9,
width = 4,
source_effects =
{
type = "create-entity",
entity_name = "railgun-beam"
},
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "flame-thrower-cloud"
},
{
type = "damage",
damage = { amount = 3, type="fire"}
}
}
}
},
{
type = "direct",
repeat_count = 4,
action_delivery =
{
type = "projectile",
projectile = "flame-thrower-projectile",
starting_speed = 1,
direction_deviation = 0.4,
range_deviation = 1,
max_range = 8
}
}
}
}
data.raw["ammo"]["flame-thrower-ammo"].magazine_size = 30
--[[data.raw["ammo"]["flame-thrower-ammo"].ammo_type =
{
category = "flame-thrower",
target_type = "direction",
source_effects =
{
type = "create-explosion",
entity_name = "explosion-gunshot"
},
action =
{
type = "direct",
repeat_count = 2,
action_delivery =
{
type = "projectile",
projectile = "flame-thrower-projectile",
starting_speed = 0.2,
direction_deviation = 0.8,
range_deviation = 0.3,
max_range = 10
}
}
}]]--
data:extend(
{
{
type = "projectile",
name = "flame-thrower-projectile",
flags = {"not-on-map"},
--collision_box = {{-0.05, -1}, {0.05, 1}},
acceleration = 0,
direction_only = true,
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "flame-thrower-cloud"
}--[[,
{
type = "damage",
damage = { amount = 0.25, type = "fire"}
}]]--
}
}
},
animation =
{
filename = "__base__/graphics/entity/flame-thrower-explosion/flame-thrower-explosion.png",
priority = "extra-high",
width = 64,
height = 64,
frame_count = 64,
animation_speed = 0.25,
line_length = 8,
scale = 1,
}
},
{
type = "smoke-with-trigger",
name = "flame-thrower-cloud",
flags = {"not-on-map"},
show_when_smoke_off = true,
animation =
{
filename = "__base__/graphics/entity/flame-thrower-explosion/flame-thrower-explosion.png",
priority = "extra-high",
width = 64,
height = 64,
frame_count = 64,
animation_speed = 1,
line_length = 8,
scale = 1,
},
slow_down_factor = 0,
affected_by_wind = false,
cyclic = true,
duration = 64,--60 * 1,
fade_away_duration = 2 * 60,
spread_duration = 10,
color = { r = 1, g = 1, b = 1 },
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
type = "nested-result",
action =
{
type = "area",
perimeter = 1,
--entity_flags = {"breaths-air"},
action_delivery =
{
type = "instant",
target_effects =
{
type = "damage",
damage = { amount = 1.0, type = "fire"}
}
}
}
}
}
},
action_frequency = 8
},
}
)