Merge branch 'master' of bitbucket.org:Regalis11/barotrauma

This commit is contained in:
Sebastian Broberg
2016-03-03 20:18:35 +01:00
111 changed files with 1720 additions and 1204 deletions

View File

@@ -286,7 +286,7 @@ namespace Barotrauma
}
public Item(Rectangle newRect, ItemPrefab itemPrefab, Submarine submarine)
: base(submarine)
: base(itemPrefab, submarine)
{
prefab = itemPrefab;
@@ -487,7 +487,8 @@ namespace Barotrauma
public void ApplyStatusEffect(StatusEffect effect, ActionType type, float deltaTime, Character character = null)
{
if (condition == 0.0f && effect.type != ActionType.OnBroken) return;
if (effect.type != type) return;
bool hasTargets = (effect.TargetNames == null);
Item[] containedItems = ContainedItems;
@@ -501,10 +502,10 @@ namespace Barotrauma
List<IPropertyObject> targets = new List<IPropertyObject>();
if (containedItems!=null)
if (containedItems != null)
{
if (effect.Targets.HasFlag(StatusEffect.TargetType.Contained))
{
{
foreach (Item containedItem in containedItems)
{
if (containedItem == null) continue;
@@ -528,9 +529,14 @@ namespace Barotrauma
}
}
if (!hasTargets) return;
if (effect.Targets.HasFlag(StatusEffect.TargetType.Hull) && CurrentHull != null)
{
targets.Add(CurrentHull);
}
if (effect.Targets.HasFlag(StatusEffect.TargetType.This))
{
foreach (var pobject in AllPropertyObjects)
@@ -550,7 +556,7 @@ namespace Barotrauma
// effect.Apply(type, deltaTime, container);
// //container.ApplyStatusEffect(effect, type, deltaTime, container);
//}
effect.Apply(type, deltaTime, this, targets);
}
@@ -575,7 +581,10 @@ namespace Barotrauma
public override void Update(Camera cam, float deltaTime)
{
{
ApplyStatusEffects(ActionType.Always, deltaTime, null);
foreach (ItemComponent ic in components)
{
if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive;
@@ -1210,7 +1219,7 @@ namespace Barotrauma
element.Add(new XAttribute("name", prefab.Name),
new XAttribute("ID", ID));
if (prefab.ResizeHorizontal || prefab.ResizeVertical)
if (ResizeHorizontal || ResizeVertical)
{
element.Add(new XAttribute("rect",
(int)(rect.X - Submarine.HiddenSubPosition.X) + "," +