[0.13.11] Floor-layer alone in collision mask not working

Bugs that are actually features.
Neemys
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Apr 09, 2016 6:16 pm
Contact:

[0.13.11] Floor-layer alone in collision mask not working

Post by Neemys »

As I was working on my mod, I found a weird thing when using collision mask (I use them to block the placement of some building).

When you set the collision mask of a building to floor-layer and nothing else, this building doesn't collide with the floor-layer if terrain is set to collide with floor layer. But if the building have floor-layer and another layer, it is blocked as expected.

To demonstrate it I wrote a little mod with only the following code in it :

Code: Select all



local tiles = data.raw["tile"];
-- add floor layer to collision mask of all non minable tile (terrain mostly)
for name,item in pairs(tiles) do
	if not item.minable then
		if item.collision_mask then
			table.insert(item.collision_mask, "floor-layer");
		else
			item.collision_mask = {  "floor-layer"}
		end;
	end
end

data.raw["furnace"]["stone-furnace"].collision_mask  = {  "floor-layer"}
data.raw["furnace"]["steel-furnace"].collision_mask  = { "player-layer"}
data.raw["furnace"]["electric-furnace"].collision_mask  = {  "floor-layer","player-layer"}
As all non minable tile are set to collide with floor-layer, I expect any building which collide with floor-layer to be not placeable on terrain.

Using the mod provided as attachment. We obtain those result :
Stone furnace should collide with terrain
Stone furnace should collide with terrain
stone1.jpg (39.42 KiB) Viewed 1208 times
The stone furnace which have ONLY floor-layer in collision mask should collide with terrain, it is not. It does not collide with player, it's normal.


steel furnace does collide with player but not terrain
steel furnace does collide with player but not terrain
steel1.jpg (37.04 KiB) Viewed 1208 times
Steel furnace which have ONLY player-layer in collision mask collide with player but not terrain. It's normal, just showing that it's not player-layer that block placement in the next screenshot.


electric furnace collide with terrain as expected
electric furnace collide with terrain as expected
electric.jpg (32.98 KiB) Viewed 1208 times
Electric furnace which have floor-later AND player-layer collide with terrain.



Expected behavior : stone surnace which have floor-layer in mask should not be placeable on terrain (as terrain block floor-layer with the mod) like the electric furnace.


Edit : In case you are wondering,if I try to place the stone furnace on the ground it succeed (it should not)
Attachments
dummy-mod_0.0.1.zip
Example mod
(910 Bytes) Downloaded 67 times
Want more space restriction ? Or maybe you want to be forced to use train for other thing than ore and oil ? Try Building Platform Mod !
Rseding91
Factorio Staff
Factorio Staff
Posts: 15908
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.11] Floor-layer alone in collision mask not working

Post by Rseding91 »

floor-layer is not tiles. Floor-layer is used for things like rails, gates, and belts.

you want ground-tile which is tiles.

Specifically for performance reasons collision mask checks against tiles doesn't run unless it contains one of the following collision mask values:

water-tile
ground-tile
resource-layer
player-layer
item-layer
doodad-layer
If you want to get ahold of me I'm almost always on Discord.
Neemys
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Apr 09, 2016 6:16 pm
Contact:

Re: [0.13.11] Floor-layer alone in collision mask not working

Post by Neemys »

I knew that floor-layer wasn't for tile, It's just before you add us some nice new mask (I thank you again for that) we have no choice to use one used by the game. (ground-tile wasn't working for my case)

So now I'm using layer-10 and add player-layer as well to force collision check. So like you say, not a bug because it's for performance reason.
Want more space restriction ? Or maybe you want to be forced to use train for other thing than ore and oil ? Try Building Platform Mod !
Post Reply

Return to “Not a bug”