Inline GetComponentOrNull
This commit is contained in:
@@ -110,7 +110,7 @@ namespace Content.Shared.Body.Components
|
||||
public BodyPartSymmetry Symmetry { get; private set; } = BodyPartSymmetry.None;
|
||||
|
||||
[ViewVariables]
|
||||
public ISurgeryData? SurgeryDataComponent => Owner.GetComponentOrNull<ISurgeryData>();
|
||||
public ISurgeryData? SurgeryDataComponent => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ISurgeryData>(Owner.Uid);
|
||||
|
||||
protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Content.Shared.Friction
|
||||
Mover.UseMobMovement(body.OwnerUid)) continue;
|
||||
|
||||
var surfaceFriction = GetTileFriction(body);
|
||||
var bodyModifier = body.Owner.GetComponentOrNull<SharedTileFrictionModifier>()?.Modifier ?? 1.0f;
|
||||
var bodyModifier = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<SharedTileFrictionModifier>(body.Owner.Uid)?.Modifier ?? 1.0f;
|
||||
var friction = _frictionModifier * surfaceFriction * bodyModifier;
|
||||
|
||||
ReduceLinearVelocity(prediction, body, friction, frameTime);
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Content.Shared.MobState.Components
|
||||
else
|
||||
{
|
||||
// Initialize with some amount of damage, defaulting to 0.
|
||||
UpdateState(Owner.GetComponentOrNull<DamageableComponent>()?.TotalDamage ?? FixedPoint2.Zero);
|
||||
UpdateState(IoCManager.Resolve<IEntityManager>().GetComponentOrNull<DamageableComponent>(Owner.Uid)?.TotalDamage ?? FixedPoint2.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Content.Shared.Singularity
|
||||
|
||||
value = Math.Clamp(value, 0, 6);
|
||||
|
||||
var physics = singularity.Owner.GetComponentOrNull<PhysicsComponent>();
|
||||
var physics = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<PhysicsComponent>(singularity.Owner.Uid);
|
||||
|
||||
if (singularity.Level > 1 && value <= 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user