Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
FIX THE SHIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Just-a-Unity-Dev committed Jun 3, 2023
1 parent 88998db commit 81ef6e4
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ protected override bool PreventCollide(EntityUid uid, EventHorizonComponent comp
if (base.PreventCollide(uid, comp, ref args) || args.Cancelled)
return true;

args.Cancelled = !CanConsumeEntity(args.BodyB.Owner, comp);
args.Cancelled = !CanConsumeEntity(args.OtherBody.Owner, comp);
return false;
}

Expand Down
4 changes: 3 additions & 1 deletion Content.Server/_StationWare/Body/GibOnCollideSystem.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using Content.Server.Body.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Mobs.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Events;

namespace Content.Server._StationWare.Body;

public sealed class GibOnCollideSystem : EntitySystem
{
[Dependency] private readonly BodySystem _body = default!;
[Dependency] private readonly PhysicsSystem _physics = default!;

/// <inheritdoc/>
public override void Initialize()
Expand All @@ -17,7 +19,7 @@ public override void Initialize()

private void OnCollide(EntityUid uid, GibOnCollideComponent component, ref StartCollideEvent args)
{
var otherEnt = args.OtherFixture.Body.Owner;
var otherEnt = args.OtherEntity;
if (!HasComp<MobStateComponent>(otherEnt) || !TryComp<BodyComponent>(otherEnt, out var body))
return;
_body.GibBody(otherEnt, true, body, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private void OnBeforeChallengeEnd(EntityUid uid, ControlPointModifierComponent c
{
foreach (var contact in _physics.GetContactingEntities(body))
{
var ent = contact.Owner;
var ent = contact;
if (!args.Players.Contains(ent))
continue;
_stationWareChallenge.SetPlayerChallengeState(ent, uid, true, args.Component);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Tag;
using Robust.Server.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;

namespace Content.Server._StationWare.Challenges.Modifiers.Systems;

Expand Down Expand Up @@ -37,9 +38,18 @@ private void OnChallengeStart(EntityUid uid, NonSolidStructuresModifierComponent

private void OnChallengeEnd(EntityUid uid, NonSolidStructuresModifierComponent component, ref ChallengeEndEvent args)
{
foreach (var fixture in component.AffectedFixtures)
var enumerator = EntityQueryEnumerator<TagComponent, FixturesComponent>();
while (enumerator.MoveNext(out var ent, out var tag, out var fixtures))
{
_physics.SetHard(fixture.Body.Owner, fixture, true);
if (!_tag.HasTag(tag, component.TargetTag))
continue;

foreach (var fixture in fixtures.Fixtures.Values)
{
if (!fixture.Hard)
continue;
_physics.SetHard(ent, fixture, true, fixtures);
}
}
component.AffectedFixtures.Clear();
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void OnBuckleInsertIntoEntityStorageAttempt(EntityUid uid, BuckleCompone

private void OnBucklePreventCollide(EntityUid uid, BuckleComponent component, ref PreventCollideEvent args)
{
if (args.BodyB.Owner != component.BuckledTo)
if (args.OtherBody.Owner != component.BuckledTo)
return;

if (component.Buckled || component.DontCollide)
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Disposal/SharedDisposalUnitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void Initialize()
private void OnPreventCollide(EntityUid uid, SharedDisposalUnitComponent component,
ref PreventCollideEvent args)
{
var otherBody = args.BodyB.Owner;
var otherBody = args.OtherBody.Owner;

// Items dropped shouldn't collide but items thrown should
if (EntityManager.HasComponent<ItemComponent>(otherBody) &&
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Doors/Systems/SharedDoorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public IEnumerable<EntityUid> GetColliding(EntityUid uid, PhysicsComponent? phys

private void PreventCollision(EntityUid uid, DoorComponent component, ref PreventCollideEvent args)
{
if (component.CurrentlyCrushing.Contains(args.BodyB.Owner))
if (component.CurrentlyCrushing.Contains(args.OtherBody.Owner))
{
args.Cancelled = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Physics/SharedPreventCollideSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private void OnHandleState(EntityUid uid, PreventCollideComponent component, ref

private void OnPreventCollide(EntityUid uid, PreventCollideComponent component, ref PreventCollideEvent args)
{
var otherUid = args.BodyB.Owner;
var otherUid = args.OtherBody.Owner;

if (component.Uid == otherUid)
args.Cancelled = true;
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Projectiles/SharedProjectileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void OnEmbedCollide(EntityUid uid, EmbeddableProjectileComponent compone

private void PreventCollision(EntityUid uid, ProjectileComponent component, ref PreventCollideEvent args)
{
if (component.IgnoreShooter && args.BodyB.Owner == component.Shooter)
if (component.IgnoreShooter && args.OtherBody.Owner == component.Shooter)
{
args.Cancelled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private void OnPreventCollide(EntityUid uid, EventHorizonComponent comp, ref Pre
/// <returns>A bool indicating whether the collision prevention has been handled.</returns>
protected virtual bool PreventCollide(EntityUid uid, EventHorizonComponent comp, ref PreventCollideEvent args)
{
var otherUid = args.BodyB.Owner;
var otherUid = args.OtherBody.Owner;

// For prediction reasons always want the client to ignore these.
if (HasComp<MapGridComponent>(otherUid) ||
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Throwing/ThrownItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void HandleCollision(EntityUid uid, ThrownItemComponent component, ref S

private void PreventCollision(EntityUid uid, ThrownItemComponent component, ref PreventCollideEvent args)
{
if (args.BodyB.Owner == component.Thrower)
if (args.OtherBody.Owner == component.Thrower)
{
args.Cancelled = true;
}
Expand Down

0 comments on commit 81ef6e4

Please sign in to comment.