Cleanup warning in `StealConditionSystem` (#37903)
Fix 1 warning in StealConditionSystem
This commit is contained in:
parent
e2d8ce7e6a
commit
1acd544d57
|
|
@ -78,7 +78,7 @@ public sealed class StealConditionSystem : EntitySystem
|
|||
var group = _proto.Index(condition.Comp.StealGroup);
|
||||
string localizedName = Loc.GetString(group.Name);
|
||||
|
||||
var title =condition.Comp.OwnerText == null
|
||||
var title = condition.Comp.OwnerText == null
|
||||
? Loc.GetString(condition.Comp.ObjectiveNoOwnerText, ("itemName", localizedName))
|
||||
: Loc.GetString(condition.Comp.ObjectiveText, ("owner", Loc.GetString(condition.Comp.OwnerText)), ("itemName", localizedName));
|
||||
|
||||
|
|
@ -92,12 +92,12 @@ public sealed class StealConditionSystem : EntitySystem
|
|||
}
|
||||
private void OnGetProgress(Entity<StealConditionComponent> condition, ref ObjectiveGetProgressEvent args)
|
||||
{
|
||||
args.Progress = GetProgress(args.Mind, condition);
|
||||
args.Progress = GetProgress((args.MindId, args.Mind), condition);
|
||||
}
|
||||
|
||||
private float GetProgress(MindComponent mind, StealConditionComponent condition)
|
||||
private float GetProgress(Entity<MindComponent> mind, StealConditionComponent condition)
|
||||
{
|
||||
if (!_containerQuery.TryGetComponent(mind.OwnedEntity, out var currentManager))
|
||||
if (!_containerQuery.TryGetComponent(mind.Comp.OwnedEntity, out var currentManager))
|
||||
return 0;
|
||||
|
||||
var containerStack = new Stack<ContainerManagerComponent>();
|
||||
|
|
@ -127,7 +127,7 @@ public sealed class StealConditionSystem : EntitySystem
|
|||
}
|
||||
|
||||
//check pulling object
|
||||
if (TryComp<PullerComponent>(mind.OwnedEntity, out var pull)) //TO DO: to make the code prettier? don't like the repetition
|
||||
if (TryComp<PullerComponent>(mind.Comp.OwnedEntity, out var pull)) //TO DO: to make the code prettier? don't like the repetition
|
||||
{
|
||||
var pulledEntity = pull.Pulling;
|
||||
if (pulledEntity != null)
|
||||
|
|
@ -154,7 +154,7 @@ public sealed class StealConditionSystem : EntitySystem
|
|||
}
|
||||
} while (containerStack.TryPop(out currentManager));
|
||||
|
||||
var result = count / (float) condition.CollectionSize;
|
||||
var result = count / (float)condition.CollectionSize;
|
||||
result = Math.Clamp(result, 0, 1);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue