Fix 3000 errors
This commit is contained in:
@@ -468,7 +468,7 @@ namespace Content.Shared.Body.Components
|
||||
var i = 0;
|
||||
foreach (var (part, slot) in SlotParts)
|
||||
{
|
||||
parts[i] = (slot.Id, OwnerUid: ((IComponent) part).Owner);
|
||||
parts[i] = (slot.Id, Owner: ((IComponent) part).Owner);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -542,12 +542,12 @@ namespace Content.Shared.Body.Components
|
||||
|
||||
foreach (var (slot, partId) in PartIds)
|
||||
{
|
||||
if (!entityManager.TryGetEntity(partId, out var entity))
|
||||
if (!entityManager.EntityExists(partId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Value, out SharedBodyPartComponent? part))
|
||||
if (!entityManager.TryGetComponent(partId, out SharedBodyPartComponent? part))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -293,7 +292,7 @@ namespace Content.Shared.Body.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) mechanism.Owner);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(mechanism.Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -365,12 +364,12 @@ namespace Content.Shared.Body.Components
|
||||
|
||||
foreach (var id in MechanismIds)
|
||||
{
|
||||
if (!entityManager.TryGetEntity(id, out var entity))
|
||||
if (!entityManager.EntityExists(id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Value, out SharedMechanismComponent? mechanism))
|
||||
if (!entityManager.TryGetComponent(id, out SharedMechanismComponent? mechanism))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
/// Perform a reaction on a solution. This assumes all reaction criteria are met.
|
||||
/// Removes the reactants from the solution, then returns a solution with all products.
|
||||
/// </summary>
|
||||
private Solution PerformReaction(Solution solution, EntityUid ownerUid, ReactionPrototype reaction, FixedPoint2 unitReactions)
|
||||
private Solution PerformReaction(Solution solution, EntityUid Owner, ReactionPrototype reaction, FixedPoint2 unitReactions)
|
||||
{
|
||||
// We do this so that ReagentEffect can have something to work with, even if it's
|
||||
// a little meaningless.
|
||||
@@ -167,14 +167,14 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
}
|
||||
|
||||
// Trigger reaction effects
|
||||
OnReaction(solution, reaction, randomReagent, ownerUid, unitReactions);
|
||||
OnReaction(solution, reaction, randomReagent, Owner, unitReactions);
|
||||
|
||||
return products;
|
||||
}
|
||||
|
||||
protected virtual void OnReaction(Solution solution, ReactionPrototype reaction, ReagentPrototype randomReagent, EntityUid ownerUid, FixedPoint2 unitReactions)
|
||||
protected virtual void OnReaction(Solution solution, ReactionPrototype reaction, ReagentPrototype randomReagent, EntityUid Owner, FixedPoint2 unitReactions)
|
||||
{
|
||||
var args = new ReagentEffectArgs(ownerUid, null, solution,
|
||||
var args = new ReagentEffectArgs(Owner, null, solution,
|
||||
randomReagent,
|
||||
unitReactions, EntityManager, null);
|
||||
|
||||
@@ -185,9 +185,9 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
|
||||
if (effect.ShouldLog)
|
||||
{
|
||||
var entity = EntityManager.GetEntity(args.SolutionEntity);
|
||||
var entity = args.SolutionEntity;
|
||||
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact,
|
||||
$"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates}");
|
||||
$"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {EntityManager.GetComponent<TransformComponent>(entity).Coordinates}");
|
||||
}
|
||||
|
||||
effect.Effect(args);
|
||||
@@ -199,7 +199,7 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
/// Removes the reactants from the solution, then returns a solution with all products.
|
||||
/// WARNING: Does not trigger reactions between solution and new products.
|
||||
/// </summary>
|
||||
private bool ProcessReactions(Solution solution, EntityUid ownerUid, [MaybeNullWhen(false)] out Solution productSolution)
|
||||
private bool ProcessReactions(Solution solution, EntityUid Owner, [MaybeNullWhen(false)] out Solution productSolution)
|
||||
{
|
||||
foreach(var reactant in solution.Contents)
|
||||
{
|
||||
@@ -211,7 +211,7 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
if (!CanReact(solution, reaction, out var unitReactions))
|
||||
continue;
|
||||
|
||||
productSolution = PerformReaction(solution, ownerUid, reaction, unitReactions);
|
||||
productSolution = PerformReaction(solution, Owner, reaction, unitReactions);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -223,11 +223,11 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
/// <summary>
|
||||
/// Continually react a solution until no more reactions occur.
|
||||
/// </summary>
|
||||
public void FullyReactSolution(Solution solution, EntityUid ownerUid)
|
||||
public void FullyReactSolution(Solution solution, EntityUid Owner)
|
||||
{
|
||||
for (var i = 0; i < MaxReactionIterations; i++)
|
||||
{
|
||||
if (!ProcessReactions(solution, ownerUid, out var products))
|
||||
if (!ProcessReactions(solution, Owner, out var products))
|
||||
return;
|
||||
|
||||
if (products.TotalVolume <= 0)
|
||||
@@ -235,18 +235,18 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
|
||||
solution.AddSolution(products);
|
||||
}
|
||||
Logger.Error($"{nameof(Solution)} {ownerUid} could not finish reacting in under {MaxReactionIterations} loops.");
|
||||
Logger.Error($"{nameof(Solution)} {Owner} could not finish reacting in under {MaxReactionIterations} loops.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Continually react a solution until no more reactions occur, with a volume constraint.
|
||||
/// If a reaction's products would exceed the max volume, some product is deleted.
|
||||
/// </summary>
|
||||
public void FullyReactSolution(Solution solution, EntityUid ownerUid, FixedPoint2 maxVolume)
|
||||
public void FullyReactSolution(Solution solution, EntityUid Owner, FixedPoint2 maxVolume)
|
||||
{
|
||||
for (var i = 0; i < MaxReactionIterations; i++)
|
||||
{
|
||||
if (!ProcessReactions(solution, ownerUid, out var products))
|
||||
if (!ProcessReactions(solution, Owner, out var products))
|
||||
return;
|
||||
|
||||
if (products.TotalVolume <= 0)
|
||||
@@ -262,7 +262,7 @@ namespace Content.Shared.Chemistry.Reaction
|
||||
|
||||
solution.AddSolution(products);
|
||||
}
|
||||
Logger.Error($"{nameof(Solution)} {ownerUid} could not finish reacting in under {MaxReactionIterations} loops.");
|
||||
Logger.Error($"{nameof(Solution)} {Owner} could not finish reacting in under {MaxReactionIterations} loops.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
if (effect.ShouldLog)
|
||||
{
|
||||
var entity = EntityManager.GetEntity(args.SolutionEntity);
|
||||
var entity = args.SolutionEntity;
|
||||
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact,
|
||||
$"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates}");
|
||||
$"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {EntityManager.GetComponent<TransformComponent>(entity).Coordinates}");
|
||||
}
|
||||
|
||||
effect.Effect(args);
|
||||
@@ -92,9 +92,9 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
if (effect.ShouldLog)
|
||||
{
|
||||
var entity = EntityManager.GetEntity(args.SolutionEntity);
|
||||
var entity = args.SolutionEntity;
|
||||
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact,
|
||||
$"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates}");
|
||||
$"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {EntityManager.GetComponent<TransformComponent>(entity).Coordinates}");
|
||||
}
|
||||
|
||||
effect.Effect(args);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Body.Prototypes;
|
||||
using Content.Shared.Botany;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reaction;
|
||||
using Content.Shared.Database;
|
||||
@@ -16,7 +15,6 @@ using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Chemistry.Reagent
|
||||
@@ -123,7 +121,7 @@ namespace Content.Shared.Chemistry.Reagent
|
||||
|
||||
if (plantMetabolizable.ShouldLog)
|
||||
{
|
||||
var entity = entMan.GetEntity(args.SolutionEntity);
|
||||
var entity = args.SolutionEntity;
|
||||
EntitySystem.Get<SharedAdminLogSystem>().Add(LogType.ReagentEffect, plantMetabolizable.LogImpact,
|
||||
$"Plant metabolism effect {plantMetabolizable.GetType().Name:effect} of reagent {ID} applied on entity {entity} at {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates}");
|
||||
plantMetabolizable.Effect(args);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Shared.CombatMode
|
||||
{
|
||||
@@ -15,7 +14,7 @@ namespace Content.Shared.CombatMode
|
||||
|
||||
private void CombatModeActiveHandler(CombatModeSystemMessages.SetCombatModeActiveMessage ev, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
var entity = eventArgs.SenderSession.AttachedEntityUid;
|
||||
var entity = eventArgs.SenderSession.AttachedEntity;
|
||||
|
||||
if (entity == null || !EntityManager.TryGetComponent(entity.Value, out SharedCombatModeComponent? combatModeComponent))
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Content.Shared.Cuffs
|
||||
|
||||
private void HandleStopPull(EntityUid uid, SharedCuffableComponent component, StopPullingEvent args)
|
||||
{
|
||||
if (args.User == null || !EntityManager.TryGetEntity(args.User.Value, out var user)) return;
|
||||
if (args.User == null || !EntityManager.EntityExists(args.User.Value) return;
|
||||
|
||||
if (user == component.Owner && !component.CanStillInteract)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Shared.Flash
|
||||
private void OnGetStateAttempt(EntityUid uid, SharedFlashableComponent component, ComponentGetStateAttemptEvent args)
|
||||
{
|
||||
// Only send state to the player attached to the entity.
|
||||
if (args.Player.AttachedEntityUid != uid)
|
||||
if (args.Player.AttachedEntity != uid)
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.Shared.Gravity
|
||||
|
||||
private void HandleGridInitialize(GridInitializeEvent ev)
|
||||
{
|
||||
var gridEnt = EntityManager.GetEntity(ev.EntityUid);
|
||||
var gridev.EntityUid
|
||||
gridEnt.EnsureComponent<GravityComponent>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -216,23 +215,23 @@ namespace Content.Shared.Hands.Components
|
||||
if (!TryGetActiveHand(out var hand))
|
||||
return false;
|
||||
|
||||
return hand.HeldEntity != null;
|
||||
return hand.HeldEntity != default;
|
||||
}
|
||||
|
||||
public bool TryGetHeldEntity(string handName, [NotNullWhen(true)] out EntityUid? heldEntity)
|
||||
public bool TryGetHeldEntity(string handName, out EntityUid heldEntity)
|
||||
{
|
||||
heldEntity = null;
|
||||
heldEntity = default;
|
||||
|
||||
if (!TryGetHand(handName, out var hand))
|
||||
return false;
|
||||
|
||||
heldEntity = hand.HeldEntity;
|
||||
return heldEntity != null;
|
||||
return heldEntity != default;
|
||||
}
|
||||
|
||||
public bool TryGetActiveHeldEntity([NotNullWhen(true)] out EntityUid? heldEntity)
|
||||
public bool TryGetActiveHeldEntity(out EntityUid heldEntity)
|
||||
{
|
||||
heldEntity = GetActiveHand()?.HeldEntity;
|
||||
heldEntity = GetActiveHand()?.HeldEntity ?? default;
|
||||
return heldEntity != null;
|
||||
}
|
||||
|
||||
@@ -250,7 +249,7 @@ namespace Content.Shared.Hands.Components
|
||||
{
|
||||
foreach (var hand in Hands)
|
||||
{
|
||||
if (hand.HeldEntity != null)
|
||||
if (hand.HeldEntity != default)
|
||||
yield return hand.HeldEntity.Value;
|
||||
}
|
||||
}
|
||||
@@ -264,7 +263,7 @@ namespace Content.Shared.Hands.Components
|
||||
int acc = 0;
|
||||
foreach (var hand in Hands)
|
||||
{
|
||||
if (hand.HeldEntity == null)
|
||||
if (hand.HeldEntity == default)
|
||||
acc += 1;
|
||||
}
|
||||
|
||||
@@ -892,9 +891,9 @@ namespace Content.Shared.Hands.Components
|
||||
public IContainer? Container { get; set; }
|
||||
|
||||
[ViewVariables]
|
||||
public EntityUid? HeldEntity => Container?.ContainedEntities?.FirstOrDefault();
|
||||
public EntityUid HeldEntity => Container?.ContainedEntities.FirstOrDefault() ?? EntityUid.Invalid;
|
||||
|
||||
public bool IsEmpty => HeldEntity == null;
|
||||
public bool IsEmpty => HeldEntity == default;
|
||||
|
||||
public Hand(string name, HandLocation location, IContainer? container = null)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Shared.Hands
|
||||
{
|
||||
@@ -21,9 +20,9 @@ namespace Content.Shared.Hands
|
||||
|
||||
private void HandleSetHand(RequestSetHandEvent msg, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
var entity = eventArgs.SenderSession.AttachedEntityUid;
|
||||
var entity = eventArgs.SenderSession.AttachedEntity;
|
||||
|
||||
if (entity == null || !EntityManager.TryGetComponent(entity.Value, out SharedHandsComponent? hands))
|
||||
if (entity == default || !EntityManager.TryGetComponent(entity, out SharedHandsComponent? hands))
|
||||
return;
|
||||
|
||||
hands.ActiveHand = msg.HandName;
|
||||
|
||||
@@ -24,10 +24,7 @@ namespace Content.Shared.Interaction.Helpers
|
||||
bool popup = false,
|
||||
IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
return InRangeUnobstructed(entityManager.GetEntity(origin), entityManager.GetEntity(other),
|
||||
range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
||||
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
||||
}
|
||||
|
||||
public static bool InRangeUnobstructed(
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Content.Shared.Interaction
|
||||
|
||||
foreach (var result in rayResults)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(result.HitEntity, out IPhysBody? p))
|
||||
if (!EntityManager.TryGetComponent(result.HitEntity, out IPhysBody? p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ namespace Content.Shared.Interaction
|
||||
bool popup = false)
|
||||
{
|
||||
predicate ??= e => e == origin || e == other;
|
||||
return InRangeUnobstructed(origin, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
||||
return InRangeUnobstructed(origin, EntityManager.GetComponent<TransformComponent>(other).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -345,7 +345,7 @@ namespace Content.Shared.Interaction
|
||||
bool ignoreInsideBlocker = false,
|
||||
bool popup = false)
|
||||
{
|
||||
var originPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
|
||||
var originPosition = EntityManager.GetComponent<TransformComponent>(origin).MapPosition;
|
||||
predicate ??= e => e == origin;
|
||||
|
||||
var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker);
|
||||
@@ -392,7 +392,7 @@ namespace Content.Shared.Interaction
|
||||
|
||||
var interactUsingEventArgs = new InteractUsingEventArgs(user, clickLocation, used, target);
|
||||
|
||||
var interactUsings = IoCManager.Resolve<IEntityManager>().GetComponents<IInteractUsing>(target).OrderByDescending(x => x.Priority);
|
||||
var interactUsings = EntityManager.GetComponents<IInteractUsing>(target).OrderByDescending(x => x.Priority);
|
||||
foreach (var interactUsing in interactUsings)
|
||||
{
|
||||
// If an InteractUsing returns a status completion we finish our interaction
|
||||
@@ -415,7 +415,7 @@ namespace Content.Shared.Interaction
|
||||
return true;
|
||||
|
||||
var afterInteractEventArgs = new AfterInteractEventArgs(user, clickLocation, target, canReach);
|
||||
var afterInteracts = IoCManager.Resolve<IEntityManager>().GetComponents<IAfterInteract>(used).OrderByDescending(x => x.Priority).ToList();
|
||||
var afterInteracts = EntityManager.GetComponents<IAfterInteract>(used).OrderByDescending(x => x.Priority).ToList();
|
||||
|
||||
foreach (var afterInteract in afterInteracts)
|
||||
{
|
||||
@@ -441,7 +441,7 @@ namespace Content.Shared.Interaction
|
||||
|
||||
protected void InteractionActivate(EntityUid user, EntityUid used)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<UseDelayComponent?>(used, out var delayComponent))
|
||||
if (EntityManager.TryGetComponent<UseDelayComponent?>(used, out var delayComponent))
|
||||
{
|
||||
if (delayComponent.ActiveDelay)
|
||||
return;
|
||||
@@ -469,7 +469,7 @@ namespace Content.Shared.Interaction
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(used, out IActivate? activateComp))
|
||||
if (!EntityManager.TryGetComponent(used, out IActivate? activateComp))
|
||||
return;
|
||||
|
||||
var activateEventArgs = new ActivateEventArgs(user, used);
|
||||
@@ -503,7 +503,7 @@ namespace Content.Shared.Interaction
|
||||
/// </summary>
|
||||
public void UseInteraction(EntityUid user, EntityUid used)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<UseDelayComponent?>(used, out var delayComponent))
|
||||
if (EntityManager.TryGetComponent<UseDelayComponent?>(used, out var delayComponent))
|
||||
{
|
||||
if (delayComponent.ActiveDelay)
|
||||
return;
|
||||
@@ -516,7 +516,7 @@ namespace Content.Shared.Interaction
|
||||
if (useMsg.Handled)
|
||||
return;
|
||||
|
||||
var uses = IoCManager.Resolve<IEntityManager>().GetComponents<IUse>(used).ToList();
|
||||
var uses = EntityManager.GetComponents<IUse>(used).ToList();
|
||||
|
||||
// Try to use item on any components which have the interface
|
||||
foreach (var use in uses)
|
||||
@@ -557,7 +557,7 @@ namespace Content.Shared.Interaction
|
||||
return;
|
||||
}
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IThrown>(thrown).ToList();
|
||||
var comps = EntityManager.GetComponents<IThrown>(thrown).ToList();
|
||||
var args = new ThrownEventArgs(user);
|
||||
|
||||
// Call Thrown on all components that implement the interface
|
||||
@@ -581,7 +581,7 @@ namespace Content.Shared.Interaction
|
||||
if (equipMsg.Handled)
|
||||
return;
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IEquipped>(equipped).ToList();
|
||||
var comps = EntityManager.GetComponents<IEquipped>(equipped).ToList();
|
||||
|
||||
// Call Thrown on all components that implement the interface
|
||||
foreach (var comp in comps)
|
||||
@@ -601,7 +601,7 @@ namespace Content.Shared.Interaction
|
||||
if (unequipMsg.Handled)
|
||||
return;
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IUnequipped>(equipped).ToList();
|
||||
var comps = EntityManager.GetComponents<IUnequipped>(equipped).ToList();
|
||||
|
||||
// Call Thrown on all components that implement the interface
|
||||
foreach (var comp in comps)
|
||||
@@ -622,7 +622,7 @@ namespace Content.Shared.Interaction
|
||||
if (equippedHandMessage.Handled)
|
||||
return;
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IEquippedHand>(item).ToList();
|
||||
var comps = EntityManager.GetComponents<IEquippedHand>(item).ToList();
|
||||
|
||||
foreach (var comp in comps)
|
||||
{
|
||||
@@ -641,7 +641,7 @@ namespace Content.Shared.Interaction
|
||||
if (unequippedHandMessage.Handled)
|
||||
return;
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IUnequippedHand>(item).ToList();
|
||||
var comps = EntityManager.GetComponents<IUnequippedHand>(item).ToList();
|
||||
|
||||
foreach (var comp in comps)
|
||||
{
|
||||
@@ -678,9 +678,9 @@ namespace Content.Shared.Interaction
|
||||
return;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(item).LocalRotation = Angle.Zero;
|
||||
EntityManager.GetComponent<TransformComponent>(item).LocalRotation = Angle.Zero;
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IDropped>(item).ToList();
|
||||
var comps = EntityManager.GetComponents<IDropped>(item).ToList();
|
||||
|
||||
// Call Land on all components that implement the interface
|
||||
foreach (var comp in comps)
|
||||
@@ -703,7 +703,7 @@ namespace Content.Shared.Interaction
|
||||
if (handSelectedMsg.Handled)
|
||||
return;
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IHandSelected>(item).ToList();
|
||||
var comps = EntityManager.GetComponents<IHandSelected>(item).ToList();
|
||||
|
||||
// Call Land on all components that implement the interface
|
||||
foreach (var comp in comps)
|
||||
@@ -723,7 +723,7 @@ namespace Content.Shared.Interaction
|
||||
if (handDeselectedMsg.Handled)
|
||||
return;
|
||||
|
||||
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IHandDeselected>(item).ToList();
|
||||
var comps = EntityManager.GetComponents<IHandDeselected>(item).ToList();
|
||||
|
||||
// Call Land on all components that implement the interface
|
||||
foreach (var comp in comps)
|
||||
|
||||
@@ -16,13 +16,15 @@ namespace Content.Shared.Movement.Components
|
||||
{
|
||||
public static bool IsWeightless(this EntityUid entity, PhysicsComponent? body = null, EntityCoordinates? coords = null, IMapManager? mapManager = null, IEntityManager? entityManager = null)
|
||||
{
|
||||
if (body == null)
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out body);
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<MovementIgnoreGravityComponent>(entity) ||
|
||||
if (body == null)
|
||||
entityManager.TryGetComponent(entity, out body);
|
||||
|
||||
if (entityManager.HasComponent<MovementIgnoreGravityComponent>(entity) ||
|
||||
(body?.BodyType & (BodyType.Static | BodyType.Kinematic)) != 0) return false;
|
||||
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity);
|
||||
var transform = entityManager.GetComponent<TransformComponent>(entity);
|
||||
var gridId = transform.GridID;
|
||||
|
||||
if (!gridId.IsValid())
|
||||
@@ -34,18 +36,15 @@ namespace Content.Shared.Movement.Components
|
||||
|
||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
var gridEntityId = grid.GridEntityId;
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
var gridEntity = entityManager.GetEntity(gridEntityId);
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(gridEntity).Enabled)
|
||||
if (!entityManager.GetComponent<GravityComponent>(grid.GridEntityId).Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
coords ??= transform.Coordinates;
|
||||
|
||||
if (!coords.Value.IsValid(IoCManager.Resolve<IEntityManager>()))
|
||||
if (!coords.Value.IsValid(entityManager))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Content.Shared.Movement.EntitySystems
|
||||
if (!TryGetAttachedComponent<IMoverComponent>(session, out var moverComp))
|
||||
return;
|
||||
|
||||
var owner = session?.AttachedEntityUid;
|
||||
var owner = session?.AttachedEntity;
|
||||
|
||||
if (owner != null && session != null)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ namespace Content.Shared.Movement.EntitySystems
|
||||
{
|
||||
component = default;
|
||||
|
||||
var ent = session?.AttachedEntityUid;
|
||||
var ent = session?.AttachedEntity;
|
||||
|
||||
if (ent == null || !IoCManager.Resolve<IEntityManager>().EntityExists(ent.Value))
|
||||
return false;
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
using System;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Dynamics.Joints;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Pulling.Components
|
||||
@@ -28,14 +24,14 @@ namespace Content.Shared.Pulling.Components
|
||||
/// The current entity pulling this component.
|
||||
/// SharedPullingStateManagementSystem should be writing this. This means definitely not you.
|
||||
/// </summary>
|
||||
public EntityUid? Puller { get; set; }
|
||||
public EntityUid Puller { get; set; }
|
||||
/// <summary>
|
||||
/// The pull joint.
|
||||
/// SharedPullingStateManagementSystem should be writing this. This means probably not you.
|
||||
/// </summary>
|
||||
public DistanceJoint? PullJoint { get; set; }
|
||||
|
||||
public bool BeingPulled => Puller != null;
|
||||
public bool BeingPulled => Puller != default;
|
||||
|
||||
public EntityCoordinates? MovingTo { get; set; }
|
||||
|
||||
@@ -53,25 +49,25 @@ namespace Content.Shared.Pulling.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.Puller == null)
|
||||
if (!state.Puller.HasValue)
|
||||
{
|
||||
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceDisconnectPullable(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(state.Puller.Value, out var entity))
|
||||
if (!state.Puller.Value.IsValid())
|
||||
{
|
||||
Logger.Error($"Invalid entity {state.Puller.Value} for pulling");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Puller == entity)
|
||||
if (Puller == state.Puller)
|
||||
{
|
||||
// don't disconnect and reconnect a puller for no reason
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullerComponent?>(entity.Value, out var comp))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullerComponent?>(state.Puller.Value, out var comp))
|
||||
{
|
||||
Logger.Error($"Entity {state.Puller.Value} for pulling had no Puller component");
|
||||
// ensure it disconnects from any different puller, still
|
||||
@@ -90,7 +86,7 @@ namespace Content.Shared.Pulling.Components
|
||||
|
||||
protected override void OnRemove()
|
||||
{
|
||||
if (Puller != null)
|
||||
if (Puller != default)
|
||||
{
|
||||
// This is absolute paranoia but it's also absolutely necessary. Too many puller state bugs. - 20kdc
|
||||
Logger.ErrorS("c.go.c.pulling", "PULLING STATE CORRUPTION IMMINENT IN PULLABLE {0} - OnRemove called when Puller is set!", Owner);
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using Content.Shared.Pulling;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Log;
|
||||
using Component = Robust.Shared.GameObjects.Component;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Pulling.Components
|
||||
{
|
||||
@@ -15,12 +12,12 @@ namespace Content.Shared.Pulling.Components
|
||||
public override string Name => "Puller";
|
||||
|
||||
// Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed
|
||||
public float WalkSpeedModifier => Pulling == null ? 1.0f : 0.75f;
|
||||
public float WalkSpeedModifier => Pulling == default ? 1.0f : 0.75f;
|
||||
|
||||
public float SprintSpeedModifier => Pulling == null ? 1.0f : 0.75f;
|
||||
public float SprintSpeedModifier => Pulling == default ? 1.0f : 0.75f;
|
||||
|
||||
[ViewVariables]
|
||||
public EntityUid? Pulling { get; set; }
|
||||
public EntityUid Pulling { get; set; }
|
||||
|
||||
protected override void Shutdown()
|
||||
{
|
||||
@@ -30,7 +27,7 @@ namespace Content.Shared.Pulling.Components
|
||||
|
||||
protected override void OnRemove()
|
||||
{
|
||||
if (Pulling != null)
|
||||
if (Pulling != default)
|
||||
{
|
||||
// This is absolute paranoia but it's also absolutely necessary. Too many puller state bugs. - 20kdc
|
||||
Logger.ErrorS("c.go.c.pulling", "PULLING STATE CORRUPTION IMMINENT IN PULLER {0} - OnRemove called when Pulling is set!", Owner);
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace Content.Shared.Pulling.Systems
|
||||
|
||||
private void OnRelayMoveInput(EntityUid uid, SharedPullableComponent component, RelayMoveInputEvent args)
|
||||
{
|
||||
var entity = args.Session.AttachedEntityUid;
|
||||
if (entity == null || !_blocker.CanMove(entity.Value)) return;
|
||||
var entity = args.Session.AttachedEntity;
|
||||
if (!entity.IsValid() || !_blocker.CanMove(entity)) return;
|
||||
_pullSystem.TryStopPull(component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.EntitySystems;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using Content.Shared.Pulling.Components;
|
||||
@@ -31,11 +30,11 @@ namespace Content.Shared.Pulling.Systems
|
||||
if (component.Pulling == null)
|
||||
return;
|
||||
|
||||
if (component.Pulling == EntityManager.GetEntity(args.BlockingEntity))
|
||||
if (component.Pulling == args.BlockingEntity)
|
||||
{
|
||||
if (EntityManager.TryGetComponent<SharedPullableComponent>(args.BlockingEntity, out var comp))
|
||||
{
|
||||
_pullSystem.TryStopPull(comp, EntityManager.GetEntity(uid));
|
||||
_pullSystem.TryStopPull(comp, uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,19 +6,18 @@ using Content.Shared.GameTicking;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Pulling.Events;
|
||||
using Content.Shared.Rotatable;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.IoC;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Shared.Pulling
|
||||
{
|
||||
@@ -203,11 +202,10 @@ namespace Content.Shared.Pulling
|
||||
|
||||
private bool HandleMovePulledObject(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
|
||||
{
|
||||
if (session?.AttachedEntityUid == null)
|
||||
if (session?.AttachedEntity is not { } player ||
|
||||
!player.IsValid())
|
||||
return false;
|
||||
|
||||
var player = session.AttachedEntityUid.Value;
|
||||
|
||||
if (!TryGetPulled(player, out var pulled))
|
||||
{
|
||||
return false;
|
||||
@@ -233,7 +231,7 @@ namespace Content.Shared.Pulling
|
||||
return _pullers.Remove(puller);
|
||||
}
|
||||
|
||||
public EntityUid? GetPulled(EntityUid by)
|
||||
public EntityUid GetPulled(EntityUid by)
|
||||
{
|
||||
return _pullers.GetValueOrDefault(by);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -32,7 +31,8 @@ namespace Content.Shared.Shuttles.Components
|
||||
base.HandleComponentState(curState, nextState);
|
||||
if (curState is not PilotComponentState state) return;
|
||||
|
||||
if (state.Console == null)
|
||||
var console = state.Console.GetValueOrDefault();
|
||||
if (!console.IsValid())
|
||||
{
|
||||
Console = null;
|
||||
return;
|
||||
@@ -40,10 +40,9 @@ namespace Content.Shared.Shuttles.Components
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entityManager.TryGetEntity(state.Console.Value, out var consoleEnt) ||
|
||||
!entityManager.TryGetComponent(consoleEnt.Value, out SharedShuttleConsoleComponent? shuttleConsoleComponent))
|
||||
if (!entityManager.TryGetComponent(console, out SharedShuttleConsoleComponent? shuttleConsoleComponent))
|
||||
{
|
||||
Logger.Warning($"Unable to set Helmsman console to {state.Console.Value}");
|
||||
Logger.Warning($"Unable to set Helmsman console to {console}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
@@ -122,7 +121,7 @@ namespace Content.Shared.Slippery
|
||||
|
||||
foreach (var uid in component.Colliding.ToArray())
|
||||
{
|
||||
if (!uid.IsValid() || !EntityManager.TryGetEntity(uid, out var entity))
|
||||
if (!uid.IsValid())
|
||||
{
|
||||
component.Colliding.Remove(uid);
|
||||
component.Slipped.Remove(uid);
|
||||
@@ -130,7 +129,7 @@ namespace Content.Shared.Slippery
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetComponent(entity.Value, out PhysicsComponent? otherPhysics) ||
|
||||
if (!EntityManager.TryGetComponent(uid, out PhysicsComponent? otherPhysics) ||
|
||||
!body.GetWorldAABB().Intersects(otherPhysics.GetWorldAABB()))
|
||||
{
|
||||
component.Colliding.Remove(uid);
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Content.Shared.StatusEffect
|
||||
{
|
||||
// Fuck this shit I hate it
|
||||
var newComponent = (Component) _componentFactory.GetComponent(component);
|
||||
newComponent.Owner = EntityManager.GetEntity(uid);
|
||||
newComponent.Owner = uid;
|
||||
|
||||
EntityManager.AddComponent(uid, newComponent);
|
||||
status.ActiveEffects[key].RelevantComponent = component;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Physics;
|
||||
@@ -44,11 +43,13 @@ namespace Content.Shared.Throwing
|
||||
|
||||
private void OnHandleState(EntityUid uid, ThrownItemComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not ThrownItemComponentState state || state.Thrower == null)
|
||||
if (args.Current is not ThrownItemComponentState {Thrower: not null } state ||
|
||||
!state.Thrower.Value.IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(EntityManager.TryGetEntity(state.Thrower.Value, out var entity))
|
||||
component.Thrower = entity;
|
||||
component.Thrower = state.Thrower.Value;
|
||||
}
|
||||
|
||||
private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args)
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Content.Shared.Verbs
|
||||
// their sprite.
|
||||
if (@using != null && EntityManager.TryGetComponent<HandVirtualItemComponent?>(@using.Value, out var pull))
|
||||
{
|
||||
@using = EntityManager.GetEntity(pull.BlockingEntity);
|
||||
@using = pull.BlockingEntity
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,23 +113,22 @@ namespace Content.Shared.Verbs
|
||||
public void LogVerb(Verb verb, EntityUid userUid, EntityUid targetUid, bool forced)
|
||||
{
|
||||
// first get the held item. again.
|
||||
EntityUid? usedUid = null;
|
||||
if (EntityManager.TryGetComponent(userUid, out SharedHandsComponent? hands))
|
||||
EntityUid usedUid = default;
|
||||
if (EntityManager.TryGetComponent(userUid, out SharedHandsComponent? hands) &&
|
||||
hands.TryGetActiveHeldEntity(out var heldEntity))
|
||||
{
|
||||
hands.TryGetActiveHeldEntity(out var useEntityd);
|
||||
usedUid = useEntityd;
|
||||
usedUid = heldEntity;
|
||||
if (usedUid != null && EntityManager.TryGetComponent(usedUid.Value, out HandVirtualItemComponent? pull))
|
||||
usedUid = pull.BlockingEntity;
|
||||
}
|
||||
|
||||
// get all the entities
|
||||
if (!EntityManager.TryGetEntity(userUid, out var user) ||
|
||||
!EntityManager.TryGetEntity(targetUid, out var target))
|
||||
if (!userUid.IsValid() || !targetUid.IsValid())
|
||||
return;
|
||||
|
||||
EntityUid? used = null;
|
||||
if (usedUid != null)
|
||||
EntityManager.TryGetEntity(usedUid.Value, out used);
|
||||
EntityManager.EntityExists(usedUid.Value);
|
||||
|
||||
// then prepare the basic log message body
|
||||
var verbText = $"{verb.Category?.Text} {verb.Text}".Trim();
|
||||
@@ -138,7 +137,7 @@ namespace Content.Shared.Verbs
|
||||
: $"executed '{verbText}' verb targeting ";
|
||||
|
||||
// then log with entity information
|
||||
if (used != null)
|
||||
if (usedUidused != null)
|
||||
_logSystem.Add(LogType.Verb, verb.Impact,
|
||||
$"{user} {logText} {target} while holding {used}");
|
||||
else
|
||||
|
||||
@@ -41,8 +41,7 @@ namespace Content.Shared.Weapons.Melee
|
||||
ClickLocation = clickLocation;
|
||||
Target = target;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().TryGetEntity(Target, out var targetEntity);
|
||||
TargetEntity = targetEntity;
|
||||
TargetEntity = IoCManager.Resolve<IEntityManager>().EntityExists(Target) ? Target : default(EntityUid?);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user