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:
@@ -112,10 +112,8 @@ namespace Barotrauma.Items.Components
|
||||
var leftHand = picker.AnimController.GetLimb(LimbType.LeftHand);
|
||||
var rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
|
||||
|
||||
Drawable = true;
|
||||
|
||||
pickTimer = 0.0f;
|
||||
while (pickTimer < requiredTime)
|
||||
while (pickTimer < requiredTime && Screen.Selected != GameMain.EditMapScreen)
|
||||
{
|
||||
if (picker.IsKeyDown(InputType.Aim) ||
|
||||
!item.IsInPickRange(picker.WorldPosition) ||
|
||||
@@ -125,7 +123,6 @@ namespace Barotrauma.Items.Components
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
|
||||
picker.UpdateHUDProgressBar(
|
||||
this,
|
||||
item.WorldPosition,
|
||||
@@ -158,8 +155,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void StopPicking(Character picker)
|
||||
{
|
||||
Drawable = false;
|
||||
|
||||
picker.AnimController.Anim = AnimController.Animation.None;
|
||||
pickTimer = 0.0f;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user