OnWearing statuseffects aren't applied to items contained inside a worn item, dragging an item is canceled if deselecting the inventory the item is in

This commit is contained in:
Regalis
2016-05-07 09:19:32 +03:00
parent d5f6fff2c2
commit be3d418297
3 changed files with 25 additions and 16 deletions
+1 -1
View File
@@ -382,7 +382,7 @@ namespace Barotrauma
if (commands.Length>1) float.TryParse(commands[1], out power); if (commands.Length>1) float.TryParse(commands[1], out power);
var reactor = reactorItem.GetComponent<Reactor>(); var reactor = reactorItem.GetComponent<Reactor>();
reactor.ShutDownTemp = 7000.0f; reactor.ShutDownTemp = power == 0 ? 0 : 7000.0f;
reactor.AutoTemp = true; reactor.AutoTemp = true;
reactor.Temperature = power; reactor.Temperature = power;
break; break;
+18 -9
View File
@@ -413,20 +413,11 @@ namespace Barotrauma
} }
} }
//for (int i = 0; i < capacity; i++)
//{
// slotRect.X = (int)(SlotPositions[i].X + offset.X);
// slotRect.Y = (int)(SlotPositions[i].Y + offset.Y);
// slotRect.Width = 40;
// slotRect.Height = 40;
if (selectedSlot > -1) if (selectedSlot > -1)
{ {
DrawSubInventory(spriteBatch, highlightedSlot, selectedSlot); DrawSubInventory(spriteBatch, highlightedSlot, selectedSlot);
} }
//}
slotRect.Width = rectWidth; slotRect.Width = rectWidth;
slotRect.Height = rectHeight; slotRect.Height = rectHeight;
@@ -437,6 +428,24 @@ namespace Barotrauma
if (draggingItem == null) return; if (draggingItem == null) return;
var rootContainer = draggingItem.GetRootContainer();
var rootInventory = draggingItem.ParentInventory;
if (rootContainer != null)
{
rootInventory = rootContainer.ParentInventory != null ?
rootContainer.ParentInventory : rootContainer.GetComponent<Items.Components.ItemContainer>().Inventory;
}
if (rootInventory != null &&
rootInventory.Owner != Character.Controlled &&
rootInventory.Owner != Character.Controlled.SelectedConstruction &&
rootInventory.Owner != Character.Controlled.SelectedCharacter)
{
draggingItem = null;
return;
}
if (!draggingItemSlot.Contains(PlayerInput.MousePosition)) if (!draggingItemSlot.Contains(PlayerInput.MousePosition))
{ {
if (PlayerInput.LeftButtonHeld()) if (PlayerInput.LeftButtonHeld())
@@ -178,12 +178,12 @@ namespace Barotrauma.Items.Components
PlaySound(ActionType.OnWearing, picker.WorldPosition); PlaySound(ActionType.OnWearing, picker.WorldPosition);
if (containedItems == null) return; //if (containedItems == null) return;
for (int j = 0; j < containedItems.Length; j++) //for (int j = 0; j < containedItems.Length; j++)
{ //{
if (containedItems[j] == null) continue; // if (containedItems[j] == null) continue;
containedItems[j].ApplyStatusEffects(ActionType.OnWearing, deltaTime, picker); // containedItems[j].ApplyStatusEffects(ActionType.OnWearing, deltaTime, picker);
} //}
} }
protected override void RemoveComponentSpecific() protected override void RemoveComponentSpecific()