Entity removal fixes
This commit is contained in:
@@ -1155,11 +1155,22 @@ namespace Barotrauma
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
foreach (Limb l in Limbs) l.Remove();
|
||||
foreach (Limb l in Limbs)
|
||||
{
|
||||
l.Remove();
|
||||
}
|
||||
Limbs = null;
|
||||
|
||||
collider.Remove();
|
||||
collider = null;
|
||||
|
||||
foreach (RevoluteJoint joint in limbJoints)
|
||||
{
|
||||
GameMain.World.RemoveJoint(joint);
|
||||
}
|
||||
limbJoints = null;
|
||||
|
||||
list.Remove(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2142,6 +2142,8 @@ namespace Barotrauma
|
||||
|
||||
if (aiTarget != null) aiTarget.Remove();
|
||||
|
||||
if (Lights.LightManager.ViewTarget == this) Lights.LightManager.ViewTarget = null;
|
||||
|
||||
if (AnimController!=null) AnimController.Remove();
|
||||
}
|
||||
|
||||
|
||||
@@ -557,12 +557,29 @@ namespace Barotrauma
|
||||
public void Remove()
|
||||
{
|
||||
sprite.Remove();
|
||||
if (LightSource != null) LightSource.Remove();
|
||||
if (damagedSprite != null) damagedSprite.Remove();
|
||||
sprite = null;
|
||||
|
||||
body.Remove();
|
||||
if (LightSource != null)
|
||||
{
|
||||
LightSource.Remove();
|
||||
}
|
||||
if (damagedSprite != null)
|
||||
{
|
||||
damagedSprite.Remove();
|
||||
damagedSprite = null;
|
||||
}
|
||||
|
||||
if (hitSound != null) hitSound.Remove();
|
||||
if (body != null)
|
||||
{
|
||||
body.Remove();
|
||||
body = null;
|
||||
}
|
||||
|
||||
if (hitSound != null)
|
||||
{
|
||||
hitSound.Remove();
|
||||
hitSound = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user