mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Cleanup: Resolve/suppress many obsolete warnings, delete EntityPrototypeHelpers. (#46141)
* Resolve warnings, mostly obsolete
* resolve via the entitymanager directly, not wref
* Ent<T>, why not
* minimize test diff
* StorageTest: consistent print order
* ChameleonProj: use Disguised value consistently
* GasArrayTest: TryComp
* OrganPickingMarker: cache ILocalizationManager
avoids warning from Loc.TryGetString, and avoids multiple IoCManager hits
* FormattedMessage.FromMarkup to FromMarkupOrThrow
* rerun tests 🙏
This commit is contained in:
parent
a257d91f5f
commit
07f97fffa6
37 changed files with 125 additions and 162 deletions
|
|
@ -42,7 +42,7 @@ public sealed partial class AdminMessagePopupWindow : Control
|
|||
|
||||
public void SetState(AdminMessageEuiState state)
|
||||
{
|
||||
Timer = (float) state.Time.TotalSeconds;
|
||||
Timer = (float)state.Time.TotalSeconds;
|
||||
|
||||
MessageContainer.RemoveAllChildren();
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ public sealed partial class AdminMessagePopupWindow : Control
|
|||
}
|
||||
|
||||
Description.SetMessage(
|
||||
FormattedMessage.FromMarkup(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length))));
|
||||
FormattedMessage.FromMarkupOrThrow(Loc.GetString("admin-notes-message-desc", ("count", state.Messages.Length))));
|
||||
}
|
||||
|
||||
private void OnDismissButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using Content.Client.Clothing.Systems;
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Prototypes;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
|
@ -54,7 +52,8 @@ public sealed partial class ChameleonBoundUserInterface : BoundUserInterface
|
|||
newTargets.Add(target);
|
||||
}
|
||||
_menu?.UpdateState(newTargets, st.SelectedId);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
_menu?.UpdateState(targets, st.SelectedId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using System.Linq;
|
||||
using Content.Shared.Body;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
@ -14,9 +12,7 @@ namespace Content.Client.Humanoid;
|
|||
public sealed partial class OrganMarkingPicker : Control
|
||||
{
|
||||
[Dependency] private MarkingManager _marking = default!;
|
||||
[Dependency] private IEntityManager _entity = default!;
|
||||
|
||||
private readonly SpriteSystem _sprite;
|
||||
[Dependency] private ILocalizationManager _loc = default!;
|
||||
|
||||
private readonly MarkingsViewModel _markingsModel;
|
||||
private readonly HashSet<HumanoidVisualLayers> _layers;
|
||||
|
|
@ -33,8 +29,6 @@ public sealed partial class OrganMarkingPicker : Control
|
|||
_group = group;
|
||||
_organ = organ;
|
||||
|
||||
_sprite = _entity.System<SpriteSystem>();
|
||||
|
||||
UpdateMarkings();
|
||||
}
|
||||
|
||||
|
|
@ -79,10 +73,10 @@ public sealed partial class OrganMarkingPicker : Control
|
|||
|
||||
var control = new LayerMarkingPicker(_markingsModel, _organ, layer, allMarkings);
|
||||
LayerTabs.AddChild(control);
|
||||
if (Loc.TryGetString($"markings-layer-{layer}-{_group.Id}", out var layerTitle))
|
||||
if (_loc.TryGetString($"markings-layer-{layer}-{_group.Id}", out var layerTitle))
|
||||
LayerTabs.SetTabTitle(i, layerTitle);
|
||||
else
|
||||
LayerTabs.SetTabTitle(i, Loc.GetString($"markings-layer-{layer}"));
|
||||
LayerTabs.SetTabTitle(i, _loc.GetString($"markings-layer-{layer}"));
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public sealed class GasArrayTest : GameTest
|
|||
var gasTank = SProtoMan.Index(GasTankTestDummyId);
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(gasTank.TryGetComponent<GasTankComponent>(out var gasTankComponent, _compFactory));
|
||||
Assert.That(gasTank.TryComp<GasTankComponent>(out var gasTankComponent, _compFactory));
|
||||
|
||||
Assert.That(gasTankComponent!.Air.GetMoles(Gas.Oxygen), Is.EqualTo(10));
|
||||
Assert.That(gasTankComponent!.Air.GetMoles(Gas.Frezon), Is.EqualTo(20));
|
||||
|
|
@ -63,7 +63,7 @@ public sealed class GasArrayTest : GameTest
|
|||
var legacyGasTank = SProtoMan.Index(GasTankLegacyTestDummyId);
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(legacyGasTank.TryGetComponent<GasTankComponent>(out var gasTankComponent, _compFactory));
|
||||
Assert.That(legacyGasTank.TryComp<GasTankComponent>(out var gasTankComponent, _compFactory));
|
||||
|
||||
Assert.That(gasTankComponent!.Air.GetMoles(3), Is.EqualTo(10));
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using Content.Server.Cargo.Components;
|
|||
using Content.Server.Cargo.Systems;
|
||||
using Content.Shared.Cargo.Prototypes;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Tools.Components;
|
||||
|
|
@ -119,7 +118,7 @@ public sealed class CargoTest : GameTest
|
|||
);
|
||||
}
|
||||
|
||||
if (proto.HasComponent<StackComponent>(_sCompFact))
|
||||
if (proto.HasComp<StackComponent>(_sCompFact))
|
||||
{
|
||||
Assert.That(
|
||||
staticPriceComp.Price,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System.Linq;
|
|||
using Content.IntegrationTests.Fixtures;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Prototypes;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
@ -43,7 +42,7 @@ public sealed class FillLevelSpriteTest : GameTest
|
|||
{
|
||||
Assert.That(proto.TryComp<SolutionContainerVisualsComponent>(out var visuals, componentFactory));
|
||||
Assert.That(proto.TryComp<SpriteComponent>(out var sprite, componentFactory));
|
||||
if (!proto.HasComponent<AppearanceComponent>(componentFactory))
|
||||
if (!proto.HasComp<AppearanceComponent>(componentFactory))
|
||||
{
|
||||
Assert.Fail(@$"{proto.ID} has SolutionContainerVisualsComponent but no AppearanceComponent.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||
using Content.IntegrationTests.Fixtures;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
|
@ -35,13 +34,13 @@ public sealed class LatheTest : GameTest
|
|||
var latheProtos = protoMan.EnumeratePrototypes<EntityPrototype>()
|
||||
.Where(p => !p.Abstract)
|
||||
.Where(p => !pair.IsTestPrototype(p))
|
||||
.Where(p => p.HasComponent<LatheComponent>());
|
||||
.Where(p => p.HasComp<LatheComponent>(compFactory));
|
||||
|
||||
// Find every EntityPrototype that can be inserted into a MaterialStorage
|
||||
var materialEntityProtos = protoMan.EnumeratePrototypes<EntityPrototype>()
|
||||
.Where(p => !p.Abstract)
|
||||
.Where(p => !pair.IsTestPrototype(p))
|
||||
.Where(p => p.HasComponent<PhysicalCompositionComponent>());
|
||||
.Where(p => p.HasComp<PhysicalCompositionComponent>(compFactory));
|
||||
|
||||
// Spawn all of the above material EntityPrototypes - we need actual entities to do whitelist checks
|
||||
var materialEntities = new List<EntityUid>(materialEntityProtos.Count());
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Content.IntegrationTests.Fixtures;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Movement.Pulling.Components;
|
||||
using Content.Shared.Prototypes;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
|
@ -36,7 +35,7 @@ public sealed class PullerTest : GameTest
|
|||
if (!puller.NeedsHands)
|
||||
continue;
|
||||
|
||||
Assert.That(proto.HasComponent<HandsComponent>(compFactory), $"Found puller {proto} with NeedsHand pulling but has no hands?");
|
||||
Assert.That(proto.HasComp<HandsComponent>(compFactory), $"Found puller {proto} with NeedsHand pulling but has no hands?");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using Content.IntegrationTests.Fixtures.Attributes;
|
|||
using Content.Server.Item;
|
||||
using Content.Shared.Containers;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Storage.EntitySystems;
|
||||
|
|
@ -54,6 +53,7 @@ public sealed class StorageTest : GameTest
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Obsolete("StorageFillComponent is obsolete.")]
|
||||
public async Task TestStorageFillPrototypes()
|
||||
{
|
||||
var pair = Pair;
|
||||
|
|
@ -82,6 +82,7 @@ public sealed class StorageTest : GameTest
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Obsolete("StorageFillComponent is obsolete.")]
|
||||
public async Task TestSufficientSpaceForFill()
|
||||
{
|
||||
var pair = Pair;
|
||||
|
|
@ -101,7 +102,7 @@ public sealed class StorageTest : GameTest
|
|||
{
|
||||
foreach (var (proto, fill) in pair.GetPrototypesWithComponent<StorageFillComponent>())
|
||||
{
|
||||
if (proto.HasComponent<EntityStorageComponent>(compFact))
|
||||
if (proto.HasComp<EntityStorageComponent>(compFact))
|
||||
continue;
|
||||
|
||||
StorageComponent? storage = null;
|
||||
|
|
@ -168,6 +169,7 @@ public sealed class StorageTest : GameTest
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Obsolete("StorageFillComponent is obsolete.")]
|
||||
public async Task TestSufficientSpaceForEntityStorageFill()
|
||||
{
|
||||
var pair = Pair;
|
||||
|
|
@ -182,7 +184,7 @@ public sealed class StorageTest : GameTest
|
|||
|
||||
foreach (var (proto, fill) in pair.GetPrototypesWithComponent<StorageFillComponent>())
|
||||
{
|
||||
if (proto.HasComponent<StorageComponent>(compFact))
|
||||
if (proto.HasComp<StorageComponent>(compFact))
|
||||
continue;
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
|
|
@ -222,6 +224,7 @@ public sealed class StorageTest : GameTest
|
|||
return 0;
|
||||
}
|
||||
|
||||
[Obsolete("StorageFillComponent is obsolete.")]
|
||||
private int GetFillSize(StorageFillComponent fill, bool getCount, IPrototypeManager protoMan, IComponentFactory compFact, SharedItemSystem itemSystem)
|
||||
{
|
||||
var totalSize = 0;
|
||||
|
|
@ -250,15 +253,17 @@ public sealed class StorageTest : GameTest
|
|||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
foreach (var (proto, fill) in pair.GetPrototypesWithComponent<EntityTableContainerFillComponent>())
|
||||
#pragma warning disable CS0618 // StorageFillComponent is obsolete, but this test is still needed while it exists.
|
||||
foreach (var (proto, fill) in pair.GetPrototypesWithComponent<StorageFillComponent>())
|
||||
{
|
||||
Assert.That(!proto.HasComp<StorageFillComponent>(compFact), $"Prototype {proto.ID} has both {nameof(EntityTableContainerFillComponent)} and {nameof(StorageFillComponent)}.");
|
||||
Assert.That(!proto.HasComp<ContainerFillComponent>(compFact), $"Prototype {proto.ID} has both {nameof(EntityTableContainerFillComponent)} and {nameof(ContainerFillComponent)}.");
|
||||
Assert.That(!proto.HasComp<EntityTableContainerFillComponent>(compFact), $"Prototype {proto.ID} has both {nameof(StorageFillComponent)} and {nameof(EntityTableContainerFillComponent)}.");
|
||||
Assert.That(!proto.HasComp<ContainerFillComponent>(compFact), $"Prototype {proto.ID} has both {nameof(StorageFillComponent)} and {nameof(ContainerFillComponent)}.");
|
||||
}
|
||||
#pragma warning restore CS0618
|
||||
|
||||
foreach (var (proto, fill) in pair.GetPrototypesWithComponent<ContainerFillComponent>())
|
||||
{
|
||||
Assert.That(!proto.HasComp<StorageFillComponent>(compFact), $"Prototype {proto.ID} has both {nameof(ContainerFillComponent)} and {nameof(StorageFillComponent)}.");
|
||||
Assert.That(!proto.HasComp<EntityTableContainerFillComponent>(compFact), $"Prototype {proto.ID} has both {nameof(ContainerFillComponent)} and {nameof(EntityTableContainerFillComponent)}.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ using Content.Shared.Damage;
|
|||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.EntityTable;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Storage.EntitySystems;
|
||||
using Content.Shared.VendingMachines;
|
||||
using Content.Shared.VendingMachines.Components;
|
||||
|
|
@ -130,7 +129,7 @@ namespace Content.IntegrationTests.Tests
|
|||
{
|
||||
if (proto.Abstract
|
||||
|| pair.IsTestPrototype(proto)
|
||||
|| !proto.HasComponent<VendingMachineRestockComponent>())
|
||||
|| !proto.HasComp<VendingMachineRestockComponent>(compFact))
|
||||
continue;
|
||||
|
||||
restockEntities.Add(proto.ID);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using Content.Server.Administration;
|
|||
using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Prototypes;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
|
|
@ -38,7 +37,7 @@ public sealed partial class AddActionCommand : LocalizedEntityCommands
|
|||
}
|
||||
|
||||
if (!_prototypeManager.TryIndex<EntityPrototype>(args[1], out var proto) ||
|
||||
!proto.HasComponent<ActionComponent>())
|
||||
!proto.HasComp<ActionComponent>(EntityManager.ComponentFactory))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-addaction-action-not-found", ("action", args[1])));
|
||||
return;
|
||||
|
|
@ -63,7 +62,7 @@ public sealed partial class AddActionCommand : LocalizedEntityCommands
|
|||
return CompletionResult.Empty;
|
||||
|
||||
var actionPrototypes = _prototypeManager.EnumeratePrototypes<EntityPrototype>()
|
||||
.Where(p => p.HasComponent<ActionComponent>())
|
||||
.Where(p => p.HasComp<ActionComponent>(EntityManager.ComponentFactory))
|
||||
.Select(p => p.ID)
|
||||
.Order();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ public sealed class EntityCoordinatesConverter : AdminLogConverter<EntityCoordin
|
|||
WriteEntityInfo(writer, value.EntityId, entities, "parent");
|
||||
writer.WriteNumber("x", value.X);
|
||||
writer.WriteNumber("y", value.Y);
|
||||
var mapUid = value.GetMapUid(entities);
|
||||
EntityUid? mapUid = null;
|
||||
if (_entityManager.TryGetTarget(out var entMan))
|
||||
mapUid = entMan.GetComponent<TransformComponent>(value.EntityId).MapUid;
|
||||
|
||||
if (mapUid.HasValue)
|
||||
{
|
||||
WriteEntityInfo(writer, mapUid.Value, entities, "map");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ using Content.Shared.Database;
|
|||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.GameTicking.Components;
|
||||
using Content.Shared.GameTicking.Prototypes;
|
||||
using Content.Shared.Prototypes;
|
||||
using Robust.Server.ServerStatus;
|
||||
using Robust.Shared.Asynchronous;
|
||||
using Robust.Shared.Configuration;
|
||||
|
|
@ -516,7 +515,7 @@ public sealed partial class ServerApi : IPostInjectInit
|
|||
if (gameRule.Abstract)
|
||||
continue;
|
||||
|
||||
if (gameRule.HasComponent<GameRuleComponent>(_componentFactory))
|
||||
if (gameRule.HasComp<GameRuleComponent>(_componentFactory))
|
||||
gameRules.Add(gameRule.ID);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using Content.Server.Stack;
|
|||
using Content.Shared.Construction;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
@ -24,7 +23,10 @@ public sealed partial class GivePrototype : IGraphAction
|
|||
if (string.IsNullOrEmpty(Prototype))
|
||||
return;
|
||||
|
||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(Prototype))
|
||||
// TODO: pass PrototypeManager into IGraphAction
|
||||
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
if (protoMan.TryIndex(Prototype, out var entProto) && entProto.HasComp<StackComponent>(entityManager.ComponentFactory))
|
||||
{
|
||||
var stackSystem = entityManager.EntitySysManager.GetEntitySystem<StackSystem>();
|
||||
var stacks = stackSystem.SpawnMultipleNextToOrDrop(Prototype, Amount, userUid ?? uid);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Content.Server.Stack;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
@ -24,7 +23,10 @@ namespace Content.Server.Construction.Completions
|
|||
|
||||
var coordinates = entityManager.GetComponent<TransformComponent>(uid).Coordinates;
|
||||
|
||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(Prototype))
|
||||
// TODO: pass the PrototypeManager into IGraphAction.
|
||||
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
if (protoMan.TryIndex(Prototype, out EntityPrototype? proto) && proto.HasComp<StackComponent>(entityManager.ComponentFactory))
|
||||
{
|
||||
var stackEnt = entityManager.SpawnEntity(Prototype, coordinates);
|
||||
var stack = entityManager.GetComponent<StackComponent>(stackEnt);
|
||||
|
|
|
|||
|
|
@ -23,23 +23,24 @@ public sealed partial class DecalSystem : SharedDecalSystem
|
|||
|
||||
[Dependency] private EntityQuery<MapGridComponent> _gridQuery;
|
||||
|
||||
private static readonly Vector2 _boundsMinExpansion = new(0.01f, 0.01f);
|
||||
private static readonly Vector2 _boundsMaxExpansion = new(1.01f, 1.01f);
|
||||
private static readonly Vector2 BoundsMinExpansion = new(0.01f, 0.01f);
|
||||
private static readonly Vector2 BoundsMaxExpansion = new(1.01f, 1.01f);
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<TileChangedEvent>(OnTileChanged);
|
||||
SubscribeLocalEvent<DecalGridComponent, ComponentStartup>(OnLegacyDecalGridStartup);
|
||||
SubscribeLocalEvent<BeforeSerializationEvent>(OnBeforeSerialization);
|
||||
SubscribeLocalEvent<PostGridSplitEvent>(OnGridSplit);
|
||||
}
|
||||
|
||||
private void OnLegacyDecalGridStartup(EntityUid uid, DecalGridComponent component, ComponentStartup args)
|
||||
[SubscribeLocalEvent]
|
||||
[Obsolete("Uses obsolete DecalGridComponent.")]
|
||||
private void OnLegacyDecalGridStartup(Entity<DecalGridComponent> ent, ref ComponentStartup args)
|
||||
{
|
||||
MigrateLegacyDecalGrid(uid, component);
|
||||
RemCompDeferred(uid, component);
|
||||
MigrateLegacyDecalGrid(ent);
|
||||
RemCompDeferred(ent, ent.Comp);
|
||||
}
|
||||
|
||||
private void OnBeforeSerialization(BeforeSerializationEvent ev)
|
||||
|
|
@ -55,12 +56,14 @@ public sealed partial class DecalSystem : SharedDecalSystem
|
|||
|
||||
foreach (var uid in ev.Entities)
|
||||
{
|
||||
#pragma warning disable CS0618 // DecalGridComponent compatibility behaviour.
|
||||
if (!TryComp<DecalGridComponent>(uid, out var component))
|
||||
continue;
|
||||
|
||||
MigrateLegacyDecalGrid(uid, component);
|
||||
MigrateLegacyDecalGrid((uid, component));
|
||||
RemComp(uid, component);
|
||||
migrated.Add(uid);
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
foreach (var uid in migrated)
|
||||
|
|
@ -72,14 +75,15 @@ public sealed partial class DecalSystem : SharedDecalSystem
|
|||
}
|
||||
}
|
||||
|
||||
private void MigrateLegacyDecalGrid(EntityUid uid, DecalGridComponent component)
|
||||
[Obsolete("Uses obsolete DecalGridComponent.")]
|
||||
private void MigrateLegacyDecalGrid(Entity<DecalGridComponent> ent)
|
||||
{
|
||||
// Old maps store grid-wide decal chunks; convert them into chunk entities and remove the legacy component.
|
||||
foreach (var chunk in component.ChunkCollection.ChunkCollection.Values)
|
||||
foreach (var chunk in ent.Comp.ChunkCollection.ChunkCollection.Values)
|
||||
{
|
||||
foreach (var (id, decal) in chunk.Decals)
|
||||
{
|
||||
AddDecalWithId(uid, id, decal);
|
||||
AddDecalWithId(ent, id, decal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +99,7 @@ public sealed partial class DecalSystem : SharedDecalSystem
|
|||
foreach (var tile in _mapSystem.GetAllTiles(ev.Grid, grid))
|
||||
{
|
||||
var tilePos = (Vector2)tile.GridIndices;
|
||||
var bounds = new Box2(tilePos - _boundsMinExpansion, tilePos + _boundsMaxExpansion);
|
||||
var bounds = new Box2(tilePos - BoundsMinExpansion, tilePos + BoundsMaxExpansion);
|
||||
|
||||
foreach (var (id, decal) in GetDecalsIntersecting(ev.OldGrid, bounds))
|
||||
{
|
||||
|
|
@ -123,7 +127,7 @@ public sealed partial class DecalSystem : SharedDecalSystem
|
|||
if (!_turf.IsSpace(change.NewTile))
|
||||
continue;
|
||||
|
||||
var tilePos = (Vector2) change.GridIndices;
|
||||
var tilePos = (Vector2)change.GridIndices;
|
||||
var bounds = new Box2(tilePos, tilePos + Vector2.One);
|
||||
|
||||
foreach (var (id, _) in GetDecalsIntersecting(args.Entity, bounds))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System.Numerics;
|
||||
using Content.Shared.Destructible.Thresholds;
|
||||
using Content.Shared.Forensics.Components;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
@ -52,7 +51,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||
if (count == 0)
|
||||
continue;
|
||||
|
||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.EntityManager.ComponentFactory))
|
||||
if (system.PrototypeManager.TryIndex(entityId, out var prototype) && prototype.HasComp<StackComponent>(system.EntityManager.ComponentFactory))
|
||||
{
|
||||
var spawned = SpawnInContainer
|
||||
? system.EntityManager.SpawnNextToOrDrop(entityId, owner)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using Content.Server.Administration;
|
|||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives.Components;
|
||||
using Content.Shared.Prototypes;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
@ -41,7 +40,7 @@ public sealed partial class AddObjectiveCommand : LocalizedEntityCommands
|
|||
}
|
||||
|
||||
if (!_prototypes.TryIndex<EntityPrototype>(args[1], out var proto) ||
|
||||
!proto.HasComponent<ObjectiveComponent>())
|
||||
!proto.HasComp<ObjectiveComponent>(EntityManager.ComponentFactory))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-addobjective-objective-not-found", ("obj", args[1])));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using Content.Server.GameTicking;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
using Content.Shared.GameTicking.Components;
|
||||
|
|
@ -14,7 +13,6 @@ using System.Text;
|
|||
using Content.Server.Objectives.Commands;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Roles.Jobs;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
|
|
@ -214,7 +212,7 @@ public sealed partial class ObjectivesSystem : SharedObjectivesSystem
|
|||
}
|
||||
}
|
||||
|
||||
var successRate = totalObjectives > 0 ? (float) completedObjectives / totalObjectives : 0f;
|
||||
var successRate = totalObjectives > 0 ? (float)completedObjectives / totalObjectives : 0f;
|
||||
agentSummaries.Add((agentSummary.ToString(), successRate, completedObjectives));
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +322,7 @@ public sealed partial class ObjectivesSystem : SharedObjectivesSystem
|
|||
private void CreateCompletions()
|
||||
{
|
||||
_objectives = ProtoMan.EnumeratePrototypes<EntityPrototype>()
|
||||
.Where(p => p.HasComponent<ObjectiveComponent>())
|
||||
.Where(p => p.HasComp<ObjectiveComponent>(EntityManager.ComponentFactory))
|
||||
.Select(p => p.ID)
|
||||
.Order();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System.Linq;
|
||||
using Content.Server.Spawners.Components;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
@ -11,25 +10,27 @@ namespace Content.Server.Storage.EntitySystems;
|
|||
|
||||
public sealed partial class StorageSystem
|
||||
{
|
||||
private void OnStorageFillMapInit(EntityUid uid, StorageFillComponent component, MapInitEvent args)
|
||||
[Obsolete("StorageFillComponent is obsolete.")]
|
||||
private void OnStorageFillMapInit(Entity<StorageFillComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
if (component.Contents.Count == 0)
|
||||
if (ent.Comp.Contents.Count == 0)
|
||||
return;
|
||||
|
||||
if (TryComp<StorageComponent>(uid, out var storageComp))
|
||||
if (TryComp<StorageComponent>(ent, out var storageComp))
|
||||
{
|
||||
FillStorage((uid, component, storageComp));
|
||||
FillStorage((ent, ent.Comp, storageComp));
|
||||
}
|
||||
else if (TryComp<EntityStorageComponent>(uid, out var entityStorageComp))
|
||||
else if (TryComp<EntityStorageComponent>(ent, out var entityStorageComp))
|
||||
{
|
||||
FillEntityStorage((uid, component, entityStorageComp));
|
||||
FillEntityStorage((ent, ent.Comp, entityStorageComp));
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"StorageFillComponent couldn't find any StorageComponent ({uid})");
|
||||
Log.Error($"StorageFillComponent couldn't find any StorageComponent ({ent})");
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("StorageFillComponent is obsolete.")]
|
||||
private void FillStorage(Entity<StorageFillComponent?, StorageComponent?> entity)
|
||||
{
|
||||
var (uid, component, storage) = entity;
|
||||
|
|
@ -48,7 +49,7 @@ public sealed partial class StorageSystem
|
|||
|
||||
// No, you are not allowed to fill a container with entity spawners.
|
||||
DebugTools.Assert(!ProtoMan.Index<EntityPrototype>(spawnPrototype)
|
||||
.HasComponent(typeof(RandomSpawnerComponent)));
|
||||
.HasComp<RandomSpawnerComponent>(Factory));
|
||||
|
||||
if (!TryComp<ItemComponent>(ent, out var itemComp))
|
||||
{
|
||||
|
|
@ -85,6 +86,7 @@ public sealed partial class StorageSystem
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete("StorageFillComponent is obsolete.")]
|
||||
private void FillEntityStorage(Entity<StorageFillComponent?, EntityStorageComponent?> entity)
|
||||
{
|
||||
var (uid, component, entityStorageComp) = entity;
|
||||
|
|
@ -99,7 +101,7 @@ public sealed partial class StorageSystem
|
|||
{
|
||||
// No, you are not allowed to fill a container with entity spawners.
|
||||
DebugTools.Assert(!ProtoMan.Index<EntityPrototype>(item)
|
||||
.HasComponent(typeof(RandomSpawnerComponent)));
|
||||
.HasComp<RandomSpawnerComponent>(Factory));
|
||||
var ent = Spawn(item, coordinates);
|
||||
|
||||
// handle depending on storage component, again this should be unified after ECS
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using Content.Shared.Hands.EntitySystems;
|
|||
using Content.Shared.Roles;
|
||||
using Content.Shared.Traits;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Traits;
|
||||
|
||||
|
|
@ -44,8 +43,10 @@ public sealed partial class TraitSystem : EntitySystem
|
|||
continue;
|
||||
|
||||
// Add all components required by the prototype
|
||||
#pragma warning disable CS0618 // Enabling compatibility behaviour for TraitPrototype.Components
|
||||
if (traitPrototype.Components.Count > 0)
|
||||
EntityManager.AddComponents(args.Mob, traitPrototype.Components, false);
|
||||
#pragma warning restore CS0618
|
||||
|
||||
// Add all JobSpecials required by the prototype
|
||||
foreach (var special in traitPrototype.Specials)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Weather;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
|
|
@ -73,7 +72,7 @@ public sealed partial class WeatherAddCommand : LocalizedEntityCommands
|
|||
var opts = new List<CompletionOption>();
|
||||
foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
|
||||
{
|
||||
if (!proto.HasComponent<WeatherStatusEffectComponent>(_compFactory))
|
||||
if (!proto.HasComp<WeatherStatusEffectComponent>(_compFactory))
|
||||
continue;
|
||||
|
||||
opts.Add(new CompletionOption(proto.ID, proto.Name));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Weather;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
|
|
@ -69,7 +68,7 @@ public sealed partial class WeatherRemoveCommand : LocalizedEntityCommands
|
|||
var opts = new List<CompletionOption>();
|
||||
foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
|
||||
{
|
||||
if (!proto.HasComponent<WeatherStatusEffectComponent>(_compFactory))
|
||||
if (!proto.HasComp<WeatherStatusEffectComponent>(_compFactory))
|
||||
continue;
|
||||
|
||||
opts.Add(new CompletionOption(proto.ID, proto.Name));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Weather;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
|
|
@ -75,7 +74,7 @@ public sealed partial class WeatherSetCommand : LocalizedEntityCommands
|
|||
var opts = new List<CompletionOption>();
|
||||
foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
|
||||
{
|
||||
if (!proto.HasComponent<WeatherStatusEffectComponent>(_compFactory))
|
||||
if (!proto.HasComp<WeatherStatusEffectComponent>(_compFactory))
|
||||
continue;
|
||||
|
||||
opts.Add(new CompletionOption(proto.ID, proto.Name));
|
||||
|
|
|
|||
|
|
@ -590,13 +590,15 @@ public abstract partial class SharedActionsSystem : EntitySystem
|
|||
ev.Action = action;
|
||||
|
||||
// TODO: This is where we'd add support for event lists
|
||||
if (!action.Comp.RaiseOnUser && action.Comp.Container is {} container && !_mindQuery.HasComp(container))
|
||||
if (!action.Comp.RaiseOnUser && action.Comp.Container is { } container && !_mindQuery.HasComp(container))
|
||||
target = container;
|
||||
|
||||
#pragma warning disable CS0618 // Enabling RaiseOnAction compatibility behaviour.
|
||||
if (action.Comp.RaiseOnAction)
|
||||
target = action;
|
||||
#pragma warning restore CS0618
|
||||
|
||||
RaiseLocalEvent(target, (object) ev, broadcast: true);
|
||||
RaiseLocalEvent(target, (object)ev, broadcast: true);
|
||||
handled = ev.Handled;
|
||||
|
||||
if (!handled)
|
||||
|
|
|
|||
|
|
@ -12,11 +12,8 @@ namespace Content.Shared.Chemistry.EntitySystems;
|
|||
/// </summary>
|
||||
public abstract partial class SharedSolutionContainerSystem
|
||||
{
|
||||
public void InitializeContainerManager()
|
||||
{
|
||||
SubscribeLocalEvent<SolutionContainerManagerComponent, MapInitEvent>(OnSolutionContainerInit);
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
[Obsolete("Uses obsolete SolutionContainerManagerComponent.")]
|
||||
private void OnSolutionContainerInit(Entity<SolutionContainerManagerComponent> container, ref MapInitEvent args)
|
||||
{
|
||||
// Create the manager, this should also create a container, so we ensure it exists.
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
|||
base.Initialize();
|
||||
|
||||
InitializeRelays();
|
||||
InitializeContainerManager();
|
||||
|
||||
SubscribeLocalEvent<SolutionComponent, ComponentGetState>(OnSolutionGetState);
|
||||
SubscribeLocalEvent<SolutionComponent, ComponentHandleState>(OnSolutionHandleState);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using Content.Shared.Destructible;
|
|||
using Content.Shared.Glue;
|
||||
using Content.Shared.Lube;
|
||||
using Content.Shared.Nutrition;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.Slippery;
|
||||
using Content.Shared.StatusEffect;
|
||||
|
|
@ -21,7 +20,6 @@ public abstract partial class SharedGodmodeSystem : EntitySystem
|
|||
|
||||
SubscribeLocalEvent<GodmodeComponent, BeforeDamageChangedEvent>(OnBeforeDamageChanged);
|
||||
SubscribeLocalEvent<GodmodeComponent, BeforeStatusEffectAddedEvent>(OnBeforeStatusEffect);
|
||||
SubscribeLocalEvent<GodmodeComponent, BeforeOldStatusEffectAddedEvent>(OnBeforeOldStatusEffect);
|
||||
SubscribeLocalEvent<GodmodeComponent, BeforeStaminaDamageEvent>(OnBeforeStaminaDamage);
|
||||
SubscribeLocalEvent<GodmodeComponent, IngestibleEvent>(BeforeEdible);
|
||||
SubscribeLocalEvent<GodmodeComponent, SlipAttemptEvent>(OnSlipAttempt);
|
||||
|
|
@ -44,6 +42,8 @@ public abstract partial class SharedGodmodeSystem : EntitySystem
|
|||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
[SubscribeLocalEvent]
|
||||
[Obsolete("BeforeOldStatusEffectAddedEvent is obsolete.")]
|
||||
private void OnBeforeOldStatusEffect(Entity<GodmodeComponent> ent, ref BeforeOldStatusEffectAddedEvent args)
|
||||
{
|
||||
// Old status effect system doesn't distinguish between good and bad status effects
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
using Robust.Shared.Serialization.Markdown;
|
||||
|
|
@ -12,7 +10,10 @@ using Robust.Shared.Serialization.Markdown.Validation;
|
|||
using Robust.Shared.Serialization.Markdown.Value;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Interfaces;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
#pragma warning disable CS0618 // Obsolete: enabling compatibility features.
|
||||
using static Content.Shared.Decals.DecalGridComponent;
|
||||
#pragma warning restore CS0618
|
||||
|
||||
namespace Content.Shared.Decals
|
||||
{
|
||||
|
|
@ -28,7 +29,7 @@ namespace Content.Shared.Decals
|
|||
IDependencyCollection dependencies, ISerializationContext? context = null)
|
||||
{
|
||||
node.TryGetValue("version", out var versionNode);
|
||||
var version = ((ValueDataNode?) versionNode)?.AsInt() ?? VersionUnspecified;
|
||||
var version = ((ValueDataNode?)versionNode)?.AsInt() ?? VersionUnspecified;
|
||||
|
||||
return version switch
|
||||
{
|
||||
|
|
@ -45,7 +46,7 @@ namespace Content.Shared.Decals
|
|||
ISerializationManager.InstantiationDelegate<DecalGridChunkCollection>? _ = default)
|
||||
{
|
||||
node.TryGetValue("version", out var versionNode);
|
||||
var version = ((ValueDataNode?) versionNode)?.AsInt() ?? VersionUnspecified;
|
||||
var version = ((ValueDataNode?)versionNode)?.AsInt() ?? VersionUnspecified;
|
||||
|
||||
return version switch
|
||||
{
|
||||
|
|
@ -81,7 +82,7 @@ namespace Content.Shared.Decals
|
|||
chunk.Decals[index.Id] = decal;
|
||||
|
||||
if (uid <= DecalChunkComponent.MaxServerDecalId)
|
||||
nextIndex = Math.Max(nextIndex, (ushort) (uid + 1));
|
||||
nextIndex = Math.Max(nextIndex, (ushort)(uid + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -220,20 +221,20 @@ namespace Content.Shared.Decals
|
|||
{
|
||||
var used = usedIds.GetOrNew(chunk);
|
||||
|
||||
if (id <= DecalChunkComponent.MaxServerDecalId && used.Add((ushort) id))
|
||||
if (id <= DecalChunkComponent.MaxServerDecalId && used.Add((ushort)id))
|
||||
{
|
||||
nextIndex = Math.Max(nextIndex, (ushort) (id + 1));
|
||||
return new DecalIndex(chunk, (ushort) id);
|
||||
nextIndex = Math.Max(nextIndex, (ushort)(id + 1));
|
||||
return new DecalIndex(chunk, (ushort)id);
|
||||
}
|
||||
|
||||
for (var i = 0; i <= DecalChunkComponent.MaxServerDecalId; i++)
|
||||
{
|
||||
var remapped = (ushort) i;
|
||||
var remapped = (ushort)i;
|
||||
|
||||
if (!used.Add(remapped))
|
||||
continue;
|
||||
|
||||
nextIndex = Math.Max(nextIndex, (ushort) (remapped + 1));
|
||||
nextIndex = Math.Max(nextIndex, (ushort)(remapped + 1));
|
||||
return new DecalIndex(chunk, remapped);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ using Robust.Shared.Serialization;
|
|||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
#pragma warning disable CS0618 // This IS the obsolete component, this warning is redundant.
|
||||
using static Content.Shared.Decals.DecalGridComponent;
|
||||
#pragma warning restore CS0618
|
||||
|
||||
namespace Content.Shared.Decals
|
||||
{
|
||||
|
|
@ -18,7 +21,7 @@ namespace Content.Shared.Decals
|
|||
{
|
||||
[Access(Other = AccessPermissions.ReadExecute)]
|
||||
[DataField(serverOnly: true)]
|
||||
public DecalGridChunkCollection ChunkCollection = new(new ());
|
||||
public DecalGridChunkCollection ChunkCollection = new(new());
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary mapping decals to their corresponding grid chunks.
|
||||
|
|
@ -34,7 +37,7 @@ namespace Content.Shared.Decals
|
|||
[Serializable, NetSerializable]
|
||||
public sealed partial class DecalChunk
|
||||
{
|
||||
[IncludeDataField(customTypeSerializer:typeof(DictionarySerializer<ushort, Decal>))]
|
||||
[IncludeDataField(customTypeSerializer: typeof(DictionarySerializer<ushort, Decal>))]
|
||||
public Dictionary<ushort, Decal> Decals;
|
||||
|
||||
[NonSerialized]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ namespace Content.Shared.Decals
|
|||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DecalGridComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<DecalChunkComponent, ComponentStartup>(OnChunkStartup);
|
||||
SubscribeAllEvent<RequestDecalPlacementEvent>(OnDecalPlacementRequest);
|
||||
SubscribeAllEvent<RequestDecalRemovalEvent>(OnDecalRemovalRequest);
|
||||
|
|
@ -35,26 +34,28 @@ namespace Content.Shared.Decals
|
|||
RebuildFreeDecalIds(ent.Comp);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, DecalGridComponent component, ref ComponentGetState args)
|
||||
[SubscribeLocalEvent]
|
||||
[Obsolete("Uses obsolete DecalGridComponent.")]
|
||||
private void OnGetState(Entity<DecalGridComponent> ent, ref ComponentGetState args)
|
||||
{
|
||||
if (PvsEnabled && !args.ReplayState)
|
||||
return;
|
||||
|
||||
// Should this be a full component state or a delta-state?
|
||||
if (args.FromTick <= component.CreationTick || args.FromTick <= component.ForceTick)
|
||||
if (args.FromTick <= ent.Comp.CreationTick || args.FromTick <= ent.Comp.ForceTick)
|
||||
{
|
||||
args.State = new DecalGridState(component.ChunkCollection.ChunkCollection);
|
||||
args.State = new DecalGridState(ent.Comp.ChunkCollection.ChunkCollection);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = new Dictionary<Vector2i, DecalGridComponent.DecalChunk>();
|
||||
foreach (var (index, chunk) in component.ChunkCollection.ChunkCollection)
|
||||
foreach (var (index, chunk) in ent.Comp.ChunkCollection.ChunkCollection)
|
||||
{
|
||||
if (chunk.LastModified >= args.FromTick)
|
||||
data[index] = chunk;
|
||||
}
|
||||
|
||||
args.State = new DecalGridDeltaState(data, new(component.ChunkCollection.ChunkCollection.Keys));
|
||||
args.State = new DecalGridDeltaState(data, new(ent.Comp.ChunkCollection.ChunkCollection.Keys));
|
||||
}
|
||||
|
||||
public HashSet<(DecalIndex Index, Decal Decal)> GetDecalsInRange(EntityUid gridId, Vector2 position, float distance = 0.75f, Func<Decal, bool>? validDelegate = null)
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public sealed partial class SharedKitchenSpikeSystem : EntitySystem
|
|||
|
||||
if (butcherable.SpawnedEntities.Count == 0)
|
||||
{
|
||||
_popupSystem.PopupClient(Loc.GetString("comp-kitchen-spike-butcher-empty", ("victim", Identity.Entity(victim.Value, EntityManager))), ent, args.User, PopupType.MediumCaution);
|
||||
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-butcher-empty", ("victim", Identity.Entity(victim.Value, EntityManager))), ent, args.User, PopupType.MediumCaution);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public abstract partial class SharedChameleonProjectorSystem : EntitySystem
|
|||
|
||||
private void OnInteract(Entity<ChameleonProjectorComponent> ent, ref AfterInteractEvent args)
|
||||
{
|
||||
if (args.Handled || !args.CanReach || args.Target is not {} target)
|
||||
if (args.Handled || !args.CanReach || args.Target is not { } target)
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
|
|
@ -169,18 +169,18 @@ public abstract partial class SharedChameleonProjectorSystem : EntitySystem
|
|||
|
||||
private void OnToggleNoRot(Entity<ChameleonProjectorComponent> ent, ref DisguiseToggleNoRotEvent args)
|
||||
{
|
||||
if (ent.Comp.Disguised is not {} uid)
|
||||
if (ent.Comp.Disguised is not { } uid)
|
||||
return;
|
||||
|
||||
var xform = Transform(uid);
|
||||
_xform.SetLocalRotationNoLerp(uid, 0, xform);
|
||||
xform.NoLocalRotation = !xform.NoLocalRotation;
|
||||
_xform.SetNoLocalRotation(uid, !xform.NoLocalRotation, xform);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnToggleAnchored(Entity<ChameleonProjectorComponent> ent, ref DisguiseToggleAnchoredEvent args)
|
||||
{
|
||||
if (ent.Comp.Disguised is not {} uid)
|
||||
if (ent.Comp.Disguised is not { } uid)
|
||||
return;
|
||||
|
||||
var xform = Transform(uid);
|
||||
|
|
@ -294,12 +294,12 @@ public abstract partial class SharedChameleonProjectorSystem : EntitySystem
|
|||
if (!Resolve(disguised, ref disguised.Comp, false))
|
||||
return;
|
||||
|
||||
if (ent.Comp.Disguised == null)
|
||||
if (ent.Comp.Disguised is not { } user)
|
||||
return;
|
||||
|
||||
var xform = Transform(ent.Comp.Disguised.Value);
|
||||
xform.NoLocalRotation = false;
|
||||
_xform.Unanchor(disguised, xform);
|
||||
var xform = Transform(user);
|
||||
_xform.SetNoLocalRotation(user, false, xform);
|
||||
_xform.Unanchor(user, xform);
|
||||
|
||||
ent.Comp.Disguised = null;
|
||||
Del(disguised.Comp.Disguise);
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Prototypes
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[Obsolete("More efficient methods exist in EntityPrototype.HasComp and EntitySystem's proxy methods")]
|
||||
public static class EntityPrototypeHelpers
|
||||
{
|
||||
[Obsolete("More efficient methods exist in EntityPrototype.HasComp and EntitySystem's proxy methods")]
|
||||
public static bool HasComponent<T>(this EntityPrototype prototype, IComponentFactory? componentFactory = null) where T : IComponent
|
||||
{
|
||||
return prototype.HasComponent(typeof(T), componentFactory);
|
||||
}
|
||||
|
||||
[Obsolete("More efficient methods exist in EntityPrototype.HasComp and EntitySystem's proxy methods")]
|
||||
public static bool HasComponent(this EntityPrototype prototype, Type component, IComponentFactory? componentFactory = null)
|
||||
{
|
||||
componentFactory ??= IoCManager.Resolve<IComponentFactory>();
|
||||
|
||||
var registration = componentFactory.GetRegistration(component);
|
||||
|
||||
return prototype.Components.ContainsKey(registration.Name);
|
||||
}
|
||||
|
||||
[Obsolete("More efficient methods exist in EntityPrototype.HasComp and EntitySystem's proxy methods")]
|
||||
public static bool HasComponent<T>(string prototype, IPrototypeManager? prototypeManager = null, IComponentFactory? componentFactory = null) where T : IComponent
|
||||
{
|
||||
return HasComponent(prototype, typeof(T), prototypeManager, componentFactory);
|
||||
}
|
||||
|
||||
[Obsolete("More efficient methods exist in EntityPrototype.HasComp and EntitySystem's proxy methods")]
|
||||
public static bool HasComponent(string prototype, Type component, IPrototypeManager? prototypeManager = null, IComponentFactory? componentFactory = null)
|
||||
{
|
||||
prototypeManager ??= IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
return prototypeManager.TryIndex(prototype, out EntityPrototype? proto) && proto.HasComponent(component, componentFactory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ public abstract partial class SharedStackSystem : EntitySystem
|
|||
base.Initialize();
|
||||
|
||||
_vvm.GetTypeHandler<StackComponent>()
|
||||
.AddPath(nameof(StackComponent.Count), (_, comp) => comp.Count, SetCount);
|
||||
.AddPath(nameof(StackComponent.Count), (_, comp) => comp.Count, (uid, value, comp) => SetCount((uid, comp), value));
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Content.Shared.StatusEffect
|
|||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
[Access(typeof(StatusEffectsSystem))]
|
||||
[Obsolete("Use StatusEffectContainerComponent and Content.Shared.StatusEffectNew.StatusEffectsSystem instead.")]
|
||||
public sealed partial class StatusEffectsComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
|
|
@ -19,7 +20,8 @@ namespace Content.Shared.StatusEffect
|
|||
}
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class ActiveStatusEffectsComponent : Component {}
|
||||
[Obsolete("Use the new Content.Shared.StatusEffectNew.StatusEffectsSystem instead.")]
|
||||
public sealed partial class ActiveStatusEffectsComponent : Component { }
|
||||
|
||||
/// <summary>
|
||||
/// Holds information about an active status effect.
|
||||
|
|
@ -47,7 +49,7 @@ namespace Content.Shared.StatusEffect
|
|||
[ViewVariables]
|
||||
public string? RelevantComponent;
|
||||
|
||||
public StatusEffectState((TimeSpan, TimeSpan) cooldown, bool refresh, string? relevantComponent=null)
|
||||
public StatusEffectState((TimeSpan, TimeSpan) cooldown, bool refresh, string? relevantComponent = null)
|
||||
{
|
||||
Cooldown = cooldown;
|
||||
CooldownRefresh = refresh;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace Content.Shared.StatusEffect
|
|||
// If they already have the comp, we just won't bother updating anything.
|
||||
if (!HasComp(uid, Factory.GetRegistration(component).Type))
|
||||
{
|
||||
var newComponent = (Component) Factory.GetComponent(component);
|
||||
var newComponent = (Component)Factory.GetComponent(component);
|
||||
AddComp(uid, newComponent);
|
||||
status.ActiveEffects[key].RelevantComponent = component;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue