...I couldn't make it work, it always gave me a ROOT error(afaik), which confused me, because it worked for the attack animation...
anyways I reduced it to one spritesheet for each side, but the game only makes use of the north animation, the others are ignored (probably because I set direction_count = 1)
currently the file looks like this, (I used Bob stuff as a base, since I was playing with/modifying his files for private use anyway, had fun adding sound effects and now spritesheets etc. and it kinda escalated)
Code: Select all
function antimatter_turret_preparing_north(inputs)
local size = inputs.size or 1
return
{
layers =
{
{
filenames = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-north-comb.png",
priority = "medium",
width = 512,
height = 512,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
lines_per_file = 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32 * size),
scale = 2 * size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-north-comb.png",
priority = "medium",
width = 1024,
height = 1024,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32.5 * size),
scale = size
}
},
-- {
-- filename = "__base__/graphics/entity/laser-turret/laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 44,
-- height = 40,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = size,
-- hr_version = {
-- filename = "__base__/graphics/entity/laser-turret/hr-laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 86,
-- height = 80,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = 0.5 * size
-- }
-- },
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-shadow.png",
width = 512,
height = 512,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 3 * size),
scale = size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-shadow.png",
width = 1024,
height = 1024,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 2.5 * size),
scale = 0.5 * size
}
}
}
}
end
function antimatter_turret_preparing_east(inputs)
local size = inputs.size or 1
return
{
layers =
{
{
filenames = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-east-comb.png",
priority = "medium",
width = 512,
height = 512,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
lines_per_file = 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32 * size),
scale = 2 * size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-east-comb.png",
priority = "medium",
width = 1024,
height = 1024,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32.5 * size),
scale = size
}
},
-- {
-- filename = "__base__/graphics/entity/laser-turret/laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 44,
-- height = 40,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = size,
-- hr_version = {
-- filename = "__base__/graphics/entity/laser-turret/hr-laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 86,
-- height = 80,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = 0.5 * size
-- }
-- },
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-shadow.png",
width = 512,
height = 512,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 3 * size),
scale = size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-shadow.png",
width = 1024,
height = 1024,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 2.5 * size),
scale = 0.5 * size
}
}
}
}
end
function antimatter_turret_preparing_south(inputs)
local size = inputs.size or 1
return
{
layers =
{
{
filenames = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-south-comb.png",
priority = "medium",
width = 512,
height = 512,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
lines_per_file = 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32 * size),
scale = 2 * size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-south-comb.png",
priority = "medium",
width = 1024,
height = 1024,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32.5 * size),
scale = size
}
},
-- {
-- filename = "__base__/graphics/entity/laser-turret/laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 44,
-- height = 40,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = size,
-- hr_version = {
-- filename = "__base__/graphics/entity/laser-turret/hr-laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 86,
-- height = 80,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = 0.5 * size
-- }
-- },
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-shadow.png",
width = 512,
height = 512,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 3 * size),
scale = size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-shadow.png",
width = 1024,
height = 1024,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 2.5 * size),
scale = 0.5 * size
}
}
}
}
end
function antimatter_turret_preparing_west(inputs)
local size = inputs.size or 1
return
{
layers =
{
{
filenames = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-west-comb.png",
priority = "medium",
width = 512,
height = 512,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
lines_per_file = 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32 * size),
scale = 2 * size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-west-comb.png",
priority = "medium",
width = 1024,
height = 1024,
frame_count = inputs.frame_count and inputs.frame_count or 64,
line_length = inputs.line_length and inputs.line_length or 8,
run_mode = inputs.run_mode and inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
--shift = util.by_pixel(0, -32.5 * size),
scale = size
}
},
-- {
-- filename = "__base__/graphics/entity/laser-turret/laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 44,
-- height = 40,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = size,
-- hr_version = {
-- filename = "__base__/graphics/entity/laser-turret/hr-laser-turret-raising-mask.png",
-- flags = { "mask" },
-- width = 86,
-- height = 80,
-- frame_count = inputs.frame_count or 15,
-- line_length = inputs.line_length or 0,
-- run_mode = inputs.run_mode or "forward",
-- axially_symmetrical = false,
-- tint = inputs.tint or white,
-- direction_count = 4,
-- shift = util.by_pixel(0, -43 * size),
-- scale = 0.5 * size
-- }
-- },
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-shadow.png",
width = 512,
height = 512,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 3 * size),
scale = size,
hr_version =
{
filename = "__bobwarfare__/graphics/entities/antimatterturret/hr-antimatter-turret-raising-shadow.png",
width = 1024,
height = 1024,
frame_count = inputs.frame_count or 64,
line_length = inputs.line_length or 8,
run_mode = inputs.run_mode or "forward",
axially_symmetrical = false,
direction_count = 1,
draw_as_shadow = true,
--shift = util.by_pixel(47 * size, 2.5 * size),
scale = 0.5 * size
}
}
}
}
end
Code: Select all
function antimatter_turret(inputs)
local size = inputs.size or 1
local turret =
{
type = "electric-turret",
name = inputs.name,
icon = "__base__/graphics/icons/laser-turret.png",
icon_size = 64,
icon_mipmaps = 4,
flags = { "placeable-player", "placeable-enemy", "player-creation"},
minable = { mining_time = 0.5, result = inputs.name },
max_health = inputs.health,
corpse = "laser-turret-remnants",
collision_box = {{ -4.8 * size, -6.8 * size}, {4.8 * size, 2.8 * size}},
selection_box = {{ -5 * size, -7 * size}, {5 * size, 3 * size}},
dying_explosion = inputs.dying_explosion or "laser-turret-explosion",
rotation_speed = inputs.rotation_speed or 0.01,
preparing_speed = inputs.preparing_speed or 0.05,
folding_speed = inputs.folding_speed or 0.05,
working_sound = inputs.working_sound,
activate_sound = inputs.activate_sound,
prepared_sound = inputs.prepared_sound,
folding_sound = inputs.folding_sound,
preparing_sound = inputs.preparing_sound,
fast_replaceable_group = "turret",
turret_base_has_direction = inputs.turret_base_has_direction,
energy_source = inputs.energy_source or
{
type = "electric",
buffer_capacity = inputs.buffer_capacity or "801kJ",
input_flow_limit = inputs.input_flow_limit or "4800kW",
drain = inputs.drain or "24kW",
usage_priority = "primary-input"
},
folded_animation = bob_laser_turret_extension{frame_count=1, line_length = 1, tint = inputs.tint, size = size},
preparing_animation = {
north = antimatter_turret_preparing_north{tint = inputs.tint, size = size},
east = antimatter_turret_preparing_east{tint = inputs.tint, size = size},
south = antimatter_turret_preparing_south{tint = inputs.tint, size = size},
west = antimatter_turret_preparing_west{tint = inputs.tint, size = size},
},
-- preparing_animation.east = antimatter_turret_preparing_east,
-- preparing_animation.south = antimatter_turret_preparing_south,
-- preparing_animation.west = antimatter_turret_preparing_west,
folding_animation = bob_laser_turret_extension{run_mode = "backward", tint = inputs.tint, size = size},
prepared_animation = antimatter_turret_attack{size = size},
base_picture = inputs.base,
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
call_for_help_radius = 40
}
turret.attack_parameters =
{
type = "beam",
cooldown = inputs.cooldown or 40,
range = inputs.range or 25,
source_direction_count = 64,
source_offset = {0, 0},--(-20.423489 )* size },
damage_modifier = inputs.damage_modifier or 2,
turn_range = inputs.turn_range,
health_penalty = inputs.health_penalty,
cooldown = inputs.cooldown or nil,
min_range = inputs.min_range,
warmup = inputs.warmup or nil, --hinzugefügt
ammo_type =
{
category = "laser",
energy_consumption = inputs.energy_consumption or "800kJ",
action =
{
type = "direct",
action_delivery =
{
type = "beam",
beam = inputs.beam or "laser-beam",
max_length = inputs.range or 25,
duration = inputs.cooldown or 40,
source_offset = {0, -1.31439 * size }
}
}
},
}
return turret
end
Before ending up with the stuff as it is seen above, I tried to make it work with sprites ={} or filenames ={}
Code: Select all
width = 512,
height = 512,
frame_count = 128,
axially_symmetrical = false,
direction_count = 4,
--sprites
{
-- filename = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-3.png",
-- width_in_frames = inputs.frame_count or 8,
-- height_in_frames = 8
-- },
-- {
-- filename = "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-4.png",
-- width_in_frames = inputs.frame_count or 8,
-- height_in_frames = 8
-- },
Code: Select all
-- filenames =
-- {
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-1.png",
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-2.png",
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-3.png",
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-4.png",
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-5.png",
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-6.png",
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-7.png",
-- "__bobwarfare__/graphics/entities/antimatterturret/antimatter-turret-raising-comb-8.png",
-- },
-- lines_per_file = 8,
-- line_length = 8,
-- width = 512,
-- height = 512,
-- frame_count = 128,
-- shift = util.mul_shift(util.by_pixel(-1, -5), scale),
-- direction_count = 4,
-- scale = 2 * scale
I also noticed had problems for the attacking animation, I used 2 sprite sheets(8x8x2) for the main animation but for the shadow only one sprite, because it was sufficient.
So when trying to add the shadow, the game didn't load with it using layers, so I just removed the shadows for now.
I'm guessing, since I used 2 sprite sheets with 8x8 sprites each and the shadow having only one sprite, it wants for each sprite a shadow when using layers.. so I think I have to use 128sprites for the shadow to make it work, which is not necessary.
PS. my scripting isn't really that great, I only used the things that were given already
PS² I know the sprite resolution is excessive, but anything below 256 doesn't look that great since it is a giant structure( and I was having a case of "why not")