Item.FindHull changes, added depth charges and flashlights to default subs

This commit is contained in:
Regalis
2016-05-15 17:56:42 +03:00
parent c546c42a8b
commit 4a54788d7b
6 changed files with 17 additions and 12 deletions

View File

@@ -503,20 +503,30 @@ namespace Barotrauma
public virtual Hull FindHull()
{
if (parentInventory != null && (parentInventory.Owner as Character) != null)
if (parentInventory != null && parentInventory.Owner != null)
{
CurrentHull = (parentInventory.Owner as Character).AnimController.CurrentHull;
body.Submarine = (parentInventory.Owner as Character).Submarine;
if (parentInventory.Owner is Character)
{
CurrentHull = (parentInventory.Owner as Character).AnimController.CurrentHull;
}
else if (parentInventory.Owner is Item)
{
CurrentHull = (parentInventory.Owner as Item).CurrentHull;
}
Submarine = parentInventory.Owner.Submarine;
if (body != null) body.Submarine = Submarine;
return CurrentHull;
}
CurrentHull = Hull.FindHull(WorldPosition, CurrentHull);
if (body!=null)
if (body != null)
{
Submarine = CurrentHull == null ? null : Submarine.Loaded;
body.Submarine = Submarine;
}
return CurrentHull;
}