Types/CollisionMask: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(→‎"colliding-with-tiles-only": add simple explanation to confirm behaviour.)
(→‎"consider-tile-transitions": add an explanation)
Line 26: Line 26:


=== "consider-tile-transitions" ===
=== "consider-tile-transitions" ===
Uses the prototypes position rather than its collision box when doing collision checks with tile prototypes. Allows the prototype to overlap colliding tiles up until its center point.
=== "colliding-with-tiles-only" ===
=== "colliding-with-tiles-only" ===
Any prototype with this collision option will only be checked for collision with other prototype's collision masks if they are a tile.
Any prototype with this collision option will only be checked for collision with other prototype's collision masks if they are a tile.

Revision as of 22:43, 8 July 2019

The collision mask is specified as an Array (Types/table) of strings. Every entry is a specification of one layer the object collides with or a special collision option.

Layers

  • ground-tile
  • water-tile
  • resource-layer
  • doodad-layer
  • floor-layer
  • item-layer
  • ghost-layer
  • object-layer
  • player-layer
  • train-layer
  • layer-11
  • layer-12
  • layer-13
  • layer-14
  • layer-15

Layer-11 through layer-15 are currently unused by the core game.

Collision options

These are not collision masks, instead they control other aspects of collision, but they are still specified here.

"not-colliding-with-itself"

Any 2 entities that both have this option enabled on their prototype and have an identical collision mask layers list will not collide. Other collision mask options are not included in the identical layer list check. This does mean that 2 different prototypes with the same collision mask layers and this option enabled will not collide.

"consider-tile-transitions"

Uses the prototypes position rather than its collision box when doing collision checks with tile prototypes. Allows the prototype to overlap colliding tiles up until its center point.

"colliding-with-tiles-only"

Any prototype with this collision option will only be checked for collision with other prototype's collision masks if they are a tile.

Default collision masks

The default collision masks of all entity types can be found here.

Example (Most common collision mask of buildings):

collision_mask = { "item-layer", "object-layer", "player-layer", "water-tile"}