Page 1 of 1

[SOLVED]Make entity collide with concrete/stone tiles

Posted: Tue May 01, 2018 12:46 pm
by Villfuk02
I'D like to make my entity collide with concrete/stone tiles, but it appears they have no collision layer assigned and my tries to assign a collision layer have been unsuccessful. Is there any other way to do so?

Re: Make entity collide with concrete/stone tiles

Posted: Tue May 01, 2018 2:00 pm
by Villfuk02
I tried exactly the same thing again and it worked. I guess i made a mistake on my first try.
This is the working code:

Code: Select all

for index,tile in pairs(data.raw.tile) do
	if string.find(tile.name, "concrete") or string.find(tile.name, "path") then
		tile.collision_mask = {"layer-15"}
	end
end

Re: [SOLVED]Make entity collide with concrete/stone tiles

Posted: Tue May 01, 2018 3:04 pm
by darkfrei
https://mods.factorio.com/mod/CheckerFloor - added collision "layer-15" and you can't place new tiles on "same" tiles.

Re: [SOLVED]Make entity collide with concrete/stone tiles

Posted: Wed May 02, 2018 12:19 am
by eradicator
table.insert(tile.collision_mask,"layer-15")
Otherwise it will collide with nothing _but_ layer-15. Unless you want to be able to place it on top of any other tile, like water etc.

Re: [SOLVED]Make entity collide with concrete/stone tiles

Posted: Wed May 02, 2018 6:08 pm
by Villfuk02
Yep, i didn't think of that, thanks for pointing it out!