Using layers to combine sprites with a shift fails for multiple directions
Posted: Sat Jun 26, 2021 8:19 pm
So I'm trying to fix some minor things in Modular Buildings, and that means I need to create a new corpse for the multi buildings so there isn't just a single remnant thrown into the center of the building, and fix the water_reflection so there isn't just a single reflection.
Easiest way seemed to be to just make a new corpse with the existing remnant with a layer for each building - no need to make new graphical assets for everything, just add layers with a shift to get them placed properly. This is actually how the modular buildings are setup. Unfortunately, corpses and water reflections use a single Types/RotatedAnimation instead of separate horizontal_animation and vertical_animation that the Generator type uses, and the shift part doesn't work when rotated - it's always shifted in the same direction. Anyone know if there's a way to define this so it works properly whether North/South or East/West? I've tried making animation an array, but that just seems to define variations, not directions.
It's a minor thing but I'd prefer it look correct, and if I want to support a modular <anything that isn't a Generator/assembler> I'd need to get this layering working anyway.
Easiest way seemed to be to just make a new corpse with the existing remnant with a layer for each building - no need to make new graphical assets for everything, just add layers with a shift to get them placed properly. This is actually how the modular buildings are setup. Unfortunately, corpses and water reflections use a single Types/RotatedAnimation instead of separate horizontal_animation and vertical_animation that the Generator type uses, and the shift part doesn't work when rotated - it's always shifted in the same direction. Anyone know if there's a way to define this so it works properly whether North/South or East/West? I've tried making animation an array, but that just seems to define variations, not directions.
Code: Select all
["steam-turbine-remnants"] = {
animation = {
layers = {
{
axially_symmetrical = false,
direction_count = 4,
filename = "__base__/graphics/entity/steam-turbine/remnants/steam-turbine-remnants.png",
frame_count = 1,
height = 204,
hr_version = {
axially_symmetrical = false,
direction_count = 4,
filename = "__base__/graphics/entity/steam-turbine/remnants/hr-steam-turbine-remnants.png",
frame_count = 1,
height = 408,
line_length = 1,
scale = 0.5,
shift = {
0.1875+2.5,
0
},
variation_count = 1,
width = 460,
y = 0
},
line_length = 1,
shift = {
0.1875+2.5,
0
},
variation_count = 1,
width = 230,
y = 0
},
{
axially_symmetrical = false,
direction_count = 4,
filename = "__base__/graphics/entity/steam-turbine/remnants/steam-turbine-remnants.png",
frame_count = 1,
height = 204,
hr_version = {
axially_symmetrical = false,
direction_count = 4,
filename = "__base__/graphics/entity/steam-turbine/remnants/hr-steam-turbine-remnants.png",
frame_count = 1,
height = 408,
line_length = 1,
scale = 0.5,
shift = {
0.1875-2.5,
0
},
variation_count = 1,
width = 460,
y = 0
},
line_length = 1,
shift = {
0.1875-2.5,
0
},
variation_count = 1,
width = 230,
y = 0
}
}
},
final_render_layer = "remnants",
flags = {
"placeable-neutral",
"not-on-map"
},
icon = "__base__/graphics/icons/steam-turbine.png",
icon_mipmaps = 4,
icon_size = 64,
localised_name = {
"remnant-name",
{
"entity-name.steam-turbine"
}
},
name = "double-steam-turbine-remnants",
order = "a-h-a",
remove_on_tile_placement = false,
selectable_in_game = false,
selection_box = {
{
-1.5,
-2.5
},
{
1.5,
2.5
}
},
subgroup = "energy-remnants",
tile_height = 5,
tile_width = 3,
time_before_removed = 54000,
type = "corpse"
}