- stunned characters don't move their hands behind their back when cuffed (caused the characters to flail around when someone grabs them)

- characters can run while grabbing/dragging someone
- inventory and chatbox are hidden when stunned
- turret rotation is reset between minRotation and maxRotation when changing the rotation limits
- fixed explosion damage being applied to simPositions of the limbs instead of worldpositions
This commit is contained in:
Regalis
2016-06-09 16:54:30 +03:00
parent 37336095bd
commit d520c00dc9
6 changed files with 31 additions and 16 deletions
@@ -156,6 +156,13 @@ namespace Barotrauma
} }
strongestImpact = 0.0f; strongestImpact = 0.0f;
if (stunTimer > 0)
{
stunTimer -= deltaTime;
return;
}
if (character.LockHands) if (character.LockHands)
{ {
var leftHand = GetLimb(LimbType.LeftHand); var leftHand = GetLimb(LimbType.LeftHand);
@@ -185,14 +192,12 @@ namespace Barotrauma
//rightHand.pullJoint.Enabled = true; //rightHand.pullJoint.Enabled = true;
//rightHand.pullJoint.WorldAnchorB = midPos; //rightHand.pullJoint.WorldAnchorB = midPos;
} }
else
if (stunTimer > 0)
{ {
stunTimer -= deltaTime;
return;
}
if (Anim != Animation.UsingConstruction) ResetPullJoints(); if (Anim != Animation.UsingConstruction) ResetPullJoints();
}
if (SimplePhysicsEnabled) if (SimplePhysicsEnabled)
{ {
@@ -287,7 +292,7 @@ namespace Barotrauma
float slowdownFactor = (float)limbsInWater / (float)Limbs.Count(); float slowdownFactor = (float)limbsInWater / (float)Limbs.Count();
float maxSpeed = Math.Max(TargetMovement.Length() - slowdownFactor, 1.0f); float maxSpeed = Math.Max(TargetMovement.Length() - slowdownFactor, 1.0f);
if (character.SelectedCharacter!=null) maxSpeed = Math.Min(maxSpeed, 1.0f); // if (character.SelectedCharacter!=null) maxSpeed = Math.Min(maxSpeed, 1.0f);
TargetMovement = Vector2.Normalize(TargetMovement) * maxSpeed; TargetMovement = Vector2.Normalize(TargetMovement) * maxSpeed;
} }
@@ -933,10 +938,11 @@ namespace Barotrauma
{ {
pullLimb.pullJoint.Enabled = true; pullLimb.pullJoint.Enabled = true;
pullLimb.pullJoint.WorldAnchorB = targetLimb.SimPosition; pullLimb.pullJoint.WorldAnchorB = targetLimb.SimPosition;
pullLimb.pullJoint.MaxForce = 100.0f; pullLimb.pullJoint.MaxForce = 10000.0f;
targetLimb.pullJoint.Enabled = true; targetLimb.pullJoint.Enabled = true;
targetLimb.pullJoint.WorldAnchorB = pullLimb.SimPosition; targetLimb.pullJoint.WorldAnchorB = pullLimb.SimPosition;
targetLimb.pullJoint.MaxForce = 10000.0f;
} }
} }
+6 -2
View File
@@ -1031,6 +1031,12 @@ namespace Barotrauma
} }
} }
if (controlled == this)
{
Lights.LightManager.ViewTarget = this;
CharacterHUD.Update(deltaTime, this);
}
if (IsUnconscious) if (IsUnconscious)
{ {
UpdateUnconscious(deltaTime); UpdateUnconscious(deltaTime);
@@ -1039,8 +1045,6 @@ namespace Barotrauma
if (controlled == this) if (controlled == this)
{ {
Lights.LightManager.ViewTarget = this;
CharacterHUD.Update(deltaTime,this);
ControlLocalPlayer(deltaTime, cam); ControlLocalPlayer(deltaTime, cam);
} }
+5 -2
View File
@@ -82,7 +82,7 @@ namespace Barotrauma
DrawStatusIcons(spriteBatch, character); DrawStatusIcons(spriteBatch, character);
if (!character.IsUnconscious) if (!character.IsUnconscious && character.Stun <= 0.0f)
{ {
if (character.Inventory != null && !character.LockHands && if (character.Inventory != null && !character.LockHands &&
character.Stun >= -0.1f) character.Inventory.DrawOwn(spriteBatch, Vector2.Zero); character.Stun >= -0.1f) character.Inventory.DrawOwn(spriteBatch, Vector2.Zero);
@@ -193,7 +193,10 @@ namespace Barotrauma
suicideButton.OnClicked = (button, userData) => suicideButton.OnClicked = (button, userData) =>
{ {
character.Kill(character.CauseOfDeath); if (Character.Controlled != null)
{
Character.Controlled.Kill(Character.Controlled.CauseOfDeath);
}
return true; return true;
}; };
} }
@@ -67,6 +67,8 @@ namespace Barotrauma.Items.Components
Vector2 vector = ToolBox.ParseToVector2(value); Vector2 vector = ToolBox.ParseToVector2(value);
minRotation = MathHelper.ToRadians(vector.X); minRotation = MathHelper.ToRadians(vector.X);
maxRotation = MathHelper.ToRadians(vector.Y); maxRotation = MathHelper.ToRadians(vector.Y);
rotation = (minRotation + maxRotation) / 2;
} }
} }
+1 -1
View File
@@ -128,7 +128,7 @@ namespace Barotrauma
if (limb.WorldPosition == worldPosition) continue; if (limb.WorldPosition == worldPosition) continue;
c.AddDamage(limb.SimPosition, DamageType.None, c.AddDamage(limb.WorldPosition, DamageType.None,
damage / c.AnimController.Limbs.Length * distFactor, 0.0f, stun * distFactor, false); damage / c.AnimController.Limbs.Length * distFactor, 0.0f, stun * distFactor, false);
if (force > 0.0f) if (force > 0.0f)
{ {
@@ -306,8 +306,8 @@ namespace Barotrauma.Networking
{ {
if (gameStarted && Screen.Selected == GameMain.GameScreen) if (gameStarted && Screen.Selected == GameMain.GameScreen)
{ {
//chatBox.Visible = Character.Controlled == null || !Character.Controlled.IsUnconscious; chatMsgBox.Visible = Character.Controlled == null ||
chatMsgBox.Visible = Character.Controlled == null || !Character.Controlled.IsUnconscious; (!Character.Controlled.IsUnconscious && Character.Controlled.Stun >= 0.0f);
inGameHUD.Update(deltaTime); inGameHUD.Update(deltaTime);