2f107db...5202af9

This commit is contained in:
Joonas Rikkonen
2019-03-18 21:42:26 +02:00
parent 58c92888b7
commit 044fd3344b
395 changed files with 27417 additions and 19754 deletions
@@ -26,7 +26,7 @@ namespace Barotrauma
public override void Apply(ActionType type, float deltaTime, Entity entity, ISerializableEntity target)
{
if (this.type != type || !HasRequiredItems(entity)) return;
if (!Stackable && DelayList.Any(d => d.Parent == this && d.Targets.Count == 1 && d.Targets[0] == target)) return;
if (!Stackable && DelayList.Any(d => d.Parent == this && d.Targets.FirstOrDefault() == target)) return;
if (targetIdentifiers != null && !IsValidTarget(target)) return;
if (!HasRequiredConditions(new List<ISerializableEntity>() { target })) return;
@@ -42,26 +42,30 @@ namespace Barotrauma
DelayList.Add(element);
}
public override void Apply(ActionType type, float deltaTime, Entity entity, List<ISerializableEntity> targets)
public override void Apply(ActionType type, float deltaTime, Entity entity, IEnumerable<ISerializableEntity> targets)
{
if (this.type != type || !HasRequiredItems(entity)) return;
if (!Stackable && DelayList.Any(d => d.Parent == this && d.Targets.SequenceEqual(targets))) return;
//remove invalid targets
if (targetIdentifiers != null)
currentTargets.Clear();
foreach (ISerializableEntity target in targets)
{
targets.RemoveAll(t => !IsValidTarget(t));
if (targets.Count == 0) return;
if (targetIdentifiers != null)
{
//ignore invalid targets
if (!IsValidTarget(target)) { continue; }
}
currentTargets.Add(target);
}
if (!HasRequiredConditions(targets)) return;
if (!HasRequiredConditions(currentTargets)) return;
DelayedListElement element = new DelayedListElement
{
Parent = this,
StartTimer = delay,
Entity = entity,
Targets = targets
Targets = currentTargets
};
DelayList.Add(element);