Some tweaks to make enemy attacks less likely to miss:

- Option to select which limbs attack force is applied to (e.g. husks and crawlers now lunge forward when attacking).
- Enemies attack towards the closest limb of their target instead of the main limb.
This commit is contained in:
Joonas Rikkonen
2017-06-14 20:38:16 +03:00
parent 242da11e3f
commit 06e23ffe6d
7 changed files with 63 additions and 11 deletions
+19 -1
View File
@@ -51,6 +51,10 @@ namespace Barotrauma
public readonly float SeverLimbsProbability;
//the indices of the limbs Force is applied on
//(if none, force is applied only to the limb the attack is attached to)
public readonly List<int> ApplyForceOnLimbs;
private Sound sound;
private ParticleEmitterPrefab particleEmitterPrefab;
@@ -92,7 +96,7 @@ namespace Barotrauma
SeverLimbsProbability = ToolBox.GetAttributeFloat(element, "severlimbsprobability", 0.0f);
Force = ToolBox.GetAttributeFloat(element,"force", 0.0f);
Force = ToolBox.GetAttributeFloat(element, "force", 0.0f);
TargetForce = ToolBox.GetAttributeFloat(element, "targetforce", 0.0f);
Torque = ToolBox.GetAttributeFloat(element, "torque", 0.0f);
@@ -107,6 +111,20 @@ namespace Barotrauma
priority = ToolBox.GetAttributeFloat(element, "priority", 1.0f);
string limbIndicesStr = ToolBox.GetAttributeString(element, "applyforceonlimbs", "");
if (!string.IsNullOrWhiteSpace(limbIndicesStr))
{
ApplyForceOnLimbs = new List<int>();
foreach (string limbIndexStr in limbIndicesStr.Split(','))
{
int limbIndex;
if (int.TryParse(limbIndexStr, out limbIndex))
{
ApplyForceOnLimbs.Add(limbIndex);
}
}
}
statusEffects = new List<StatusEffect>();
foreach (XElement subElement in element.Elements())
{