CollisionGroup.cs 3.9 KB

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