(3dc4135ce) v0.9.5.1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -8,6 +9,7 @@ namespace Barotrauma
|
||||
{
|
||||
public DelayedEffect Parent;
|
||||
public Entity Entity;
|
||||
public Vector2? WorldPosition;
|
||||
public List<ISerializableEntity> Targets;
|
||||
public float StartTimer;
|
||||
}
|
||||
@@ -23,7 +25,7 @@ namespace Barotrauma
|
||||
delay = element.GetAttributeFloat("delay", 1.0f);
|
||||
}
|
||||
|
||||
public override void Apply(ActionType type, float deltaTime, Entity entity, ISerializableEntity target)
|
||||
public override void Apply(ActionType type, float deltaTime, Entity entity, ISerializableEntity target, Vector2? worldPosition = null)
|
||||
{
|
||||
if (this.type != type || !HasRequiredItems(entity)) return;
|
||||
if (!Stackable && DelayList.Any(d => d.Parent == this && d.Targets.FirstOrDefault() == target)) return;
|
||||
@@ -36,13 +38,14 @@ namespace Barotrauma
|
||||
Parent = this,
|
||||
StartTimer = delay,
|
||||
Entity = entity,
|
||||
WorldPosition = worldPosition,
|
||||
Targets = new List<ISerializableEntity>() { target }
|
||||
};
|
||||
|
||||
DelayList.Add(element);
|
||||
}
|
||||
|
||||
public override void Apply(ActionType type, float deltaTime, Entity entity, IEnumerable<ISerializableEntity> targets)
|
||||
public override void Apply(ActionType type, float deltaTime, Entity entity, IEnumerable<ISerializableEntity> targets, Vector2? worldPosition = null)
|
||||
{
|
||||
if (this.type != type || !HasRequiredItems(entity)) return;
|
||||
if (!Stackable && DelayList.Any(d => d.Parent == this && d.Targets.SequenceEqual(targets))) return;
|
||||
@@ -65,6 +68,7 @@ namespace Barotrauma
|
||||
Parent = this,
|
||||
StartTimer = delay,
|
||||
Entity = entity,
|
||||
WorldPosition = worldPosition,
|
||||
Targets = currentTargets
|
||||
};
|
||||
|
||||
@@ -86,7 +90,7 @@ namespace Barotrauma
|
||||
|
||||
if (element.StartTimer > 0.0f) continue;
|
||||
|
||||
element.Parent.Apply(1.0f, element.Entity, element.Targets);
|
||||
element.Parent.Apply(1.0f, element.Entity, element.Targets, element.WorldPosition);
|
||||
DelayList.Remove(element);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user