Remove last component.Name calls (#13593)
This commit is contained in:
@@ -7,11 +7,11 @@ namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[DataField("component")] public string Component { get; } = string.Empty;
|
||||
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory)
|
||||
{
|
||||
foreach (var component in entityManager.GetComponents(uid))
|
||||
{
|
||||
if (component.Name == Component)
|
||||
if (compFactory.GetComponentName(component.GetType()) == Component)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
{
|
||||
[DataField("store")] public string Store { get; } = string.Empty;
|
||||
|
||||
public abstract bool EntityValid(EntityUid uid, IEntityManager entityManager);
|
||||
public abstract bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Shared.Construction.Steps
|
||||
examinedEvent.Message.AddMarkup(Loc.GetString("construction-insert-material-entity", ("amount", Amount), ("materialName", material.Name)));
|
||||
}
|
||||
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory)
|
||||
{
|
||||
return entityManager.TryGetComponent(uid, out StackComponent? stack) && stack.StackTypeId == MaterialPrototypeId && stack.Count >= Amount;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Shared.Construction.Steps
|
||||
return list == null || list.Count == 0;
|
||||
}
|
||||
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory)
|
||||
{
|
||||
// This step can only happen if either list has tags.
|
||||
if (IsNullOrEmpty(_allTags) && IsNullOrEmpty(_anyTags))
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Construction.Steps
|
||||
[DataField("tag")]
|
||||
private string? _tag;
|
||||
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory)
|
||||
{
|
||||
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
||||
return !string.IsNullOrEmpty(_tag) && tagSystem.HasTag(uid, _tag);
|
||||
|
||||
Reference in New Issue
Block a user