Skip to content

Commit

Permalink
Fix Singulo (#1830)
Browse files Browse the repository at this point in the history
# Description

Makes the singulo stop quantum tunneling through its containment. If
this doesn't work and I'm still on vacation beating up nerds in the
woods, you need to revert this pr right here:
#1619

# Changelog

:cl:
- fix: Singularity shouldn't escape its containment anymore. If it's
still escaping containment, do me a favor and revert PR 1619 (Newtonian
Singularity)

---------

Co-authored-by: Partmedia <[email protected]>
  • Loading branch information
VMSolidus and Partmedia authored Feb 21, 2025
1 parent d2ac137 commit 45905b2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
#endregion Dependencies

private EntityQuery<PhysicsComponent> _physicsQuery;
private const float CosmicSpeedLimit = 20f;

public override void Initialize()
{
Expand Down Expand Up @@ -125,10 +126,12 @@ public void Update(EntityUid uid, EventHorizonComponent? eventHorizon = null, Tr
/// </summary>
public void ConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, BaseContainer? outerContainer = null)
{
if (!EntityManager.IsQueuedForDeletion(morsel) // I saw it log twice a few times for some reason?
&& (HasComp<MindContainerComponent>(morsel)
if (EntityManager.IsQueuedForDeletion(morsel)) // already handled, and we're substepping
return;

if (HasComp<MindContainerComponent>(morsel)
|| _tagSystem.HasTag(morsel, "HighRiskItem")
|| HasComp<ContainmentFieldGeneratorComponent>(morsel)))
|| HasComp<ContainmentFieldGeneratorComponent>(morsel))
{
_adminLogger.Add(LogType.EntityDelete, LogImpact.Extreme, $"{ToPrettyString(morsel)} entered the event horizon of {ToPrettyString(hungry)} and was deleted");
}
Expand All @@ -140,6 +143,9 @@ public void ConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonCompon
var impulse = (otherPhysics.LinearVelocity - thisPhysics.LinearVelocity)
* otherPhysics.FixturesMass
* thisPhysics.FixturesMass / (thisPhysics.FixturesMass + otherPhysics.FixturesMass); // Accounts for the expected mass change from consuming the object
if (impulse.Length() >= CosmicSpeedLimit) // Stop it from quantum tunneling through walls.
impulse = impulse.Normalized() * CosmicSpeedLimit;

_physics.ApplyLinearImpulse(hungry, impulse, body: thisPhysics);
}

Expand Down

0 comments on commit 45905b2

Please sign in to comment.