Otherwise identical entities with a width of 6, 10, 14, ... are placed on a grid that is offset by one tile if you consider their bounding boxes.
If you instead consider the entity center points, then width 2 is placed on the rail grid and every other width is placed one tile offset horizontally.
This behavior does not seem desirable or expected, either way.
Code: Select all
local function get_recipe_and_item_prototypes(name, icon)
return {
{ type = "recipe", name = name, enabled = true, result = name, ingredients = {}, },
{ type = "item", name = name, icon = icon, icon_size = 64, place_result = name, stack_size = 100, },
}
end
local function get_entity_prototype(name, icon, size)
local entity = table.deepcopy(data.raw["simple-entity-with-owner"]["simple-entity-with-owner"])
entity.name = name
entity.icon = icon
entity.build_grid_size = 2
entity.collision_box = {{-size[1]/2+0.1, -size[2]/2+0.1}, {size[1]/2-0.1, size[2]/2-0.1}}
entity.selection_box = {{-size[1]/2, -size[2]/2}, {size[1]/2, size[2]/2}}
return entity
end
for i=1,6 do
local name = "test-" .. i
local icon = "__base__/graphics/entity/land-mine/hr-land-mine.png" -- arbitrary 64x64 image
data:extend(get_recipe_and_item_prototypes(name, icon))
local entity = get_entity_prototype(name, icon, {2*i,2})
entity.picture = { filename = icon, width = 64, height = 64, }
data:extend({entity})
end