Map generator doesn't place trees in the middle of tiles

Post your bugs and problems so we can fix them.
Post Reply
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1512
Joined: Thu Nov 20, 2014 11:11 pm

Map generator doesn't place trees in the middle of tiles

Post by darkfrei » Sun Nov 11, 2018 4:46 pm

Rseding91 wrote:
Sun Nov 11, 2018 4:11 pm
Thanks for the report. I've improved the error for 0.17. It's actually checking that:

If you have shadows defined: shadow frame count must be == leaves frame count + 1

If you don't have shadows defined: trunk frame count must be == leaves frame count + 1
There is a lot of problems with trees:
darkfrei wrote:
Sun Nov 11, 2018 2:44 pm
Also, now leaf_generation and branch_generation cannot be nil, there is another error.
And this one:
If I have tree.collision_box = {{-0.7, -0.7}, {0.7, 0.7}} then I get:
2018-11-11 16_03_48-Factorio 0.16.51.png
2018-11-11 16_03_48-Factorio 0.16.51.png (23.57 KiB) Viewed 197 times
If I change it to tree.collision_box = {{-0.2, -0.2}, {0.2, 0.2}} then I expect:
2018-11-11 16_08_05-Factorio 0.16.51_01.png
2018-11-11 16_08_05-Factorio 0.16.51_01.png (6.47 KiB) Viewed 197 times
but I get:
2018-11-11 16_08_05-Factorio 0.16.51.png
2018-11-11 16_08_05-Factorio 0.16.51.png (15.36 KiB) Viewed 197 times
So I cannot place then in the middle of tiles.

posila
Factorio Staff
Factorio Staff
Posts: 2749
Joined: Thu Jun 11, 2015 1:35 pm

Re: Cannot place trees in the middle of tiles

Post by posila » Sun Nov 11, 2018 5:14 pm

Split thread from: 63407

It's impossible to help you, because you didn't say what you're doing.

Creating trees in middle of tiles just works:
trees-on-middle-of-tile.png
trees-on-middle-of-tile.png (963.15 KiB) Viewed 183 times

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1512
Joined: Thu Nov 20, 2014 11:11 pm

Re: Cannot place trees in the middle of tiles

Post by darkfrei » Sun Nov 11, 2018 5:46 pm

posila wrote:
Sun Nov 11, 2018 5:14 pm
Split thread from: 63407

It's impossible to help you, because you didn't say what you're doing.

Creating trees in middle of tiles just works:
trees-on-middle-of-tile.png
I want to get same result, but this code cannot help me:

Code: Select all

for i, tree in pairs (data.raw.tree) do
  tree.flags = {"placeable-neutral", "breaths-air"} -- as you see,  no "placeable-off-grid" here
  tree.collision_box = {{-0.2, -0.2}, {0.2, 0.2}} -- it's less then 1 x 1 tile
end
I need exactly that, what you have on the image. But with standard autoplacement, not by the script.

I expect that all trees will be placed same way like insterters and chests, in the middle of tiles, but all of them are placed on the edge of tiles.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1512
Joined: Thu Nov 20, 2014 11:11 pm

Re: Cannot place trees in the middle of tiles

Post by darkfrei » Sun Nov 11, 2018 5:49 pm

In the wiki you can find also this method to change the size of entity:

Code: Select all

  tree.tile_width = 1
  tree.tile_height = 1
but it's does not work.

posila
Factorio Staff
Factorio Staff
Posts: 2749
Joined: Thu Jun 11, 2015 1:35 pm

Re: Cannot place trees in the middle of tiles

Post by posila » Sun Nov 11, 2018 6:05 pm

Got it. Your expected behavior is that map generator will place entities that don't have "placeable-off-grid" aligned to grid same way as if it was built by player.

I was not sure how you were creating trees to be aligned to center of a tile (I thought you were placing them manually through script, or you tried to allow player to plant trees, or something like that ...)

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1512
Joined: Thu Nov 20, 2014 11:11 pm

Re: Cannot place trees in the middle of tiles

Post by darkfrei » Mon Nov 12, 2018 10:18 am

posila wrote:
Sun Nov 11, 2018 6:05 pm
Got it. Your expected behavior is that map generator will place entities that don't have "placeable-off-grid" aligned to grid same way as if it was built by player.
The map generator places all entities (without "placeable-off-grid") less than 1x1 in the middle of tiles, all entities less than 2x2 to the lines crossing.

It works for ores, spawners, rocks another entities, but not for trees.

Post Reply

Return to “Bug Reports”