Make entities with square collision_box but non-square tile_buildability_rules also rotatable
Posted: Sat Apr 26, 2025 1:44 pm
If you add the following modifications to the assembling machine prototypes:
(collision_masks of assembler-2 and 3 edited because upgradability rules require the same masks)
You can place the assembler-1 on the water edge when there's water north of the assembler.
The building cannot, however, be rotated so no method exists to allow water on either side exclusively without a hack like making the collision_box non-square:
Code: Select all
data.raw["assembling-machine"]["assembling-machine-1"].collision_mask = {layers={}}
data.raw["assembling-machine"]["assembling-machine-2"].collision_mask = {layers={}}
data.raw["assembling-machine"]["assembling-machine-3"].collision_mask = {layers={}}
data.raw["assembling-machine"]["assembling-machine-1"].tile_buildability_rules = {
{
area = {{-1.5, -0.3}, {1.5, 1.5}},
required_tiles = {layers={ground_tile=true}},
colliding_tiles = {layers={water_tile=true}},
},
{
area = {{-1.5, -1.5}, {1.5, -0.8}},
required_tiles = {layers={water_tile=true}},
colliding_tiles = {layers={ground_tile=true}},
},
}
You can place the assembler-1 on the water edge when there's water north of the assembler.
The building cannot, however, be rotated so no method exists to allow water on either side exclusively without a hack like making the collision_box non-square:
Code: Select all
data.raw["assembling-machine"]["assembling-machine-1"].collision_box[1][1] = data.raw["assembling-machine"]["assembling-machine-1"].collision_box[1][1] - 0.01