When I try to add a corpse for my units, I get the error "Cannot serialize ttype=function". What causes it and how to fix it?
I added the corpses using a 1 frame death animation where 1 frame = 1 direction. Are there alternative working ways to add this?
Error "Cannot serialise ttype=function"
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Error "Cannot serialise ttype=function"
Posting of at least some of your code (especially where the error occurs) may be required.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: Error "Cannot serialise ttype=function"
Made just like in vanilla
After data:extend and the unit itself:
Code: Select all
function betonomeshalka_ultra_die_animation()
return
{
layers=
{
{
filenames =
{
"__alkashGun__/text/betonomeshalka-ultra-ded.png",
"__alkashGun__/text/betonomeshalka-ultra-ded-2.png"
},
slice = 4,
lines_per_file = 4,
line_length = 4,
width = 20,
height = 26,
frame_count = 1,
direction_count = 32,
shift= util.mul_shift(util.by_pixel(-2, -4))
}
}
}
end
function add_betonomeshalka_ultra_die_animation(corpse)
corpse.animation = betonomeshalka_ultra_die_animation
corpse.dying_speed = 0.04
corpse.time_before_removed = 15 * 60 * 60
-- There were "corpse.direction_shuffle" parameters here, but I cut them as unnecessary
corpse.final_render_layer = "lower-object-above-shadow"
return corpse
end
...
Code: Select all
add_betonomeshalka_ultra_die_animation(
{
type = "corpse",
name = "betonomeshalka-ultra-corpse",
icon = "__alkashGun__/text/alpha.png",
icon_size = 64, icon_mipmaps = 4,
selectable_in_game = false,
selection_box = {{-1, -1}, {1, 1}},
subgroup="corpses",
order = "error-npb",
flags = {"placeable-neutral", "placeable-off-grid", "building-direction-8-way", "not-on-map"}
}),
Re: Error "Cannot serialise ttype=function"
Code: Select all
corpse.animation = betonomeshalka_ultra_die_animation