[SOLVED]Make entity collide with concrete/stone tiles

Place to get help with not working mods / modding interface.
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

[SOLVED]Make entity collide with concrete/stone tiles

Post 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?
Last edited by Villfuk02 on Tue May 01, 2018 2:02 pm, edited 1 time in total.
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: Make entity collide with concrete/stone tiles

Post 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
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post by darkfrei »

https://mods.factorio.com/mod/CheckerFloor - added collision "layer-15" and you can't place new tiles on "same" tiles.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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.
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

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

Post by Villfuk02 »

Yep, i didn't think of that, thanks for pointing it out!
Post Reply

Return to “Modding help”