ItemComponents that don't implement the IDrawableComponent interface can't be added to the list of drawable components, pickTimer is ignored when deattaching items from the walls in the editor

This commit is contained in:
Regalis
2016-11-11 17:34:21 +02:00
parent 392bc13258
commit 96cedd67f1
2 changed files with 11 additions and 11 deletions
@@ -117,17 +117,22 @@ namespace Barotrauma.Items.Components
set
{
if (value == drawable) return;
if (!(this is IDrawableComponent))
{
DebugConsole.ThrowError("Couldn't make ''"+this+"'' drawable (the component doesn't implement the IDrawableComponent interface)");
return;
}
drawable = value;
if (drawable)
{
if (!item.drawableComponents.Contains(this as IDrawableComponent))
item.drawableComponents.Add(this as IDrawableComponent);
if (!item.drawableComponents.Contains((IDrawableComponent)this))
item.drawableComponents.Add((IDrawableComponent)this);
}
else
{
item.drawableComponents.Remove(this as IDrawableComponent);
}
item.drawableComponents.Remove((IDrawableComponent)this);
}
}
}