Explosives, chemicals and medical items disappear when their condition falls to 0 (i.e. when they're fully used).

Railgun shells, detonators and depth charges also now "use" their contents instead of destroying them. (See #322)
This commit is contained in:
Joonas Rikkonen
2018-04-03 22:43:41 +03:00
parent faaaa69fa7
commit 9dd9425caa
5 changed files with 142 additions and 15 deletions
@@ -58,6 +58,8 @@ namespace Barotrauma
private readonly int useItemCount;
private readonly bool removeItem;
public readonly ActionType type;
private Explosion explosion;
@@ -211,6 +213,10 @@ namespace Barotrauma
case "useitem":
useItemCount++;
break;
case "remove":
case "removeitem":
removeItem = true;
break;
case "requireditem":
case "requireditems":
RelatedItem newRequiredItem = RelatedItem.Load(subElement);
@@ -368,6 +374,14 @@ namespace Barotrauma
}
}
if (removeItem)
{
foreach (Item item in targets.FindAll(t => t is Item).Cast<Item>())
{
Entity.Spawner.AddToRemoveQueue(item);
}
}
if (duration > 0.0f)
{
DurationListElement element = new DurationListElement();