Skip to content

Commit

Permalink
Fix warning for using non-generic variant of TryComp for `MetaDataCom…
Browse files Browse the repository at this point in the history
…ponent` and `TransformComponent` RA0030 (#5531)

* Fix warning for using non-generic variant of TryComp for MetaDataComponent RA0030 (Use non-generic variant)

* Use non-generic variant of TryComp for TransformComponent
  • Loading branch information
CrafterKolyan authored Nov 22, 2024
1 parent 92b0e7f commit 9bb7af3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Robust.Client/GameObjects/EntitySystems/ContainerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public void AddExpectedEntity(NetEntity netEntity, BaseContainer container)
#if DEBUG
var uid = GetEntity(netEntity);

if (TryComp<MetaDataComponent>(uid, out var meta))
if (TryComp(uid, out MetaDataComponent? meta))
{
DebugTools.Assert((meta.Flags & ( MetaDataFlags.Detached | MetaDataFlags.InContainer) ) == MetaDataFlags.Detached,
$"Adding entity {ToPrettyString(uid)} to list of expected entities for container {container.ID} in {ToPrettyString(container.Owner)}, despite it already being in a container.");
Expand Down
2 changes: 1 addition & 1 deletion Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ private void OnGridStartup(EntityUid uid, MapGridComponent component, ComponentS
private void OnGridRemove(EntityUid uid, MapGridComponent component, ComponentShutdown args)
{
Log.Info($"Removing grid {ToPrettyString(uid)}");
if (TryComp<TransformComponent>(uid, out var xform) && xform.MapUid != null)
if (TryComp(uid, out TransformComponent? xform) && xform.MapUid != null)
{
RemoveGrid(uid, component, xform.MapUid.Value);
}
Expand Down

0 comments on commit 9bb7af3

Please sign in to comment.