Removed limb impact tolerances from creature configs & added ragdoll-specific impact tolerance

This commit is contained in:
Regalis
2016-10-26 20:20:42 +03:00
parent 282611d0cc
commit 29ad3d2555
16 changed files with 52 additions and 56 deletions

View File

@@ -13,7 +13,7 @@
</limb>
<!-- lower yaw -->
<limb id = "1" radius="70" height="100" impacttolerance="50.0">
<limb id = "1" radius="70" height="100">
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="416,0,192,256" depth="0.025" origin="0.65,0.5"/>
<attack range="300" duration="0.5" damage="5.00" bleedingdamage="50" structuredamage="500" damagetype="slash" torque="200" targetforce="-50"/>
</limb>

View File

@@ -10,12 +10,12 @@
<collider radius ="50"/>
<!-- head -->
<limb id = "0" radius="50" height="270" type="Head" steerforce="1.0" impacttolerance="50.0">
<limb id = "0" radius="50" height="270" type="Head" steerforce="1.0">
<sprite texture="Content/Characters/Coelanth/coelanth.png" sourcerect="267,171,162,392" depth="0.02" origin ="0.5,0.5"/>
</limb>
<!-- lower yaw -->
<limb id = "1" radius="20" height="240" impacttolerance="50.0">
<limb id = "1" radius="20" height="240">
<sprite texture="Content/Characters/Coelanth/coelanth.png" sourcerect="425,1,101,309" depth="0.025" origin="0.5,0.5"/>
<attack range="300" duration="0.5" damage="200" bleedingdamage="50" structuredamage="150" damagetype="slash" torque="100" targetforce="-50"/>
</limb>

View File

@@ -16,7 +16,7 @@
<collider width="45" radius="22"/>
<!-- head -->
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armorvalue="30.0" impacttolerance="50.0">
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armorvalue="30.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="0,0,51,121" depth="0.02" origin="0.45,0.63"/>
</limb>
@@ -30,7 +30,7 @@
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="6,141,60,95" depth="0.022" origin="0.37,0.43"/>
</limb>
<limb id = "3" width="13" height="45" ignorecollisions="true" flip="true" impacttolerance="50.0">
<limb id = "3" width="13" height="45" ignorecollisions="true" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/>
<attack range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="3" structuredamage="50" damagetype="slash" force="20" torque="-20" targetforce="-30"/>
</limb>
@@ -38,7 +38,7 @@
<limb id = "4" width="11" height="34" type="RightLeg" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="82,83,11,34" depth="0.03" origin="0.5,0.5"/>
</limb>
<limb id = "5" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="3" stepoffset="20.0,0.0" impacttolerance="50.0">
<limb id = "5" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="3" stepoffset="20.0,0.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="59,78,19,43" depth="0.03" origin="0.5,0.5"/>
<sound file ="Content/Sounds/stepMetal.ogg"/>
</limb>
@@ -46,7 +46,7 @@
<limb id = "6" width="13" height="35" type="LeftLeg" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="82,83,11,34" depth="0.03" origin="0.5,0.5"/>
</limb>
<limb id = "7" width="5" height="40" type="LeftFoot" flip="true" pullpos="0.0,15.0" refjoint="5" stepoffset="20.0,0.0" impacttolerance="50.0">
<limb id = "7" width="5" height="40" type="LeftFoot" flip="true" pullpos="0.0,15.0" refjoint="5" stepoffset="20.0,0.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="59,78,19,43" depth="0.03" origin="0.5,0.5"/>
<sound file ="Content/Sounds/stepMetal.ogg"/>
</limb>
@@ -54,7 +54,7 @@
<limb id = "8" width="13" height="35" type="RightLeg" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="82,83,11,34" depth="0.03" origin="0.5,0.5"/>
</limb>
<limb id = "9" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="7" stepoffset="20.0,0.0" impacttolerance="50.0">
<limb id = "9" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="7" stepoffset="20.0,0.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="59,78,19,43" depth="0.03" origin="0.5,0.5"/>
<sound file ="Content/Sounds/stepMetal.ogg"/>
</limb>

