- added colliders to all monster configs
- disabling monster collider & placing it at mainlimb when stunned/dead/frozen - monsters can't swim above water - misc fixes
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
<ragdoll waveamplitude="150.0" wavelength="10000" swimspeed="4.0" scale="1.5" canentersubmarine="false">
|
||||
|
||||
<collider radius="100"/>
|
||||
|
||||
<!-- body -->
|
||||
<limb id = "0" radius="100" height="470" type="Torso" steerforce="1.0" pullpos="0,250">
|
||||
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="160,0,242,688" depth="0.015" origin="0.5,0.5"/>
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
<sound file="Content/Characters/Scorpion/scorpionidle1.ogg" state="None" />
|
||||
<sound file="Content/Characters/Scorpion/scorpionidle2.ogg" state="None" />
|
||||
|
||||
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="5.0" walkspeed="3.5">
|
||||
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="5.0" walkspeed="3.5" canentersubmarine="false">
|
||||
|
||||
<collider radius ="50"/>
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="50" height="270" type="Head" steerforce="1.0" impacttolerance="50.0">
|
||||
<sprite texture="Content/Characters/Coelanth/coelanth.png" sourcerect="267,171,162,392" depth="0.02" origin ="0.5,0.5"/>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
<ragdoll waveamplitude="100.0" wavelength="1000" speed="1.5" scale ="2.0" flip="false" canentersubmarine="false">
|
||||
|
||||
<collider radius="300"/>
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="300" type="Head" steerforce="3.0">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,478,720,546" depth="0.05"/>
|
||||
@@ -18,27 +20,27 @@
|
||||
</limb>
|
||||
|
||||
<!-- body -->
|
||||
<limb id = "2" radius="300" type="Torso">
|
||||
<limb id = "2" radius="300" type="Torso" steerforce="0.0">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.02" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "3" radius="300" type="Torso">
|
||||
<limb id = "3" radius="300" type="Torso" steerforce="0.0">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.03" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "4" radius="300" type="Tail">
|
||||
<limb id = "4" radius="300" type="Tail" steerforce="0.0">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.04" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "5" radius="300" type="Tail">
|
||||
<limb id = "5" radius="300" type="Tail" steerforce="0.0">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.05" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "6" radius="300" type="Tail">
|
||||
<limb id = "6" radius="300" type="Tail" steerforce="0.0">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="0,0,702,448" depth="0.06" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "7" radius="150" type="Tail">
|
||||
<limb id = "7" radius="150" type="Tail" steerforce="0.0">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="704,0,320,400" depth="0.07" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
|
||||
<ragdoll waveamplitude="50.0" wavelength="500" swimspeed="3.0" walkspeed="0.3" flip="false" canentersubmarine="false">
|
||||
|
||||
<collider radius="50"/>
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="65" type="Head" steerforce="3.0" impacttolerance="100">
|
||||
<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="20" damagetype="blunt" targetforce="80"/>
|
||||
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="10" damagetype="blunt" targetforce="80"/>
|
||||
</limb>
|
||||
|
||||
<!-- body -->
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
|
||||
<ragdoll waveamplitude="0.0" swimspeed="1.0" walkspeed="0.3" flip="false" canentersubmarine="false" rotatetowardsmovement="false">
|
||||
|
||||
<collider radius="80" height="30"/>
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="80" height="30" type="Head" steerforce="3.0" impacttolerance="100">
|
||||
<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="20" damagetype="blunt" targetforce="100"/>
|
||||
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="10" damagetype="blunt" targetforce="100"/>
|
||||
</limb>
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
movementlerp="0.4"
|
||||
legtorque="15.0"
|
||||
thightorque="-5.0"
|
||||
walkspeed="1.5"
|
||||
swimspeed="2.0">
|
||||
|
||||
<collider height="100" radius="15"/>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
footrotation ="180.0"
|
||||
flip="true">
|
||||
|
||||
<collider radius="70"/>
|
||||
<collider radius="60"/>
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="30" height="86" mass = "6" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armor="10.0">
|
||||
|
||||
@@ -8,10 +8,12 @@
|
||||
|
||||
<ragdoll waveamplitude="0.0" swimspeed="1.0" walkspeed="0.3" mirror="true" rotatetowardsmovement="false" headangle="-90">
|
||||
|
||||
<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">
|
||||
<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.2" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
|
||||
<attack range="700" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "1" width="50" height="440" flip="true">
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
<sound file="Content/Characters/Scorpion/scorpionidle1.ogg" state="None" />
|
||||
<sound file="Content/Characters/Scorpion/scorpionidle2.ogg" state="None" />
|
||||
|
||||
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="4.0" walkspeed="3.5">
|
||||
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="4.0" walkspeed="3.5" canentersubmarine="false">
|
||||
|
||||
<collider radius="50" height="320"/>
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="12" height="100" type="Head" steerforce="1.0" impacttolerance="50.0">
|
||||
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="371,15,66,136" depth="0.02" origin ="0.5,0.5"/>
|
||||
|
||||
@@ -3,30 +3,27 @@
|
||||
|
||||
<ragdoll waveamplitude="0.0" swimspeed="0.5" walkspeed="0.3" mirror="true" rotatetowardsmovement="false" headangle="-90">
|
||||
|
||||
<collider radius="100"/>
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" width="350" height="320" type="Head" steerforce="1.0" flip="true" armorsector="0.0,360.0" armorvalue="100.0">
|
||||
<limb id = "0" type="Head" width="350" height="320" steerforce="1.0" flip="true" armorsector="0.0,360.0" armorvalue="100.0">
|
||||
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="0,0,369,348" depth="0.02" origin ="0.5,0.6"/>
|
||||
<attack range="150" duration="0.2" damage="200" stun="5" force="10" damagetype="blunt" targetforce="100"/>
|
||||
<attack range="150" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
|
||||
</limb>
|
||||
|
||||
|
||||
<limb id = "1" radius="50" height="120" flip="true">
|
||||
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="395,0,117,239" depth="0.025" origin="0.5,0.5"/>
|
||||
<lightsource range="200.0" color="0.8,0.8,1.0,1.0">
|
||||
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="391,282,121,230" depth="0.025" origin="0.5,0.5"/>
|
||||
</lightsource>
|
||||
</lightsource>
|
||||
</limb>
|
||||
|
||||
<limb id = "2" width="300" height="119" flip="true">
|
||||
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="0,370,302,142" depth="0.025" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
</limb>
|
||||
|
||||
<joint limb1="0" limb1anchor="60,130" limb2="1" limb2anchor="-30,100" lowerlimit="70" upperlimit="80"/>
|
||||
|
||||
<joint limb1="0" limb1anchor="72,110" limb2="2" limb2anchor="120,-20" lowerlimit="90" upperlimit="180"/>
|
||||
|
||||
|
||||
</ragdoll>
|
||||
|
||||
<ai attackhumans="0.0" attackrooms="0.0" sight="1.0" hearing="0.0" attackwhenprovoked="true"/>
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace Barotrauma
|
||||
private float waveAmplitude;
|
||||
private float waveLength;
|
||||
|
||||
private Limb mainLimb;
|
||||
|
||||
private bool rotateTowardsMovement;
|
||||
|
||||
private bool mirror, flip;
|
||||
@@ -43,16 +45,41 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
rotateTowardsMovement = ToolBox.GetAttributeBool(element, "rotatetowardsmovement", true);
|
||||
|
||||
Limb torso = GetLimb(LimbType.Torso);
|
||||
Limb head = GetLimb(LimbType.Head);
|
||||
|
||||
mainLimb = torso == null ? head : torso;
|
||||
}
|
||||
|
||||
public override void UpdateAnim(float deltaTime)
|
||||
{
|
||||
if (character.IsDead)
|
||||
if (character.IsDead || Frozen || character.IsUnconscious || stunTimer > 0.0f)
|
||||
{
|
||||
UpdateDying(deltaTime);
|
||||
collider.PhysEnabled = false;
|
||||
collider.SetTransform(mainLimb.SimPosition, 0.0f);
|
||||
|
||||
if (stunTimer > 0.0f)
|
||||
{
|
||||
stunTimer -= deltaTime;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//re-enable collider
|
||||
if (!collider.FarseerBody.Enabled)
|
||||
{
|
||||
var lowestLimb = FindLowestLimb();
|
||||
|
||||
collider.SetTransform(new Vector2(
|
||||
collider.SimPosition.X,
|
||||
Math.Max(lowestLimb.SimPosition.Y + (collider.radius + collider.height / 2), collider.SimPosition.Y)),
|
||||
0.0f);
|
||||
|
||||
collider.FarseerBody.Enabled = true;
|
||||
}
|
||||
|
||||
ResetPullJoints();
|
||||
|
||||
if (strongestImpact > 0.0f)
|
||||
@@ -61,22 +88,28 @@ namespace Barotrauma
|
||||
strongestImpact = 0.0f;
|
||||
}
|
||||
|
||||
if (stunTimer>0.0f)
|
||||
|
||||
if (inWater)
|
||||
{
|
||||
stunTimer -= deltaTime;
|
||||
return;
|
||||
collider.FarseerBody.FixedRotation = false;
|
||||
UpdateSineAnim(deltaTime);
|
||||
}
|
||||
else
|
||||
else if (currentHull != null && CanEnterSubmarine)
|
||||
{
|
||||
if (inWater)// || RefLimb.inWater)
|
||||
if (Math.Abs(MathUtils.GetShortestAngle(collider.Rotation, 0.0f)) > 0.001f)
|
||||
{
|
||||
UpdateSineAnim(deltaTime);
|
||||
//rotate collider back upright
|
||||
collider.AngularVelocity = MathUtils.GetShortestAngle(collider.Rotation, 0.0f) * 60.0f;
|
||||
collider.FarseerBody.FixedRotation = false;
|
||||
}
|
||||
else if (currentHull != null && CanEnterSubmarine)
|
||||
else
|
||||
{
|
||||
UpdateWalkAnim(deltaTime);
|
||||
collider.FarseerBody.FixedRotation = true;
|
||||
}
|
||||
|
||||
UpdateWalkAnim(deltaTime);
|
||||
}
|
||||
|
||||
|
||||
if (mirror || !inWater)
|
||||
{
|
||||
@@ -136,8 +169,6 @@ namespace Barotrauma
|
||||
Limb torso = GetLimb(LimbType.Torso);
|
||||
Limb head = GetLimb(LimbType.Head);
|
||||
|
||||
Limb mainLimb = torso == null ? head : torso;
|
||||
|
||||
mainLimb.pullJoint.Enabled = true;
|
||||
mainLimb.pullJoint.WorldAnchorB = collider.SimPosition;
|
||||
|
||||
@@ -145,12 +176,24 @@ namespace Barotrauma
|
||||
|
||||
float movementAngle = MathUtils.VectorToAngle(movement) - MathHelper.PiOver2;
|
||||
|
||||
float angle = (rotateTowardsMovement) ?
|
||||
mainLimb.body.Rotation + MathUtils.GetShortestAngle(mainLimb.body.Rotation, movementAngle) :
|
||||
HeadAngle * Dir;
|
||||
|
||||
if (rotateTowardsMovement)
|
||||
{
|
||||
collider.SmoothRotate(movementAngle, 25.0f);
|
||||
mainLimb.body.SmoothRotate(movementAngle, 25.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
collider.SmoothRotate(HeadAngle * Dir, 25.0f);
|
||||
mainLimb.body.SmoothRotate(HeadAngle * Dir, 25.0f);
|
||||
}
|
||||
|
||||
//float angle = (rotateTowardsMovement) ?
|
||||
// mainLimb.body.Rotation + MathUtils.GetShortestAngle(mainLimb.body.Rotation, movementAngle) :
|
||||
// HeadAngle * Dir;
|
||||
|
||||
collider.SmoothRotate(angle, 25.0f);
|
||||
mainLimb.body.SmoothRotate(angle, 25.0f);
|
||||
//collider.SmoothRotate(angle, 25.0f);
|
||||
//mainLimb.body.SmoothRotate(angle, 25.0f);
|
||||
|
||||
Limb tail = GetLimb(LimbType.Tail);
|
||||
if (tail != null && waveAmplitude > 0.0f)
|
||||
@@ -166,9 +209,7 @@ namespace Barotrauma
|
||||
for (int i = 0; i < Limbs.Count(); i++)
|
||||
{
|
||||
Vector2 pullPos = Limbs[i].pullJoint == null ? Limbs[i].SimPosition : Limbs[i].pullJoint.WorldAnchorA;
|
||||
Limbs[i].body.ApplyForce(movement * Limbs[i].SteerForce * Limbs[i].Mass, pullPos);
|
||||
|
||||
|
||||
Limbs[i].body.ApplyForce(movement * Limbs[i].SteerForce * Limbs[i].Mass, pullPos);
|
||||
|
||||
if (Limbs[i] == mainLimb) continue;
|
||||
|
||||
@@ -191,26 +232,18 @@ namespace Barotrauma
|
||||
|
||||
IgnorePlatforms = (TargetMovement.Y < -Math.Abs(TargetMovement.X));
|
||||
|
||||
Limb mainLimb;
|
||||
float mainLimbHeight, mainLimbAngle;
|
||||
|
||||
Limb torso = GetLimb(LimbType.Torso);
|
||||
Limb head = GetLimb(LimbType.Head);
|
||||
|
||||
if (torso != null)
|
||||
if (mainLimb.type == LimbType.Torso)
|
||||
{
|
||||
mainLimb = torso;
|
||||
mainLimbHeight = TorsoPosition;
|
||||
mainLimbAngle = torsoAngle;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainLimb = head;
|
||||
mainLimbHeight = HeadPosition;
|
||||
mainLimbAngle = headAngle;
|
||||
}
|
||||
|
||||
//collider.SmoothRotate(TorsoAngle * Dir, 10.0f);
|
||||
mainLimb.body.SmoothRotate(mainLimbAngle * Dir, 50.0f);
|
||||
|
||||
collider.LinearVelocity = new Vector2(
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace Barotrauma
|
||||
{
|
||||
collider.PhysEnabled = false;
|
||||
|
||||
var lowestLimb = FindLowestLimb();
|
||||
collider.SetTransform(GetLimb(LimbType.Torso).SimPosition, 0.0f);
|
||||
|
||||
if (stunTimer > 0)
|
||||
@@ -106,6 +105,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (Math.Abs(MathUtils.GetShortestAngle(collider.Rotation, 0.0f)) > 0.001f)
|
||||
{
|
||||
//rotate collider back upright
|
||||
collider.AngularVelocity = MathUtils.GetShortestAngle(collider.Rotation, 0.0f) * 60.0f;
|
||||
collider.FarseerBody.FixedRotation = false;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ namespace Barotrauma
|
||||
if (onGround)
|
||||
{
|
||||
collider.LinearVelocity = new Vector2(
|
||||
movement.X * 1.5f,
|
||||
movement.X,
|
||||
collider.LinearVelocity.Y > 0.0f ? collider.LinearVelocity.Y * 0.5f : collider.LinearVelocity.Y);
|
||||
}
|
||||
|
||||
@@ -329,12 +329,12 @@ namespace Barotrauma
|
||||
if (stairs != null)
|
||||
{
|
||||
torso.pullJoint.WorldAnchorB = new Vector2(
|
||||
MathHelper.SmoothStep(torso.SimPosition.X, footMid + movement.X * 0.35f, getUpSpeed * 0.8f),
|
||||
MathHelper.SmoothStep(torso.SimPosition.X, footMid + movement.X * 0.25f, getUpSpeed * 0.8f),
|
||||
MathHelper.SmoothStep(torso.SimPosition.Y, colliderPos.Y + TorsoPosition - Math.Abs(walkPosX * 0.05f), getUpSpeed * 2.0f));
|
||||
|
||||
|
||||
head.pullJoint.WorldAnchorB = new Vector2(
|
||||
MathHelper.SmoothStep(head.SimPosition.X, footMid + movement.X * (Crouching ? 1.0f : 0.4f), getUpSpeed * 0.8f),
|
||||
MathHelper.SmoothStep(head.SimPosition.X, footMid + movement.X * (Crouching ? 0.6f : 0.25f), getUpSpeed * 0.8f),
|
||||
MathHelper.SmoothStep(head.SimPosition.Y, colliderPos.Y + HeadPosition - Math.Abs(walkPosX * 0.05f), getUpSpeed * 2.0f));
|
||||
|
||||
waist.pullJoint.WorldAnchorB = waist.SimPosition;// +movement * 0.3f;
|
||||
@@ -345,13 +345,13 @@ namespace Barotrauma
|
||||
|
||||
torso.pullJoint.WorldAnchorB =
|
||||
MathUtils.SmoothStep(torso.SimPosition,
|
||||
new Vector2(footMid + movement.X * 0.3f, colliderPos.Y + TorsoPosition), getUpSpeed);
|
||||
new Vector2(footMid + movement.X * 0.2f, colliderPos.Y + TorsoPosition), getUpSpeed);
|
||||
|
||||
head.pullJoint.WorldAnchorB =
|
||||
MathUtils.SmoothStep(head.SimPosition,
|
||||
new Vector2(footMid + movement.X * (Crouching && Math.Sign(movement.X) == Math.Sign(Dir) ? 1.0f : 0.3f), colliderPos.Y + HeadPosition), getUpSpeed * 1.2f);
|
||||
new Vector2(footMid + movement.X * (Crouching && Math.Sign(movement.X) == Math.Sign(Dir) ? 0.6f : 0.2f), colliderPos.Y + HeadPosition), getUpSpeed * 1.2f);
|
||||
|
||||
waist.pullJoint.WorldAnchorB = waist.SimPosition + movement * 0.1f;
|
||||
waist.pullJoint.WorldAnchorB = waist.SimPosition + movement * 0.06f;
|
||||
}
|
||||
|
||||
if (!onGround)
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace Barotrauma
|
||||
|
||||
foreach (Limb l in Limbs)
|
||||
{
|
||||
l.body.PhysEnabled = frozen;
|
||||
l.body.PhysEnabled = !frozen;
|
||||
}
|
||||
collider.PhysEnabled = frozen;
|
||||
collider.PhysEnabled = !frozen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,18 +238,17 @@ namespace Barotrauma
|
||||
|
||||
float scale = ToolBox.GetAttributeFloat(element, "scale", 1.0f);
|
||||
|
||||
//int limbAmount = ;
|
||||
Limbs = new Limb[element.Elements("limb").Count()];
|
||||
limbJoints = new RevoluteJoint[element.Elements("joint").Count()];
|
||||
limbDictionary = new Dictionary<LimbType, Limb>();
|
||||
|
||||
headPosition = ToolBox.GetAttributeFloat(element, "headposition", 50.0f);
|
||||
headPosition = ConvertUnits.ToSimUnits(headPosition);
|
||||
headAngle = MathHelper.ToRadians(ToolBox.GetAttributeFloat(element, "headangle", 0.0f));
|
||||
headPosition = ToolBox.GetAttributeFloat(element, "headposition", 50.0f);
|
||||
headPosition = ConvertUnits.ToSimUnits(headPosition);
|
||||
headAngle = MathHelper.ToRadians(ToolBox.GetAttributeFloat(element, "headangle", 0.0f));
|
||||
|
||||
torsoPosition = ToolBox.GetAttributeFloat(element, "torsoposition", 50.0f);
|
||||
torsoPosition = ConvertUnits.ToSimUnits(torsoPosition);
|
||||
torsoAngle = MathHelper.ToRadians(ToolBox.GetAttributeFloat(element, "torsoangle", 0.0f));
|
||||
torsoPosition = ToolBox.GetAttributeFloat(element, "torsoposition", 50.0f);
|
||||
torsoPosition = ConvertUnits.ToSimUnits(torsoPosition);
|
||||
torsoAngle = MathHelper.ToRadians(ToolBox.GetAttributeFloat(element, "torsoangle", 0.0f));
|
||||
|
||||
CanEnterSubmarine = ToolBox.GetAttributeBool(element, "canentersubmarine", true);
|
||||
|
||||
@@ -499,10 +498,10 @@ namespace Barotrauma
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f);
|
||||
}
|
||||
|
||||
limb.body.DebugDraw(spriteBatch, character.Submarine == null ? Color.Cyan : Color.White);
|
||||
limb.body.DebugDraw(spriteBatch, inWater ? Color.Cyan : Color.White);
|
||||
}
|
||||
|
||||
collider.DebugDraw(spriteBatch, character.Submarine == null ? Color.Cyan : Color.White);
|
||||
|
||||
collider.DebugDraw(spriteBatch, inWater ? Color.SkyBlue : Color.Gray);
|
||||
|
||||
foreach (RevoluteJoint joint in limbJoints)
|
||||
{
|
||||
@@ -737,11 +736,12 @@ namespace Barotrauma
|
||||
inWater = false;
|
||||
headInWater = false;
|
||||
|
||||
var colliderB = GetColliderBottom().Y;
|
||||
float surf = ConvertUnits.ToSimUnits(currentHull.Surface);
|
||||
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
|
||||
|
||||
float floorY = GetFloorY();
|
||||
|
||||
if (currentHull.Volume > currentHull.FullVolume * 0.95f ||
|
||||
ConvertUnits.ToSimUnits(currentHull.Surface) - GetFloorY() > HeadPosition * 0.95f)
|
||||
(waterSurface - floorY > HeadPosition * 0.95f && collider.SimPosition.Y < waterSurface))
|
||||
inWater = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -557,14 +557,9 @@ namespace Barotrauma
|
||||
{
|
||||
AnimController = new FishAnimController(this, doc.Root.Element("ragdoll"));
|
||||
PressureProtection = 100.0f;
|
||||
//FishAnimController fishAnim = (FishAnimController)animController;
|
||||
}
|
||||
|
||||
AnimController.SetPosition(ConvertUnits.ToSimUnits(position));
|
||||
foreach (Limb limb in AnimController.Limbs)
|
||||
{
|
||||
limb.body.SetTransform(ConvertUnits.ToSimUnits(position)+limb.SimPosition, 0.0f);
|
||||
}
|
||||
|
||||
maxHealth = ToolBox.GetAttributeFloat(doc.Root, "health", 100.0f);
|
||||
health = maxHealth;
|
||||
@@ -766,7 +761,7 @@ namespace Barotrauma
|
||||
if (length > 0.0f) targetMovement = targetMovement / length;
|
||||
}
|
||||
|
||||
if (Math.Sign(targetMovement.X) == Math.Sign(AnimController.Dir) && IsKeyDown(InputType.Run))
|
||||
if (Math.Sign(targetMovement.X) != -Math.Sign(AnimController.Dir) && IsKeyDown(InputType.Run))
|
||||
targetMovement *= 3.0f;
|
||||
|
||||
targetMovement *= SpeedMultiplier;
|
||||
|
||||
@@ -432,7 +432,7 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 normal = Vector2.Normalize(Body.Position - limb.SimPosition);
|
||||
|
||||
float impact = Math.Min(Vector2.Dot(Velocity - limb.LinearVelocity, -normal), 5.0f);
|
||||
float impact = Math.Min(Vector2.Dot(Velocity - limb.LinearVelocity, -normal), 50.0f) / 5.0f;
|
||||
|
||||
ApplyImpact(impact * Math.Min(limb.Mass / 200.0f, 1), -normal, contact);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user