Types/CollisionMask: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
 added link to defaults, fixed info  | 
				Muppet9010 (talk | contribs)  restructure article like other flag articles and add in details for the "not-colliding-with-itself" option  | 
				||
| Line 1: | Line 1: | ||
The collision mask is specified   | 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   | == Layers ==  | ||
* ground-tile  | * ground-tile  | ||
* water-tile  | * water-tile  | ||
| Line 18: | Line 18: | ||
* layer-15  | * layer-15  | ||
Layer-11 through layer-15 are currently unused by the core game  | 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 prototype that has this collision mask option will not collide with any other prototype that also has this collision mask option. This option functions like a global whitelist of prototypes that don't collide with one another.  | |||
=== "consider-tile-transitions" ===  | |||
=== "colliding-with-tiles-only" ===  | |||
== Default collision masks ==  | |||
The default collision masks of all entity types can be found [[Prototype/Entity#collision_mask|here]].  | The default collision masks of all entity types can be found [[Prototype/Entity#collision_mask|here]].  | ||
Example (Most common collision mask of buildings):  | Example (Most common collision mask of buildings):  | ||
<syntaxhighlight lang="lua">collision_mask = { "item-layer", "object-layer", "player-layer", "water-tile"}</syntaxhighlight>  | <syntaxhighlight lang="lua">collision_mask = { "item-layer", "object-layer", "player-layer", "water-tile"}</syntaxhighlight>  | ||
Revision as of 22:11, 13 April 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 prototype that has this collision mask option will not collide with any other prototype that also has this collision mask option. This option functions like a global whitelist of prototypes that don't collide with one another.
"consider-tile-transitions"
"colliding-with-tiles-only"
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"}