Update for collision events by-ref (#10933)

This commit is contained in:
metalgearsloth
2022-09-14 17:26:26 +10:00
committed by GitHub
parent feb50ce7cc
commit 78a4ab6eb2
105 changed files with 204 additions and 62 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Maps;
using Content.Shared.Physics;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Random;
using Robust.Shared.Timing;

View File

@@ -2,6 +2,7 @@ using System.Linq;
using Content.Shared.Administration;
using Content.Shared.Explosion;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
namespace Content.Server.Explosion.EntitySystems;
@@ -12,7 +13,7 @@ namespace Content.Server.Explosion.EntitySystems;
public sealed partial class ExplosionSystem : EntitySystem
{
/// <summary>
/// This is the main explosion generating function.
/// This is the main explosion generating function.
/// </summary>
/// <param name="epicenter">The center of the explosion</param>
/// <param name="typeID">The explosion type. this determines the explosion damage</param>
@@ -124,7 +125,7 @@ public sealed partial class ExplosionSystem : EntitySystem
if (totalIntensity < stepSize)
// Bit anticlimactic. All that set up for nothing....
return (1, new List<float> { totalIntensity }, spaceData, gridData, spaceMatrix);
// These variables keep track of the total intensity we have distributed
List<int> tilesInIteration = new() { 1 };
List<float> iterationIntensity = new() {stepSize};

View File

@@ -1,7 +1,9 @@
using Content.Server.Explosion.Components;
using Content.Shared.Physics;
using Content.Shared.Trigger;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events;
using Robust.Shared.Utility;
namespace Content.Server.Explosion.EntitySystems;
@@ -64,7 +66,7 @@ public sealed partial class TriggerSystem
});
}
private void OnProximityStartCollide(EntityUid uid, TriggerOnProximityComponent component, StartCollideEvent args)
private void OnProximityStartCollide(EntityUid uid, TriggerOnProximityComponent component, ref StartCollideEvent args)
{
if (args.OurFixture.ID != TriggerOnProximityComponent.FixtureID) return;
@@ -72,7 +74,7 @@ public sealed partial class TriggerSystem
component.Colliding.Add(args.OtherFixture.Body);
}
private static void OnProximityEndCollide(EntityUid uid, TriggerOnProximityComponent component, EndCollideEvent args)
private static void OnProximityEndCollide(EntityUid uid, TriggerOnProximityComponent component, ref EndCollideEvent args)
{
if (args.OurFixture.ID != TriggerOnProximityComponent.FixtureID) return;

View File

@@ -2,6 +2,7 @@
using Content.Server.Explosion.Components;
using Content.Server.Explosion.EntitySystems;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events;
namespace Content.Server.Explosion.EntitySystems;
@@ -14,7 +15,7 @@ public sealed partial class TriggerSystem
SubscribeLocalEvent<TriggerOnTimedCollideComponent, ComponentRemove>(OnComponentRemove);
}
private void OnTimerCollide(EntityUid uid, TriggerOnTimedCollideComponent component, StartCollideEvent args)
private void OnTimerCollide(EntityUid uid, TriggerOnTimedCollideComponent component, ref StartCollideEvent args)
{
//Ensures the entity trigger will have an active component
EnsureComp<ActiveTriggerOnTimedCollideComponent>(uid);
@@ -24,7 +25,7 @@ public sealed partial class TriggerSystem
component.Colliding.Add(otherUID, 0);
}
private void OnTimerEndCollide(EntityUid uid, TriggerOnTimedCollideComponent component, EndCollideEvent args)
private void OnTimerEndCollide(EntityUid uid, TriggerOnTimedCollideComponent component, ref EndCollideEvent args)
{
var otherUID = args.OtherFixture.Body.Owner;
component.Colliding.Remove(otherUID);

View File

@@ -19,6 +19,8 @@ using Content.Shared.Payload.Components;
using Content.Shared.StepTrigger.Systems;
using Robust.Server.Containers;
using Robust.Shared.Containers;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
namespace Content.Server.Explosion.EntitySystems
{
@@ -86,7 +88,7 @@ namespace Content.Server.Explosion.EntitySystems
args.Handled = true;
}
private void OnTriggerCollide(EntityUid uid, TriggerOnCollideComponent component, StartCollideEvent args)
private void OnTriggerCollide(EntityUid uid, TriggerOnCollideComponent component, ref StartCollideEvent args)
{
if(args.OurFixture.ID == component.FixtureID)
Trigger(component.Owner);