- File transfer improvements (switching the sub selection during transfer works, max transfer duration, waiting for transfers to finish before starting the round)

- Firesource changes (more particles with shorter lifetimes, combining bugfix)
- StatusEffects can target hulls and always be active
- Cyrillic character support
- Saving server settings
- Swapping items in inventory by dropping an item to a non-free slot
This commit is contained in:
Regalis
2016-02-27 21:01:10 +02:00
parent 7309201b11
commit cc4ada952f
31 changed files with 470 additions and 199 deletions
@@ -172,6 +172,29 @@ namespace Barotrauma
combined = true;
}
//if moving the item between slots in the same inventory
else if (item.ParentInventory == this)
{
int currentIndex = Array.IndexOf(Items, item);
Item existingItem = Items[index];
Items[currentIndex] = null;
Items[index] = null;
//if the item in the slot can be moved to the slot of the moved item
if (TryPutItem(existingItem, currentIndex, false) &&
TryPutItem(item, index, false))
{
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, Owner.ID, true, true);
}
else
{
//swapping the items failed -> move them back to where they were
TryPutItem(item, currentIndex, false);
TryPutItem(existingItem, index, false);
}
}
return combined;
}
+16 -7
View File
@@ -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;