Fix removehand throwing exception when no hand exists (#1570)
* Fix removehand throwing exception when no hand exists * Message when you have no hands
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.BodySystem;
|
using Content.Server.BodySystem;
|
||||||
@@ -388,8 +388,16 @@ namespace Content.Server.GameTicking
|
|||||||
}
|
}
|
||||||
|
|
||||||
var manager = player.AttachedEntity.GetComponent<BodyManagerComponent>();
|
var manager = player.AttachedEntity.GetComponent<BodyManagerComponent>();
|
||||||
var hand = manager.PartDictionary.First(x => x.Value.PartType == BodyPartType.Hand);
|
var hand = manager.PartDictionary.FirstOrDefault(x => x.Value.PartType == BodyPartType.Hand);
|
||||||
manager.DisconnectBodyPart(hand.Value, true);
|
if (hand.Value == null)
|
||||||
|
{
|
||||||
|
shell.SendText(player, "You have no hands.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
manager.DisconnectBodyPart(hand.Value, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user