Fix thrown items colliding with non-hard entities (#8243)

* Fix pies colliding with non-hard(puddles)

* Fix thrown items colliding with tables
This commit is contained in:
Jacob Tong
2022-05-17 19:24:58 -07:00
committed by GitHub
parent b848b5167d
commit f7363df19e
2 changed files with 5 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ public enum CollisionGroup
// Soap, spills // Soap, spills
SlipLayer = MidImpassable | LowImpassable, SlipLayer = MidImpassable | LowImpassable,
ItemMask = Impassable | HighImpassable, ItemMask = Impassable | HighImpassable,
ThrownItem = Impassable | HighImpassable, ThrownItem = Impassable | HighImpassable | BulletImpassable,
WallLayer = Opaque | Impassable | HighImpassable | MidImpassable | LowImpassable | BulletImpassable | InteractImpassable, WallLayer = Opaque | Impassable | HighImpassable | MidImpassable | LowImpassable | BulletImpassable | InteractImpassable,
GlassLayer = Impassable | HighImpassable | MidImpassable | LowImpassable | BulletImpassable | InteractImpassable, GlassLayer = Impassable | HighImpassable | MidImpassable | LowImpassable | BulletImpassable | InteractImpassable,
HalfWallLayer = MidImpassable | LowImpassable, HalfWallLayer = MidImpassable | LowImpassable,

View File

@@ -63,12 +63,15 @@ namespace Content.Shared.Throwing
} }
var fixture = fixturesComponent.Fixtures.Values.First(); var fixture = fixturesComponent.Fixtures.Values.First();
var shape = fixture.Shape; var shape = fixture.Shape;
var throwingFixture = new Fixture(physicsComponent, shape) { CollisionLayer = (int) CollisionGroup.ThrownItem, Hard = false, ID = ThrowingFixture }; var throwingFixture = new Fixture(physicsComponent, shape) { CollisionMask = (int) CollisionGroup.ThrownItem, Hard = false, ID = ThrowingFixture };
_fixtures.TryCreateFixture(physicsComponent, throwingFixture, manager: fixturesComponent); _fixtures.TryCreateFixture(physicsComponent, throwingFixture, manager: fixturesComponent);
} }
private void HandleCollision(EntityUid uid, ThrownItemComponent component, StartCollideEvent args) private void HandleCollision(EntityUid uid, ThrownItemComponent component, StartCollideEvent args)
{ {
if (args.OtherFixture.Hard == false)
return;
var thrower = component.Thrower; var thrower = component.Thrower;
var otherBody = args.OtherFixture.Body; var otherBody = args.OtherFixture.Body;