View File

@@ -44,12 +44,12 @@
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="704,0,320,400" depth="0.07" origin="0.5,0.5"/>
</limb>
<limb id = "8" width="50" height="320" impacttolerance="100.0">
<limb id = "8" width="50" height="320">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/>
<attack range="800" duration="0.5" damage="30" stun="5.0" torque="-100" structuredamage="500" damagetype="slash"/>
</limb>
<limb id = "9" width="50" height="320" impacttolerance="100.0">
<limb id = "9" width="50" height="320">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/>
<attack range="800" duration="0.5" damage="30" stun="5.0" torque="100" structuredamage="500" damagetype="slash"/>
</limb>

View File

@@ -8,31 +8,31 @@
<collider radius="50"/>
<!-- head -->
<limb id = "0" radius="65" type="Head" steerforce="3.0" impacttolerance="100">
<limb id = "0" radius="65" type="Head" steerforce="3.0">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,0,129,128" depth="0.04"/>
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="10" damagetype="blunt" targetforce="80"/>
</limb>
<!-- body -->
<limb id = "1" radius="50" type="Torso" impacttolerance="100">
<limb id = "1" radius="50">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,125,108,105" depth="0.03" origin="0.5,0.5"/>
</limb>
<!-- body -->
<limb id = "2" radius="45" height="75" type="Torso" impacttolerance="100">
<limb id = "2" radius="45" height="75">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,239,90,136" depth="0.02" origin="0.5,0.5"/>
</limb>
<limb id = "3" width="30" height="175" type="Tail" impacttolerance="100">
<limb id = "3" width="30" height="175" type="Tail">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.01" origin="0.5,0.5"/>
</limb>
<limb id = "4" width="30" height="239" impacttolerance="100.0">
<limb id = "4" width="30" height="239">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="183,0,53,238" depth="0.05" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="-150" damagetype="slash"/>
</limb>
<limb id = "5" width="30" height="239" impacttolerance="100.0">
<limb id = "5" width="30" height="239">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="236,0,53,238" size="-1,1" depth="0.05" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="150" damagetype="slash"/>
</limb>

View File

@@ -9,25 +9,25 @@
<collider radius="80" height="30"/>
<!-- head -->
<limb id = "0" radius="80" height="30" type="Head" steerforce="3.0" impacttolerance="100">
<limb id = "0" radius="80" height="30" type="Head" steerforce="3.0">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="299,0,171,208" depth="0.05"/>
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="10" damagetype="blunt" targetforce="100"/>
</limb>
<limb id = "1" width="30" height="178" impacttolerance="100.0">
<limb id = "1" width="30" height="178">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="183,60,53,178" depth="0.08" origin="0.5,0.5"/>
</limb>
<limb id = "2" width="30" height="175" impacttolerance="100">
<limb id = "2" width="30" height="175">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.1" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="150" damagetype="slash"/>
</limb>
<limb id = "3" width="30" height="178" impacttolerance="100.0">
<limb id = "3" width="30" height="178">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="236,60,53,178" size="-1,1" depth="0.08" origin="0.5,0.5"/>
</limb>
<limb id = "4" width="30" height="175" impacttolerance="100">
<limb id = "4" width="30" height="175">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.1" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="-150" damagetype="slash"/>
</limb>

View File

@@ -10,21 +10,22 @@
legtorque="15.0"
thightorque="-5.0"
walkspeed="1.5"
swimspeed="2.0">
swimspeed="2.0"
impacttolerance="7.5">
<collider height="100" radius="15"/>
<!-- head -->
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="5.0">
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2">
<sprite texture="Content/Characters/Human/[GENDER]head[HEADID].png" sourcerect="1,1,37,38" depth="0.04" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedhead.png" sourcerect="1,1,37,38" origin="0.5,0.5"/>
</limb>
<!-- body -->
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3" impacttolerance="10.0">
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3">
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="0,0,29,58" depth="0.05" origin="0.5,0.6"/>
<damagedsprite texture="Content/Characters/Human/damagedtorso.png" sourcerect="0,0,29,58" origin="0.5,0.6"/>
</limb>
<limb id = "12" radius="13" mass = "20" type="Waist" impacttolerance="10.0">
<limb id = "12" radius="13" mass = "20" type="Waist">
<sprite texture="Content/Characters/Human/[GENDER]legs.png" sourcerect="0,0,32,29" depth="0.045" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedlegs.png" sourcerect="0,0,32,29" origin="0.5,0.5"/>
</limb>

