Removed hard-coded path to humanhusk (now the huskified human config is found based on the name), characters with severed limbs cannot turn into husks. Closes #243
This commit is contained in:
@@ -143,6 +143,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.Client != null) return;
|
if (GameMain.Client != null) return;
|
||||||
|
|
||||||
|
//don't turn the character into a husk if any of its limbs are severed
|
||||||
|
if (character.AnimController?.LimbJoints != null)
|
||||||
|
{
|
||||||
|
foreach (var limbJoint in character.AnimController.LimbJoints)
|
||||||
|
{
|
||||||
|
if (limbJoint.IsSevered) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//create the AI husk in a coroutine to ensure that we don't modify the character list while enumerating it
|
//create the AI husk in a coroutine to ensure that we don't modify the character list while enumerating it
|
||||||
CoroutineManager.StartCoroutine(CreateAIHusk(character));
|
CoroutineManager.StartCoroutine(CreateAIHusk(character));
|
||||||
}
|
}
|
||||||
@@ -152,11 +161,16 @@ namespace Barotrauma
|
|||||||
character.Enabled = false;
|
character.Enabled = false;
|
||||||
Entity.Spawner.AddToRemoveQueue(character);
|
Entity.Spawner.AddToRemoveQueue(character);
|
||||||
|
|
||||||
var husk = Character.Create(
|
var characterFiles = GameMain.SelectedPackage.GetFilesOfType(ContentType.Character);
|
||||||
Path.Combine("Content", "Characters", "Human", "humanhusk.xml"),
|
var configFile = characterFiles.Find(f => Path.GetFileNameWithoutExtension(f) == "humanhusk");
|
||||||
character.WorldPosition,
|
|
||||||
character.Info,
|
if (string.IsNullOrEmpty(configFile))
|
||||||
false, true);
|
{
|
||||||
|
DebugConsole.ThrowError("Failed to turn character \"" + character.Name + "\" into a husk - humanhusk config file not found.");
|
||||||
|
yield return CoroutineStatus.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
var husk = Character.Create(configFile, character.WorldPosition, character.Info, false, true);
|
||||||
|
|
||||||
foreach (Limb limb in husk.AnimController.Limbs)
|
foreach (Limb limb in husk.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user