Runaway Light
Posted: Thu Jun 09, 2016 8:22 pm
Trying to make a flare Capsule. Since explosions are the only temperary light source I could find, I tried to make a capsule create one that lasts for an excessively long duration. For whatever reasons however, it decided that it should keep moving the same direction the capsule was when it impacted... So the light just slides away after the capsule lands.
Code: Select all
data:extend(
{
{
type = "explosion",
name = "explosion-flare",
flags = {"not-on-map"},
animations =
{
{
filename = "__Flare__/graphics/null.png",
priority = "extra-high",
width = 1,
height = 1,
frame_count = 1,
animation_speed = 1.0/60.0/120.0,
shift = {0, 0}
}
},
rotate = false,
light = {intensity = 0.9, size = 40},
--light = {intensity = 0.05, size = 80,color = { r = 0.5, g = 0.9, b = 0.8,a = 0.0 }},
--[[smoke = "smoke-fast",
smoke_count = 1,
smoke_slow_down_factor = 1]]--
},
{
type = "smoke",
name = "flare-cloud",
flags = {"not-on-map"},
show_when_smoke_off = true,
animation =
{
filename = "__base__/graphics/entity/cloud/cloud-45-frames.png",
priority = "low",
width = 256,
height = 256,
frame_count = 45,
animation_speed = 0.5,
line_length = 7,
scale = 0.2,
},
slow_down_factor = 0,
affected_by_wind = false,
cyclic = true,
duration = 60 * 120,
fade_away_duration = 2 * 60,
spread_duration = 10,
color = { r = 0.1, g = 0.9, b = 0.7 },
action =
{
type = "direct",
action_delivery =
{
type = "instant",
source_effects =
{
type = "create-explosion",
entity_name = "explosion-flare"
},
}
},
action_frequency = 60
},
{
type = "projectile",
name = "flare-capsule",
flags = {"not-on-map"},
acceleration = 0.005,
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "flare-cloud"
},
{
type = "create-explosion",
entity_name = "explosion-flare"
},
}
}
},
light = {intensity = 0.9, size = 40},
animation =
{
filename = "__Flare__/graphics/flare-capsule.png",
frame_count = 1,
width = 32,
height = 32,
priority = "high"
},
shadow =
{
filename = "__base__/graphics/entity/poison-capsule/poison-capsule-shadow.png",
frame_count = 1,
width = 32,
height = 32,
priority = "high"
},
smoke = capsule_smoke,
},
{
type = "capsule",
name = "flare-capsule",
icon = "__Flare__/graphics/flare-capsule.png",
flags = {"goes-to-quickbar"},
capsule_action =
{
type = "throw",
attack_parameters =
{
type = "projectile",
ammo_category = "capsule",
cooldown = 30,
projectile_creation_distance = 0.6,
range = 20,
ammo_type =
{
category = "capsule",
target_type = "position",
action =
{
type = "direct",
action_delivery =
{
type = "projectile",
projectile = "flare-capsule",
starting_speed = 0.3
}
}
}
}
},
subgroup = "capsule",
order = "a[flare-capsule]",
stack_size = 100
},
})