View File

@@ -13,16 +13,16 @@
swimspeed="2.0">
<!-- head -->
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="5.0">
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2">
<sprite texture="Content/Characters/Human/[GENDER]head[HEADID].png" sourcerect="1,1,37,38" depth="0.04" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedhead.png" sourcerect="1,1,37,38" origin="0.5,0.5"/>
</limb>
<!-- body -->
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3" impacttolerance="10.0">
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3">
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="0,0,29,58" depth="0.05" origin="0.5,0.6"/>
<damagedsprite texture="Content/Characters/Human/damagedtorso.png" sourcerect="0,0,29,58" origin="0.5,0.6"/>
</limb>
<limb id = "12" radius="13" mass = "20" type="Waist" impacttolerance="10.0">
<limb id = "12" radius="13" mass = "20" type="Waist">
<sprite texture="Content/Characters/Human/[GENDER]legs.png" sourcerect="0,0,32,29" depth="0.045" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedlegs.png" sourcerect="0,0,32,29" origin="0.5,0.5"/>
</limb>
@@ -78,7 +78,7 @@
</limb>
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" impacttolerance="5.0" pullpos="0.0,25.0">
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" pullpos="0.0,25.0">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="110,76,18,52" depth="0.5" origin="0.5,0.5"/>
<attack range="70" duration="0.1" bleedingdamage="3" damage="10" stun="0.5" torque="-50" damagetype="slash" targetforce="10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="0.01" disabledeltatime="true"/>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<huskappendage>
<!-- spike/tentacle thingy -->
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" impacttolerance="5.0" pullpos="0.0,25.0">
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" pullpos="0.0,25.0">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="110,76,18,52" depth="0.5" origin="0.5,0.5"/>
<attack range="70" duration="0.1" bleedingdamage="0.5" damage="10" stun="0.5" torque="-50" damagetype="slash" targetforce="10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="0.01"/>

View File

@@ -17,13 +17,13 @@
<collider height="100" radius="15"/>
<!-- head -->
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="5.0">
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="95,0,33,25" depth="0.04" origin="0.5,0.5"/>
</limb>
<!-- spike/tentacle thingy -->
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" impacttolerance="5.0" flip="true" pullpos="0.0,25.0">
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" pullpos="0.0,25.0">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="110,76,18,52" depth="0.05" origin="0.5,0.5"/>
<attack range="70" duration="0.2" bleedingdamage="0.5" damage="10" stun="0.5" torque="-50" damagetype="slash" targetforce="10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="0.01" disabledeltatime="true"/>
@@ -32,10 +32,10 @@
</limb>
<!-- body -->
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3" impacttolerance="10.0">
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3">
<sprite texture="Content/Characters/Husk/DivingSuit.png" limb="Torso" sourcerect="41,1,42,96" origin="0.5,0.55"/>
</limb>
<limb id = "12" radius="13" mass = "20" type="Waist" impacttolerance="10.0">
<limb id = "12" radius="13" mass = "20" type="Waist">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="0,0,1,1" depth="0.045" origin="0.5,0.5"/>
</limb>

View File

@@ -11,7 +11,7 @@
<collider radius ="230"/>
<!-- head -->
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0" impacttolerance="100">
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0">
<sprite texture="Content/Characters/Moloch/moloch.png" sourcerect="0,0,628,1024" depth="0.02" origin ="0.4,0.5"/>
<attack range="700" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
</limb>

View File

