+using Content.Shared.Ghost;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
-using Robust.Shared.Prototypes;
-using Content.Shared.Ghost;
using Robust.Client.Player;
+using Robust.Shared.Prototypes;
namespace Content.Client.Antag;
/// Used for assigning specified icons for antags.
/// </summary>
public abstract class AntagStatusIconSystem<T> : SharedStatusIconSystem
- where T : Component
+ where T : IComponent
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _player = default!;
/// <summary>
/// Helper method that retrieves all entity prototypes that have some component.
/// </summary>
- public static List<EntityPrototype> GetPrototypesWithComponent<T>(RobustIntegrationTest.IntegrationInstance instance) where T : Component
+ public static List<EntityPrototype> GetPrototypesWithComponent<T>(RobustIntegrationTest.IntegrationInstance instance) where T : IComponent
{
var protoMan = instance.ResolveDependency<IPrototypeManager>();
var compFact = instance.ResolveDependency<IComponentFactory>();
namespace Content.Server.GameTicking.Rules;
-public abstract partial class GameRuleSystem<T> : EntitySystem where T : Component
+public abstract partial class GameRuleSystem<T> : EntitySystem where T : IComponent
{
[Dependency] protected readonly IChatManager ChatManager = default!;
[Dependency] protected readonly GameTicker GameTicker = default!;
+using System.Diagnostics.CodeAnalysis;
+using System.Numerics;
using Content.Server.ParticleAccelerator.Components;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Events;
-using System.Diagnostics.CodeAnalysis;
-using System.Numerics;
namespace Content.Server.ParticleAccelerator.EntitySystems;
}
private bool ScanPart<T>(EntityUid uid, Vector2i coordinates, Angle? rotation, [NotNullWhen(true)] out EntityUid? part, [NotNullWhen(true)] out T? comp, MapGridComponent? grid = null)
- where T : Component
+ where T : IComponent
{
if (!Resolve(uid, ref grid))
{
part = null;
- comp = null;
+ comp = default;
return false;
}
using System.Diagnostics.CodeAnalysis;
-using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Chat.Systems;
/// <summary>
/// An abstract entity system inherited by all station events for their behavior.
/// </summary>
-public abstract partial class StationEventSystem<T> : GameRuleSystem<T> where T : Component
+public abstract partial class StationEventSystem<T> : GameRuleSystem<T> where T : IComponent
{
[Dependency] protected readonly IAdminLogManager AdminLogManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public List<(T Comp, OrganComponent Organ)> GetBodyOrganComponents<T>(
EntityUid uid,
BodyComponent? body = null)
- where T : Component
+ where T : IComponent
{
if (!Resolve(uid, ref body))
return new List<(T Comp, OrganComponent Organ)>();
EntityUid uid,
[NotNullWhen(true)] out List<(T Comp, OrganComponent Organ)>? comps,
BodyComponent? body = null)
- where T : Component
+ where T : IComponent
{
if (!Resolve(uid, ref body))
{
public List<(T Comp, OrganComponent Organ)> GetBodyPartOrganComponents<T>(
EntityUid uid,
BodyPartComponent? part = null)
- where T : Component
+ where T : IComponent
{
if (!Resolve(uid, ref part))
return new List<(T Comp, OrganComponent Organ)>();
EntityUid uid,
[NotNullWhen(true)] out List<(T Comp, OrganComponent Organ)>? comps,
BodyPartComponent? part = null)
- where T : Component
+ where T : IComponent
{
if (!Resolve(uid, ref part))
{
public IEnumerable<(EntityUid AdjacentId, T Component)> GetBodyPartAdjacentPartsComponents<T>(
EntityUid partId,
BodyPartComponent? part = null)
- where T : Component
+ where T : IComponent
{
if (!Resolve(partId, ref part, false))
yield break;
EntityUid partId,
[NotNullWhen(true)] out List<(EntityUid AdjacentId, T Component)>? comps,
BodyPartComponent? part = null)
- where T : Component
+ where T : IComponent
{
if (!Resolve(partId, ref part, false))
{
return true;
}
- public bool TryGetObjectiveComp<T>(EntityUid uid, [NotNullWhen(true)] out T? objective) where T : Component
+ public bool TryGetObjectiveComp<T>(EntityUid uid, [NotNullWhen(true)] out T? objective) where T : IComponent
{
if (TryGetMind(uid, out var mindId, out var mind) && TryGetObjectiveComp(mindId, out objective, mind))
{
return false;
}
- public bool TryGetObjectiveComp<T>(EntityUid mindId, [NotNullWhen(true)] out T? objective, MindComponent? mind = null) where T : Component
+ public bool TryGetObjectiveComp<T>(EntityUid mindId, [NotNullWhen(true)] out T? objective, MindComponent? mind = null) where T : IComponent
{
if (Resolve(mindId, ref mind))
{
/// Gets a role component from a player's mind.
/// </summary>
/// <returns>Whether a role was found</returns>
- public bool TryGetRole<T>(EntityUid user, [NotNullWhen(true)] out T? role) where T : Component
+ public bool TryGetRole<T>(EntityUid user, [NotNullWhen(true)] out T? role) where T : IComponent
{
- role = null;
+ role = default;
if (!TryComp<MindContainerComponent>(user, out var mindContainer) || mindContainer.Mind == null)
return false;
/// <exception cref="ArgumentException">
/// Thrown if we already have a role with this type.
/// </exception>
- public void MindAddRole<T>(EntityUid mindId, T component, MindComponent? mind = null, bool silent = false) where T : Component, new()
+ public void MindAddRole<T>(EntityUid mindId, T component, MindComponent? mind = null, bool silent = false) where T : IComponent, new()
{
if (!Resolve(mindId, ref mind))
return;
/// <exception cref="ArgumentException">
/// Thrown if we do not have this role.
/// </exception>
- public void MindRemoveRole<T>(EntityUid mindId) where T : Component
+ public void MindRemoveRole<T>(EntityUid mindId) where T : IComponent
{
if (!RemComp<T>(mindId))
{
$"'Role {typeof(T).Name}' removed from mind of {_minds.MindOwnerLoggingString(mind)}");
}
- public bool MindTryRemoveRole<T>(EntityUid mindId) where T : Component
+ public bool MindTryRemoveRole<T>(EntityUid mindId) where T : IComponent
{
if (!MindHasRole<T>(mindId))
return false;
return true;
}
- public bool MindHasRole<T>(EntityUid mindId) where T : Component
+ public bool MindHasRole<T>(EntityUid mindId) where T : IComponent
{
return HasComp<T>(mindId);
}
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Alert;
-using Content.Shared.Mobs;
-using Content.Shared.Mobs.Components;
-using Content.Shared.Mobs.Systems;
using Content.Shared.Rejuvenate;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
/// <typeparam name="T">The component type to add and remove from the entity.</typeparam>
public bool TryAddStatusEffect<T>(EntityUid uid, string key, TimeSpan time, bool refresh,
StatusEffectsComponent? status = null)
- where T : Component, new()
+ where T : IComponent, new()
{
if (!Resolve(uid, ref status, false))
return false;