(9a14162c6) Disabled spontaneous deterioration on items that are not being used. TODO: adjust all deterioration rates and delays

This commit is contained in:
Joonas Rikkonen
2019-04-07 21:43:35 +03:00
parent 3d3975e07c
commit be76bd53e9
9 changed files with 82 additions and 20 deletions
@@ -282,10 +282,17 @@ namespace Barotrauma.Items.Components
{
//use linked projectile containers in case they have to react to the turret being launched somehow
//(play a sound, spawn more projectiles)
Item linkedItem = e as Item;
if (linkedItem == null) continue;
if (!(e is Item linkedItem)) continue;
ItemContainer projectileContainer = linkedItem.GetComponent<ItemContainer>();
if (projectileContainer != null) linkedItem.Use(deltaTime, null);
if (projectileContainer != null)
{
linkedItem.Use(deltaTime, null);
var repairable = linkedItem.GetComponent<Repairable>();
if (repairable != null)
{
repairable.LastActiveTime = (float)Timing.TotalTime + 1.0f;
}
}
}
var projectiles = GetLoadedProjectiles(true);
@@ -417,9 +424,8 @@ namespace Barotrauma.Items.Components
int maxProjectileCount = 0;
foreach (MapEntity e in item.linkedTo)
{
var projectileContainer = e as Item;
if (projectileContainer == null) continue;
if (!(e is Item projectileContainer)) continue;
var containedItems = projectileContainer.ContainedItems;
if (containedItems != null)
{