@@ -10,13 +10,13 @@
<collider radius="50" height="320"/>
<!-- head -->
<limb id = "0" radius="12" height="100" type="Head" steerforce="1.0" impacttolerance="50.0">
<limb id = "0" radius="12" height="100" type="Head" steerforce="1.0">
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="371,15,66,136" depth="0.02" origin ="0.5,0.5"/>
<damagedsprite texture="Content/Characters/TigerThresher/damagedtigerthresher.png" sourcerect="371,15,66,136" origin ="0.5,0.5"/>
</limb>
<!-- lower yaw -->
<limb id = "1" width="16" height="103" impacttolerance="50.0">
<limb id = "1" width="16" height="103">
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="391,169,28,110" depth="0.025" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/TigerThresher/damagedtigerthresher.png" sourcerect="391,169,28,110" origin="0.5,0.5"/>
<attack range="200" duration="0.5" damage="150" bleedingdamage="10" structuredamage="200" damagetype="slash" torque="80" targetforce="-50"/>

View File

@@ -97,7 +97,7 @@ namespace Barotrauma
diff.Y = 0.0f;
}
if (diff == Vector2.Zero) return -host.Steering;
if (diff.Length() < 0.01) return -host.Steering;
return Vector2.Normalize(diff) * speed;
}

View File

@@ -13,10 +13,7 @@ namespace Barotrauma
protected Character character;
protected float walkSpeed, swimSpeed;
//how large impacts the Character can take before being stunned
//protected float impactTolerance;
protected float stunTimer;
protected float walkPos;
@@ -47,14 +44,7 @@ namespace Barotrauma
walkSpeed = ToolBox.GetAttributeFloat(element, "walkspeed", 1.0f);
swimSpeed = ToolBox.GetAttributeFloat(element, "swimspeed", 1.0f);
//stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.One);
//stepOffset = ConvertUnits.ToSimUnits(stepOffset);
//impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 10.0f);
legTorque = ToolBox.GetAttributeFloat(element, "legtorque", 0.0f);
}
public virtual void UpdateAnim(float deltaTime) { }

View File

@@ -224,6 +224,12 @@ namespace Barotrauma
}
}
public float ImpactTolerance
{
get;
private set;
}
public float StrongestImpact
{
get { return strongestImpact; }
@@ -257,6 +263,8 @@ namespace Barotrauma
torsoPosition = ConvertUnits.ToSimUnits(torsoPosition);
torsoAngle = MathHelper.ToRadians(ToolBox.GetAttributeFloat(element, "torsoangle", 0.0f));
ImpactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 50.0f);
CanEnterSubmarine = ToolBox.GetAttributeBool(element, "canentersubmarine", true);
foreach (XElement subElement in element.Elements())
@@ -471,11 +479,11 @@ namespace Barotrauma
{
if (!character.IsRemotePlayer || GameMain.Server != null)
{
if (impact > 8.0f)
if (impact > ImpactTolerance)
{
character.AddDamage(CauseOfDeath.Damage, impact - 8.0f, null);
character.AddDamage(CauseOfDeath.Damage, impact - ImpactTolerance, null);
SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, strongestImpact, collider);
strongestImpact = Math.Max(strongestImpact, impact - 8.0f);
strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance);
}
}
@@ -852,7 +860,6 @@ namespace Barotrauma
//limb.body.ApplyLinearImpulse(impulse);
int n = (int)((limb.Position.X - limbHull.Rect.X) / Hull.WaveWidth);
limbHull.WaveVel[n] = Math.Min(impulse.Y * 1.0f, 5.0f);
StrongestImpact = ((impulse.Length() * 0.5f) - limb.impactTolerance);
}
}
}

View File

@@ -212,9 +212,7 @@ namespace Barotrauma
body.CollisionCategories = Physics.CollisionCharacter;
body.CollidesWith = Physics.CollisionAll & ~Physics.CollisionCharacter & ~Physics.CollisionItem;
}
impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 10.0f);
body.UserData = this;
refJointIndex = -1;