2019-09-03 13:14:04 -07:00
using JetBrains.Annotations ;
2020-01-09 18:29:09 -08:00
using Robust.Shared.Map ;
2021-03-08 04:09:59 +11:00
using Robust.Shared.Physics.Dynamics ;
2020-05-25 00:17:08 +01:00
using Robust.Shared.Serialization ;
2018-10-30 01:13:10 -07:00
2022-05-10 17:57:20 -07:00
namespace Content.Shared.Physics ;
/// <summary>
/// Defined collision groups for the physics system.
2022-05-13 19:54:37 -07:00
/// Mask is what it collides with when moving. Layer is what CollisionGroup it is part of.
2022-05-10 17:57:20 -07:00
/// </summary>
[Flags, PublicAPI]
[FlagsFor(typeof(CollisionLayer)), FlagsFor(typeof(CollisionMask))]
public enum CollisionGroup
2018-10-30 01:13:10 -07:00
{
2022-05-13 19:54:37 -07:00
None = 0 ,
Opaque = 1 < < 0 , // 1 Blocks light, can be hit by lasers
Impassable = 1 < < 1 , // 2 Walls, objects impassable by any means
MidImpassable = 1 < < 2 , // 4 Mobs, players, crabs, etc
HighImpassable = 1 < < 3 , // 8 Things on top of tables and things that block tall/large mobs.
LowImpassable = 1 < < 4 , // 16 For things that can fit under a table or squeeze under an airlock
GhostImpassable = 1 < < 5 , // 32 Things impassible by ghosts/observers, ie blessed tiles or forcefields
BulletImpassable = 1 < < 6 , // 64 Can be hit by bullets
InteractImpassable = 1 < < 7 , // 128 Blocks interaction/InRangeUnobstructed
2024-08-31 18:24:12 +10:00
// Y dis door passable when all the others impassable / collision.
2023-12-05 12:07:48 +13:00
DoorPassable = 1 < < 8 , // 256 Allows door to close over top, Like blast doors over conveyors for disposals rooms/cargo.
2022-05-10 17:57:20 -07:00
MapGrid = MapGridHelpers . CollisionGroup , // Map grids, like shuttles. This is the actual grid itself, not the walls or other entities connected to the grid.
// 32 possible groups
2024-08-31 18:24:12 +10:00
// Why dis exist
2022-05-10 17:57:20 -07:00
AllMask = - 1 ,
2024-08-31 18:24:12 +10:00
SingularityLayer = Opaque | Impassable | MidImpassable | HighImpassable | LowImpassable | BulletImpassable | InteractImpassable | DoorPassable ,
2022-05-13 19:54:37 -07:00
// Humanoids, etc.
2022-05-11 17:24:00 -07:00
MobMask = Impassable | HighImpassable | MidImpassable | LowImpassable ,
2022-05-10 17:57:20 -07:00
MobLayer = Opaque | BulletImpassable ,
2022-05-13 19:54:37 -07:00
// Mice, drones
2022-05-10 17:57:20 -07:00
SmallMobMask = Impassable | LowImpassable ,
SmallMobLayer = Opaque | BulletImpassable ,
2022-05-13 19:54:37 -07:00
// Birds/other small flyers
2022-05-18 18:01:22 -04:00
FlyingMobMask = Impassable | HighImpassable ,
2022-05-10 17:57:20 -07:00
FlyingMobLayer = Opaque | BulletImpassable ,
2022-05-13 19:54:37 -07:00
// Mechs
2022-05-10 17:57:20 -07:00
LargeMobMask = Impassable | HighImpassable | MidImpassable | LowImpassable ,
LargeMobLayer = Opaque | HighImpassable | MidImpassable | LowImpassable | BulletImpassable ,
2022-05-13 19:54:37 -07:00
// Machines, computers
2022-05-10 17:57:20 -07:00
MachineMask = Impassable | MidImpassable | LowImpassable ,
MachineLayer = Opaque | MidImpassable | LowImpassable | BulletImpassable ,
2023-12-05 12:07:48 +13:00
ConveyorMask = Impassable | MidImpassable | LowImpassable | DoorPassable ,
2022-05-10 17:57:20 -07:00
2024-04-20 09:23:20 +03:00
// Crates
CrateMask = Impassable | HighImpassable | LowImpassable ,
2022-05-13 19:54:37 -07:00
// Tables that SmallMobs can go under
2022-05-10 17:57:20 -07:00
TableMask = Impassable | MidImpassable ,
TableLayer = MidImpassable ,
2022-05-13 19:54:37 -07:00
// Tabletop machines, windoors, firelocks
2022-05-10 17:57:20 -07:00
TabletopMachineMask = Impassable | HighImpassable ,
2022-05-13 19:54:37 -07:00
// Tabletop machines
2024-07-20 07:56:21 +02:00
TabletopMachineLayer = Opaque | BulletImpassable ,
2022-05-10 17:57:20 -07:00
2022-05-13 19:54:37 -07:00
// Airlocks, windoors, firelocks
GlassAirlockLayer = HighImpassable | MidImpassable | BulletImpassable | InteractImpassable ,
2022-05-10 17:57:20 -07:00
AirlockLayer = Opaque | GlassAirlockLayer ,
2022-05-13 19:54:37 -07:00
// Airlock assembly
2022-05-10 17:57:20 -07:00
HumanoidBlockLayer = HighImpassable | MidImpassable ,
2022-05-13 19:54:37 -07:00
// Soap, spills
2022-05-10 17:57:20 -07:00
SlipLayer = MidImpassable | LowImpassable ,
ItemMask = Impassable | HighImpassable ,
2022-05-17 19:24:58 -07:00
ThrownItem = Impassable | HighImpassable | BulletImpassable ,
2022-05-13 19:54:37 -07:00
WallLayer = Opaque | Impassable | HighImpassable | MidImpassable | LowImpassable | BulletImpassable | InteractImpassable ,
GlassLayer = Impassable | HighImpassable | MidImpassable | LowImpassable | BulletImpassable | InteractImpassable ,
2022-05-10 17:57:20 -07:00
HalfWallLayer = MidImpassable | LowImpassable ,
2022-05-13 19:54:37 -07:00
// Statue, monument, airlock, window
FullTileMask = Impassable | HighImpassable | MidImpassable | LowImpassable | InteractImpassable ,
// FlyingMob can go past
FullTileLayer = Opaque | HighImpassable | MidImpassable | LowImpassable | BulletImpassable | InteractImpassable ,
2022-05-10 17:57:20 -07:00
SubfloorMask = Impassable | LowImpassable
2018-10-30 01:13:10 -07:00
}