having different collision radii for checking against entities and tiles

Place to get help with not working mods / modding interface.
Post Reply
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2541
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

having different collision radii for checking against entities and tiles

Post by FuryoftheStars »

Ok, so in a nut shell, what I want to do is have a tree entity that has different collision radii for entities and tiles. Desired effect would be, for example, with a tree placed dead center on a tile, you can build entities on the adjacent tile, but laying concrete is restricted to the next tile out.

I know how to do this once the tree is already placed: spawn a second entity at its location with the larger collision box, giving it a collision mask that collides only with the "offensive" tiles.

However, how do I achieve this while the item for placing the tree is still in hand? If it's placing the tile only colliding entity, then I can't check against entities (including other trees). If it's placing the tree, then I can't check at the larger radius for the tiles. Unless there's something I'm missing (other than creating multiple new masks which then get placed on everything, but I don't want to do this due to the limited number of masks in the first place).

In case anyone wants to know why: I want to achieve the effect where you can't plant trees directly on concrete (or the like), and likewise can't place concrete (or the like) directly under a growing tree (without chopping it down, first). If I make it less than 1 tile wide in collision, then if you for example simply remove the center tile of a 3x3 of concrete, this will allow you to plant the tree, but due to the tile transitions, you'd never know. So what was the point? But if I make the collision box wider, it pushes other entities back (including other trees), and becomes a pain to navigate when there are a lot of them.
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

Post Reply

Return to “Modding help”