1
0
mirror of https://github.com/veden/Rampant.git synced 2025-02-13 13:48:36 +02:00
Rampant/prototypes/utils/ProjectileUtils.lua

81 lines
3.7 KiB
Lua
Raw Normal View History

2018-02-06 00:01:20 -08:00
local projectileUtils = {}
2021-04-29 22:24:14 -07:00
function projectileUtils.makeProjectile(attributes, attack)
local n = attributes.name .. "-projectile-rampant"
2021-02-27 14:50:26 -08:00
2018-02-06 00:01:20 -08:00
data:extend({{
2019-10-19 14:04:38 -07:00
type = "projectile",
name = n,
flags = {"not-on-map"},
2021-02-08 21:55:16 -08:00
collision_box = attributes.attackCollisionBox or {{-0.025, -0.025}, {0.025, 0.025}},
2020-11-26 15:13:08 -08:00
collision_mask = attributes.attackCollisionMask or {"layer-13"},
direction_only = attributes.attackDirectionOnly,
piercing_damage = attributes.attackPiercingDamage or 0,
2021-04-29 22:24:14 -07:00
acceleration = attributes.attackAcceleration or 0.000001,
max_speed = math.min(math.max(attributes.scale*0.60, 0.4), 0.7),
force_condition = (settings.startup["rampant--disableCollidingProjectiles"].value and "not-same") or nil,
2019-10-19 14:04:38 -07:00
action = attack,
animation =
{
2019-03-16 20:39:30 -07:00
filename = "__base__/graphics/entity/acid-projectile/acid-projectile-head.png",
line_length = 5,
width = 22,
height = 84,
frame_count = 15,
2021-04-29 22:24:14 -07:00
shift = util.mul_shift(util.by_pixel(-2, 30), attributes.scale*1.2 or 1),
tint = attributes.tint2,
2019-03-16 20:39:30 -07:00
priority = "high",
2021-04-29 22:24:14 -07:00
scale = (attributes.scale*1.2 or 1),
2019-03-16 20:39:30 -07:00
animation_speed = 1,
hr_version =
{
filename = "__base__/graphics/entity/acid-projectile/hr-acid-projectile-head.png",
line_length = 5,
width = 42,
height = 164,
frame_count = 15,
2021-04-29 22:24:14 -07:00
shift = util.mul_shift(util.by_pixel(-2, 31), attributes.scale*1.2 or 1),
tint = attributes.tint2,
2019-03-16 20:39:30 -07:00
priority = "high",
2021-04-29 22:24:14 -07:00
scale = 0.5 * (attributes.scale*1.2 or 1),
2019-03-16 20:39:30 -07:00
animation_speed = 1,
}
},
2019-10-19 14:04:38 -07:00
shadow =
{
2019-03-16 20:39:30 -07:00
filename = "__base__/graphics/entity/acid-projectile/acid-projectile-shadow.png",
line_length = 15,
width = 22,
height = 84,
frame_count = 15,
priority = "high",
2021-04-29 22:24:14 -07:00
shift = util.mul_shift(util.by_pixel(-2, 30), attributes.scale*1.2 or 1),
2019-03-16 20:39:30 -07:00
draw_as_shadow = true,
2021-04-29 22:24:14 -07:00
scale = (attributes.scale*1.2 or 1),
2019-03-16 20:39:30 -07:00
animation_speed = 1,
hr_version =
{
filename = "__base__/graphics/entity/acid-projectile/hr-acid-projectile-shadow.png",
line_length = 15,
width = 42,
height = 164,
frame_count = 15,
2021-04-29 22:24:14 -07:00
shift = util.mul_shift(util.by_pixel(-2, 31), attributes.scale*1.2 or 1),
2019-03-16 20:39:30 -07:00
draw_as_shadow = true,
priority = "high",
2021-04-29 22:24:14 -07:00
scale = 0.5 * (attributes.scale*1.2 or 1),
2019-03-16 20:39:30 -07:00
animation_speed = 1,
}
},
2019-10-19 14:04:38 -07:00
-- rotatable = false,
2019-03-16 20:39:30 -07:00
oriented_particle = true,
shadow_scale_enabled = true,
2018-02-06 00:01:20 -08:00
}})
2019-03-16 20:39:30 -07:00
2018-02-06 00:01:20 -08:00
return n
end
return projectileUtils