Files
tbd-station-14/Content.Shared/Physics/CollisionGroup.cs
Daniel Castro Razo cc4669244d Fixes to explosionhelper (#2819)
* Revert "Make handheld explosives affect tiles (#2806)"

This reverts commit 005e142949.

* Fixes tiles being destroyed under walls by an explosion

* Extra imports removed

* Handles explosion in space and different grids

This handle explosions across different grids, and tiles are still protected if there is an entity airtight and currently blocking air on top of them that survived the explosion.

* Some bug fixes

- The way tiles were being protected was silly.
- Big explosions cause a lot of objects to trigger multiple events and at the same time they are destroyed.
- Explosions spawning inside containers like closets work now.

* Range bug fixes

* Explosive

The explosion works even if the entity exploding is inside multiple 'layers' of containers like.
bomb -> survival box -> tool box -> closet

* Explosions are different now

Explosion can't jump over walls now.
Explosions work like rays now, if an explosion breaks a wall it can scatter inside the room.
If entities are behind impassable entities that survive the blast  they are left unscathed.

* Little fix

* Remove the extra lookup of tiles

* Another small change

* Restore the second lookup

I thought this was extra, but this protects the tile under it if there is an Impassable entity on top. None wants anchored girders on top of lattice/space

* Changing order of conditions

IsBlockedTurf is cheaper to run than InRangeUnobstructed.

* Yep
2021-01-02 19:03:10 +01:00

35 lines
1.8 KiB
C#

using System;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
using RobustPhysics = Robust.Shared.Physics;
namespace Content.Shared.Physics
{
/// <summary>
/// Defined collision groups for the physics system.
/// </summary>
[Flags, PublicAPI]
[FlagsFor(typeof(RobustPhysics.CollisionLayer)), FlagsFor(typeof(RobustPhysics.CollisionMask))]
public enum CollisionGroup
{
None = 0,
Opaque = 1 << 0, // 1 Blocks light, for lasers
Impassable = 1 << 1, // 2 Walls, objects impassable by any means
MobImpassable = 1 << 2, // 4 Mobs, players, crabs, etc
VaultImpassable = 1 << 3, // 8 Things that cannot be jumped over, not half walls or tables
SmallImpassable = 1 << 4, // 16 Things a smaller object - a cat, a crab - can't go through - a wall, but not a computer terminal or a table
Clickable = 1 << 5, // 32 Temporary "dummy" layer to ensure that objects can still be clicked even if they don't collide with anything (you can't interact with objects that have no layer, including items)
GhostImpassable = 1 << 6, // 64 Things impassible by ghosts/observers, ie blessed tiles or forcefields
Underplating = 1 << 7, // 128 Things that are under plating
Passable = 1 << 8, // 256 Things that are passable
ExplosivePassable = 1 << 9, // 512 Things that let the pressure of a explosion through
MapGrid = MapGridHelpers.CollisionGroup, // Map grids, like shuttles. This is the actual grid itself, not the walls or other entities connected to the grid.
MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable,
ThrownItem = MobImpassable | Impassable,
// 32 possible groups
AllMask = -1,
}
}