Merge pull request #81 from Crystalwarrior/ragdollbutton
Adds ragdoll button. Because why not.
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
float volume = Math.Min(impact - 3.0f, 1.0f);
|
float volume = Math.Min(impact - 3.0f, 1.0f);
|
||||||
|
|
||||||
if (body.UserData is Limb)
|
if (body.UserData is Limb && character.Stun <= 0f)
|
||||||
{
|
{
|
||||||
Limb limb = (Limb)body.UserData;
|
Limb limb = (Limb)body.UserData;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ namespace Barotrauma
|
|||||||
limb.HitSound.Play(volume, impact * 100.0f, limb.WorldPosition);
|
limb.HitSound.Play(volume, impact * 100.0f, limb.WorldPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (body == Collider.FarseerBody)
|
else if (body.UserData is Limb || body == Collider.FarseerBody)
|
||||||
{
|
{
|
||||||
if (!character.IsRemotePlayer || GameMain.Server != null)
|
if (!character.IsRemotePlayer || GameMain.Server != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,6 +109,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
TransformCursorPos();
|
TransformCursorPos();
|
||||||
}
|
}
|
||||||
|
bool ragdollInput = msg.ReadBoolean();
|
||||||
|
keys[(int)InputType.Ragdoll].Held = ragdollInput;
|
||||||
|
keys[(int)InputType.Ragdoll].SetState(false, ragdollInput);
|
||||||
|
|
||||||
facingRight = msg.ReadBoolean();
|
facingRight = msg.ReadBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +127,7 @@ namespace Barotrauma
|
|||||||
if (selectedEntity is Character)
|
if (selectedEntity is Character)
|
||||||
{
|
{
|
||||||
bool doingCpr = msg.ReadBoolean();
|
bool doingCpr = msg.ReadBoolean();
|
||||||
if (doingCpr && selectedCharacter != null)
|
if (doingCpr && SelectedCharacter != null)
|
||||||
{
|
{
|
||||||
animation = AnimController.Animation.CPR;
|
animation = AnimController.Animation.CPR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,14 +259,14 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (character == null) return false;
|
if (character == null) return false;
|
||||||
|
|
||||||
GUIComponent existingFrame = crewList.Parent.FindChild("selectedcharacter");
|
GUIComponent existingFrame = crewList.Parent.FindChild("SelectedCharacter");
|
||||||
if (existingFrame != null) crewList.Parent.RemoveChild(existingFrame);
|
if (existingFrame != null) crewList.Parent.RemoveChild(existingFrame);
|
||||||
|
|
||||||
var previewPlayer = new GUIFrame(
|
var previewPlayer = new GUIFrame(
|
||||||
new Rectangle(0, 0, 230, 300),
|
new Rectangle(0, 0, 230, 300),
|
||||||
new Color(0.0f, 0.0f, 0.0f, 0.8f), Alignment.TopRight, "", crewList.Parent);
|
new Color(0.0f, 0.0f, 0.0f, 0.8f), Alignment.TopRight, "", crewList.Parent);
|
||||||
previewPlayer.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
previewPlayer.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
previewPlayer.UserData = "selectedcharacter";
|
previewPlayer.UserData = "SelectedCharacter";
|
||||||
|
|
||||||
character.Info.CreateInfoFrame(previewPlayer);
|
character.Info.CreateInfoFrame(previewPlayer);
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float getUpSpeed = 0.3f;
|
float getUpSpeed = 0.3f;
|
||||||
float walkCycleSpeed = movement.X * walkAnimSpeed;
|
float walkCycleSpeed = movement.X * walkAnimSpeed;
|
||||||
if (stairs != null)
|
if (Stairs != null)
|
||||||
{
|
{
|
||||||
TargetMovement = new Vector2(MathHelper.Clamp(TargetMovement.X, -1.5f, 1.5f), TargetMovement.Y);
|
TargetMovement = new Vector2(MathHelper.Clamp(TargetMovement.X, -1.5f, 1.5f), TargetMovement.Y);
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ namespace Barotrauma
|
|||||||
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f));
|
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f));
|
||||||
bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
|
bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
|
||||||
|
|
||||||
if (stairs != null || onSlope)
|
if (Stairs != null || onSlope)
|
||||||
{
|
{
|
||||||
torso.pullJoint.WorldAnchorB = new Vector2(
|
torso.pullJoint.WorldAnchorB = new Vector2(
|
||||||
MathHelper.SmoothStep(torso.SimPosition.X, footMid + movement.X * 0.25f, getUpSpeed * 0.8f),
|
MathHelper.SmoothStep(torso.SimPosition.X, footMid + movement.X * 0.25f, getUpSpeed * 0.8f),
|
||||||
@@ -382,7 +382,7 @@ namespace Barotrauma
|
|||||||
Vector2 footPos = stepSize * -i;
|
Vector2 footPos = stepSize * -i;
|
||||||
if (stepSize.Y < 0.0f) stepSize.Y = -0.15f;
|
if (stepSize.Y < 0.0f) stepSize.Y = -0.15f;
|
||||||
|
|
||||||
if (onSlope && stairs == null)
|
if (onSlope && Stairs == null)
|
||||||
{
|
{
|
||||||
footPos.Y *= 2.0f;
|
footPos.Y *= 2.0f;
|
||||||
}
|
}
|
||||||
@@ -462,7 +462,7 @@ namespace Barotrauma
|
|||||||
footPos = new Vector2(GetCenterOfMass().X + stepSize.X * i * 0.2f, colliderPos.Y - 0.1f);
|
footPos = new Vector2(GetCenterOfMass().X + stepSize.X * i * 0.2f, colliderPos.Y - 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stairs == null)
|
if (Stairs == null)
|
||||||
{
|
{
|
||||||
footPos.Y = Math.Max(Math.Min(floorPos, footPos.Y + 0.5f), footPos.Y);
|
footPos.Y = Math.Max(Math.Min(floorPos, footPos.Y + 0.5f), footPos.Y);
|
||||||
}
|
}
|
||||||
@@ -987,7 +987,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if on stairs, make the dragged character "climb up" (= collide with stairs)
|
//if on stairs, make the dragged character "climb up" (= collide with stairs)
|
||||||
if (stairs != null) target.AnimController.TargetMovement = new Vector2 (target.AnimController.TargetMovement.X, 1.0f);
|
//if (Stairs != null) target.AnimController.TargetMovement = new Vector2 (target.AnimController.TargetMovement.X, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Grab(Vector2 rightHandPos, Vector2 leftHandPos)
|
public void Grab(Vector2 rightHandPos, Vector2 leftHandPos)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
protected float colliderHeightFromFloor;
|
protected float colliderHeightFromFloor;
|
||||||
|
|
||||||
protected Structure stairs;
|
public Structure Stairs;
|
||||||
|
|
||||||
protected Direction dir;
|
protected Direction dir;
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else if (structure.StairDirection != Direction.None)
|
else if (structure.StairDirection != Direction.None)
|
||||||
{
|
{
|
||||||
stairs = null;
|
Stairs = null;
|
||||||
|
|
||||||
//don't collider with stairs if
|
//don't collider with stairs if
|
||||||
|
|
||||||
@@ -476,7 +476,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//---------------
|
//---------------
|
||||||
|
|
||||||
stairs = structure;
|
//set stairs to that of the one dragging us
|
||||||
|
if (character.SelectedBy != null)
|
||||||
|
Stairs = character.SelectedBy.AnimController.Stairs;
|
||||||
|
else
|
||||||
|
Stairs = structure;
|
||||||
|
|
||||||
|
if (Stairs == null)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculateImpact(f1, f2, contact);
|
CalculateImpact(f1, f2, contact);
|
||||||
@@ -504,10 +511,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ImpactProjSpecific(impact,f1.Body);
|
ImpactProjSpecific(impact,f1.Body);
|
||||||
|
|
||||||
if (f1.Body.UserData is Limb)
|
if ((f1.Body.UserData is Limb && character.Stun > 0f) || f1.Body == Collider.FarseerBody)
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (f1.Body == Collider.FarseerBody)
|
|
||||||
{
|
{
|
||||||
if (!character.IsRemotePlayer || GameMain.Server != null)
|
if (!character.IsRemotePlayer || GameMain.Server != null)
|
||||||
{
|
{
|
||||||
@@ -898,8 +902,8 @@ namespace Barotrauma
|
|||||||
limb.Update(deltaTime);
|
limb.Update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool onStairs = stairs != null;
|
bool onStairs = Stairs != null;
|
||||||
stairs = null;
|
Stairs = null;
|
||||||
|
|
||||||
var contacts = Collider.FarseerBody.ContactList;
|
var contacts = Collider.FarseerBody.ContactList;
|
||||||
while (Collider.FarseerBody.Enabled && contacts != null && contacts.Contact != null)
|
while (Collider.FarseerBody.Enabled && contacts != null && contacts.Contact != null)
|
||||||
@@ -917,7 +921,7 @@ namespace Barotrauma
|
|||||||
Structure structure = contacts.Contact.FixtureA.Body.UserData as Structure;
|
Structure structure = contacts.Contact.FixtureA.Body.UserData as Structure;
|
||||||
if (structure != null && onStairs)
|
if (structure != null && onStairs)
|
||||||
{
|
{
|
||||||
stairs = structure;
|
Stairs = structure;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -966,7 +970,7 @@ namespace Barotrauma
|
|||||||
rayEnd.Y -= Collider.height * 0.5f + Collider.radius + colliderHeightFromFloor*1.2f;
|
rayEnd.Y -= Collider.height * 0.5f + Collider.radius + colliderHeightFromFloor*1.2f;
|
||||||
|
|
||||||
Vector2 colliderBottomDisplay = ConvertUnits.ToDisplayUnits(GetColliderBottom());
|
Vector2 colliderBottomDisplay = ConvertUnits.ToDisplayUnits(GetColliderBottom());
|
||||||
if (!inWater && !character.IsDead && !character.IsUnconscious && levitatingCollider && Collider.LinearVelocity.Y>-ImpactTolerance)
|
if (!inWater && !character.IsDead && character.Stun <= 0f && levitatingCollider && Collider.LinearVelocity.Y>-ImpactTolerance)
|
||||||
{
|
{
|
||||||
float closestFraction = 1.0f;
|
float closestFraction = 1.0f;
|
||||||
Fixture closestFixture = null;
|
Fixture closestFixture = null;
|
||||||
@@ -978,6 +982,7 @@ namespace Barotrauma
|
|||||||
Structure structure = fixture.Body.UserData as Structure;
|
Structure structure = fixture.Body.UserData as Structure;
|
||||||
if (inWater && targetMovement.Y < 0.5f) return -1;
|
if (inWater && targetMovement.Y < 0.5f) return -1;
|
||||||
if (colliderBottomDisplay.Y < structure.Rect.Y - structure.Rect.Height + 30 && TargetMovement.Y < 0.5f) return -1;
|
if (colliderBottomDisplay.Y < structure.Rect.Y - structure.Rect.Height + 30 && TargetMovement.Y < 0.5f) return -1;
|
||||||
|
if (character.SelectedBy != null) return -1;
|
||||||
break;
|
break;
|
||||||
case Physics.CollisionPlatform:
|
case Physics.CollisionPlatform:
|
||||||
Structure platform = fixture.Body.UserData as Structure;
|
Structure platform = fixture.Body.UserData as Structure;
|
||||||
@@ -1007,7 +1012,7 @@ namespace Barotrauma
|
|||||||
switch (closestFixture.CollisionCategories)
|
switch (closestFixture.CollisionCategories)
|
||||||
{
|
{
|
||||||
case Physics.CollisionStairs:
|
case Physics.CollisionStairs:
|
||||||
stairs = closestFixture.Body.UserData as Structure;
|
Stairs = closestFixture.Body.UserData as Structure;
|
||||||
onStairs = true;
|
onStairs = true;
|
||||||
forceImmediate = true;
|
forceImmediate = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace Barotrauma
|
|||||||
protected float minHealth, maxHealth;
|
protected float minHealth, maxHealth;
|
||||||
|
|
||||||
protected Item focusedItem;
|
protected Item focusedItem;
|
||||||
private Character focusedCharacter, selectedCharacter;
|
private Character focusedCharacter, selectedCharacter, selectedBy;
|
||||||
|
|
||||||
private bool isDead;
|
private bool isDead;
|
||||||
private CauseOfDeath lastAttackCauseOfDeath;
|
private CauseOfDeath lastAttackCauseOfDeath;
|
||||||
@@ -204,6 +204,27 @@ namespace Barotrauma
|
|||||||
public Character SelectedCharacter
|
public Character SelectedCharacter
|
||||||
{
|
{
|
||||||
get { return selectedCharacter; }
|
get { return selectedCharacter; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (selectedCharacter != null)
|
||||||
|
selectedCharacter.selectedBy = null;
|
||||||
|
selectedCharacter = value;
|
||||||
|
if (selectedCharacter != null)
|
||||||
|
selectedCharacter.selectedBy = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Character SelectedBy
|
||||||
|
{
|
||||||
|
get { return selectedBy; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (selectedBy != null)
|
||||||
|
selectedBy.selectedCharacter = null;
|
||||||
|
selectedBy = value;
|
||||||
|
if (selectedBy != null)
|
||||||
|
selectedBy.selectedCharacter = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float lowPassMultiplier;
|
private float lowPassMultiplier;
|
||||||
@@ -246,6 +267,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsRagdolled;
|
||||||
|
public bool IsForceRagdolled;
|
||||||
|
|
||||||
public bool IsUnconscious
|
public bool IsUnconscious
|
||||||
{
|
{
|
||||||
get { return (needsAir && oxygen <= 0.0f) || health <= 0.0f; }
|
get { return (needsAir && oxygen <= 0.0f) || health <= 0.0f; }
|
||||||
@@ -661,6 +685,8 @@ namespace Barotrauma
|
|||||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
||||||
case InputType.Use:
|
case InputType.Use:
|
||||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
||||||
|
case InputType.Ragdoll:
|
||||||
|
return !(dequeuedInput.HasFlag(InputType.Ragdoll)) && (prevDequeuedInput.HasFlag(InputType.Ragdoll));
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -695,6 +721,8 @@ namespace Barotrauma
|
|||||||
return dequeuedInput.HasFlag(InputNetFlags.Use);
|
return dequeuedInput.HasFlag(InputNetFlags.Use);
|
||||||
case InputType.Attack:
|
case InputType.Attack:
|
||||||
return dequeuedInput.HasFlag(InputNetFlags.Attack);
|
return dequeuedInput.HasFlag(InputNetFlags.Attack);
|
||||||
|
case InputType.Ragdoll:
|
||||||
|
return dequeuedInput.HasFlag(InputNetFlags.Ragdoll);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -765,7 +793,7 @@ namespace Barotrauma
|
|||||||
// - dragging someone
|
// - dragging someone
|
||||||
// - crouching
|
// - crouching
|
||||||
// - moving backwards
|
// - moving backwards
|
||||||
if (selectedCharacter == null &&
|
if (SelectedCharacter == null &&
|
||||||
(!(AnimController is HumanoidAnimController) || !((HumanoidAnimController)AnimController).Crouching) &&
|
(!(AnimController is HumanoidAnimController) || !((HumanoidAnimController)AnimController).Crouching) &&
|
||||||
Math.Sign(targetMovement.X) != -Math.Sign(AnimController.Dir))
|
Math.Sign(targetMovement.X) != -Math.Sign(AnimController.Dir))
|
||||||
{
|
{
|
||||||
@@ -912,9 +940,9 @@ namespace Barotrauma
|
|||||||
if (selectedConstruction != null && IsKeyDown(InputType.Aim)) selectedConstruction.SecondaryUse(deltaTime, this);
|
if (selectedConstruction != null && IsKeyDown(InputType.Aim)) selectedConstruction.SecondaryUse(deltaTime, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedCharacter != null)
|
if (SelectedCharacter != null)
|
||||||
{
|
{
|
||||||
if (Vector2.DistanceSquared(selectedCharacter.WorldPosition, WorldPosition) > 90000.0f || !selectedCharacter.CanBeSelected)
|
if (Vector2.DistanceSquared(SelectedCharacter.WorldPosition, WorldPosition) > 90000.0f || !SelectedCharacter.CanBeSelected)
|
||||||
{
|
{
|
||||||
DeselectCharacter();
|
DeselectCharacter();
|
||||||
}
|
}
|
||||||
@@ -986,7 +1014,7 @@ namespace Barotrauma
|
|||||||
var owner = (Character)inventory.Owner;
|
var owner = (Character)inventory.Owner;
|
||||||
|
|
||||||
//can only be accessed if the character is incapacitated and has been selected
|
//can only be accessed if the character is incapacitated and has been selected
|
||||||
return selectedCharacter == owner && (!owner.CanInteract);
|
return SelectedCharacter == owner && (!owner.CanInteract);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory.Owner is Item)
|
if (inventory.Owner is Item)
|
||||||
@@ -1215,22 +1243,22 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (character == null) return;
|
if (character == null) return;
|
||||||
|
|
||||||
selectedCharacter = character;
|
SelectedCharacter = character;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeselectCharacter()
|
public void DeselectCharacter()
|
||||||
{
|
{
|
||||||
if (selectedCharacter == null) return;
|
if (SelectedCharacter == null) return;
|
||||||
|
|
||||||
if (SelectedCharacter.AnimController != null)
|
if (SelectedCharacter.AnimController != null)
|
||||||
{
|
{
|
||||||
foreach (Limb limb in selectedCharacter.AnimController.Limbs)
|
foreach (Limb limb in SelectedCharacter.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
if (limb.pullJoint != null) limb.pullJoint.Enabled = false;
|
if (limb.pullJoint != null) limb.pullJoint.Enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedCharacter = null;
|
SelectedCharacter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoInteractionUpdate(float deltaTime, Vector2 mouseSimPos)
|
public void DoInteractionUpdate(float deltaTime, Vector2 mouseSimPos)
|
||||||
@@ -1243,7 +1271,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!CanInteract)
|
if (!CanInteract)
|
||||||
{
|
{
|
||||||
if (selectedCharacter != null)
|
if (SelectedCharacter != null)
|
||||||
{
|
{
|
||||||
DeselectCharacter();
|
DeselectCharacter();
|
||||||
}
|
}
|
||||||
@@ -1276,7 +1304,7 @@ namespace Barotrauma
|
|||||||
findFocusedTimer -= deltaTime;
|
findFocusedTimer -= deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedCharacter != null && IsKeyHit(InputType.Select))
|
if (SelectedCharacter != null && IsKeyHit(InputType.Select))
|
||||||
{
|
{
|
||||||
DeselectCharacter();
|
DeselectCharacter();
|
||||||
}
|
}
|
||||||
@@ -1436,6 +1464,21 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsForceRagdolled)
|
||||||
|
IsRagdolled = IsForceRagdolled;
|
||||||
|
else if (!IsRagdolled || AnimController.Collider.LinearVelocity.Length() < 1f) //Keep us ragdolled if we were forced or we're too speedy to unragdoll
|
||||||
|
IsRagdolled = IsKeyDown(InputType.Ragdoll); //Handle this here instead of Control because we can stop being ragdolled ourselves
|
||||||
|
|
||||||
|
if (IsRagdolled)
|
||||||
|
{
|
||||||
|
((HumanoidAnimController)AnimController).Crouching = false;
|
||||||
|
Stun = Math.Max(0.1f, Stun);
|
||||||
|
|
||||||
|
AnimController.ResetPullJoints();
|
||||||
|
selectedConstruction = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Control(deltaTime, cam);
|
Control(deltaTime, cam);
|
||||||
if (controlled != this && (!(this is AICharacter) || IsRemotePlayer))
|
if (controlled != this && (!(this is AICharacter) || IsRemotePlayer))
|
||||||
{
|
{
|
||||||
@@ -1448,9 +1491,9 @@ namespace Barotrauma
|
|||||||
selectedConstruction = null;
|
selectedConstruction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedCharacter != null && AnimController.Anim == AnimController.Animation.CPR)
|
if (SelectedCharacter != null && AnimController.Anim == AnimController.Animation.CPR)
|
||||||
{
|
{
|
||||||
if (GameMain.Client == null) selectedCharacter.Oxygen += (GetSkillLevel("Medical") / 10.0f) * deltaTime;
|
if (GameMain.Client == null) SelectedCharacter.Oxygen += (GetSkillLevel("Medical") / 10.0f) * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateSightRange();
|
UpdateSightRange();
|
||||||
@@ -1839,7 +1882,7 @@ namespace Barotrauma
|
|||||||
foreach (Character c in CharacterList)
|
foreach (Character c in CharacterList)
|
||||||
{
|
{
|
||||||
if (c.focusedCharacter == this) c.focusedCharacter = null;
|
if (c.focusedCharacter == this) c.focusedCharacter = null;
|
||||||
if (c.selectedCharacter == this) c.selectedCharacter = null;
|
if (c.SelectedCharacter == this) c.SelectedCharacter = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
partial void DisposeProjSpecific();
|
partial void DisposeProjSpecific();
|
||||||
|
|||||||
@@ -52,8 +52,9 @@ namespace Barotrauma
|
|||||||
Use = 0x100,
|
Use = 0x100,
|
||||||
Aim = 0x200,
|
Aim = 0x200,
|
||||||
Attack = 0x400,
|
Attack = 0x400,
|
||||||
|
Ragdoll = 0x800,
|
||||||
|
|
||||||
MaxVal = 0x7FF
|
MaxVal = 0xFFF
|
||||||
}
|
}
|
||||||
private InputNetFlags dequeuedInput = 0;
|
private InputNetFlags dequeuedInput = 0;
|
||||||
private InputNetFlags prevDequeuedInput = 0;
|
private InputNetFlags prevDequeuedInput = 0;
|
||||||
@@ -192,7 +193,7 @@ namespace Barotrauma
|
|||||||
SimPosition,
|
SimPosition,
|
||||||
LastNetworkUpdateID,
|
LastNetworkUpdateID,
|
||||||
AnimController.TargetDir,
|
AnimController.TargetDir,
|
||||||
selectedCharacter == null ? (Entity)selectedConstruction : (Entity)selectedCharacter,
|
SelectedCharacter == null ? (Entity)selectedConstruction : (Entity)SelectedCharacter,
|
||||||
AnimController.Anim);
|
AnimController.Anim);
|
||||||
|
|
||||||
memLocalState.Add(posInfo);
|
memLocalState.Add(posInfo);
|
||||||
@@ -208,6 +209,7 @@ namespace Barotrauma
|
|||||||
if (IsKeyDown(InputType.Use)) newInput |= InputNetFlags.Use;
|
if (IsKeyDown(InputType.Use)) newInput |= InputNetFlags.Use;
|
||||||
if (IsKeyDown(InputType.Aim)) newInput |= InputNetFlags.Aim;
|
if (IsKeyDown(InputType.Aim)) newInput |= InputNetFlags.Aim;
|
||||||
if (IsKeyDown(InputType.Attack)) newInput |= InputNetFlags.Attack;
|
if (IsKeyDown(InputType.Attack)) newInput |= InputNetFlags.Attack;
|
||||||
|
if (IsKeyDown(InputType.Ragdoll)) newInput |= InputNetFlags.Ragdoll;
|
||||||
|
|
||||||
if (AnimController.TargetDir == Direction.Left) newInput |= InputNetFlags.FacingLeft;
|
if (AnimController.TargetDir == Direction.Left) newInput |= InputNetFlags.FacingLeft;
|
||||||
|
|
||||||
@@ -438,15 +440,16 @@ namespace Barotrauma
|
|||||||
Vector2 relativeCursorPos = cursorPosition - (ViewTarget == null ? AnimController.AimSourcePos : ViewTarget.Position);
|
Vector2 relativeCursorPos = cursorPosition - (ViewTarget == null ? AnimController.AimSourcePos : ViewTarget.Position);
|
||||||
tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI)));
|
tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI)));
|
||||||
}
|
}
|
||||||
|
tempBuffer.Write(IsRagdolled);
|
||||||
|
|
||||||
tempBuffer.Write(AnimController.TargetDir == Direction.Right);
|
tempBuffer.Write(AnimController.TargetDir == Direction.Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedCharacter != null || selectedConstruction != null)
|
if (SelectedCharacter != null || selectedConstruction != null)
|
||||||
{
|
{
|
||||||
tempBuffer.Write(true);
|
tempBuffer.Write(true);
|
||||||
tempBuffer.Write(selectedCharacter != null ? selectedCharacter.ID : selectedConstruction.ID);
|
tempBuffer.Write(SelectedCharacter != null ? SelectedCharacter.ID : selectedConstruction.ID);
|
||||||
if (selectedCharacter != null)
|
if (SelectedCharacter != null)
|
||||||
{
|
{
|
||||||
tempBuffer.Write(AnimController.Anim == AnimController.Animation.CPR);
|
tempBuffer.Write(AnimController.Anim == AnimController.Animation.CPR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -658,6 +658,24 @@ namespace Barotrauma
|
|||||||
if (Character.Controlled != null) Character.Controlled.AnimController.Frozen = !Character.Controlled.AnimController.Frozen;
|
if (Character.Controlled != null) Character.Controlled.AnimController.Frozen = !Character.Controlled.AnimController.Frozen;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("ragdoll", "ragdoll [character name]: Force-ragdoll the specified character. If the name parameter is omitted, the controlled character will be ragdolled.", (string[] args) =>
|
||||||
|
{
|
||||||
|
Character ragdolledCharacter = null;
|
||||||
|
if (args.Length == 0)
|
||||||
|
{
|
||||||
|
ragdolledCharacter = Character.Controlled;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ragdolledCharacter = FindMatchingCharacter(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ragdolledCharacter != null)
|
||||||
|
{
|
||||||
|
ragdolledCharacter.IsForceRagdolled = !ragdolledCharacter.IsForceRagdolled;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("freecamera|freecam", "freecam: Detach the camera from the controlled character.", (string[] args) =>
|
commands.Add(new Command("freecamera|freecam", "freecam: Detach the camera from the controlled character.", (string[] args) =>
|
||||||
{
|
{
|
||||||
Character.Controlled = null;
|
Character.Controlled = null;
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ namespace Barotrauma
|
|||||||
Up, Down, Left, Right,
|
Up, Down, Left, Right,
|
||||||
Attack,
|
Attack,
|
||||||
Run, Crouch,
|
Run, Crouch,
|
||||||
Chat, RadioChat, CrewOrders
|
Chat, RadioChat, CrewOrders,
|
||||||
|
Ragdoll
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KeyOrMouse
|
public class KeyOrMouse
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<config masterserverurl="http://www.undertowgames.com/baromaster" autocheckupdates="true" musicvolume="0.5" soundvolume="0.5" verboselogging="false">
|
<config masterserverurl="http://www.undertowgames.com/baromaster" autocheckupdates="true" musicvolume="0.5" soundvolume="0.5" verboselogging="false">
|
||||||
<graphicsmode fullscreen="true" vsync="true" />
|
<graphicsmode fullscreen="true" vsync="true" />
|
||||||
<contentpackage path="Data/ContentPackages/Vanilla 0.7.xml" />
|
<contentpackage path="Data/ContentPackages/Vanilla 0.7.xml" />
|
||||||
<keymapping Select="E" Use="0" Aim="1" Up="W" Down="S" Left="A" Right="D" Attack="R" Run="LeftShift" Crouch="LeftControl" Chat="Tab" CrewOrders="C" />
|
<keymapping Select="E" Use="0" Aim="1" Up="W" Down="S" Left="A" Right="D" Attack="R" Run="LeftShift" Crouch="LeftControl" Chat="Tab" RadioChat="OemTilde" CrewOrders="C" Ragdoll="Space" /> />
|
||||||
<gameplay>
|
<gameplay>
|
||||||
<jobpreferences>
|
<jobpreferences>
|
||||||
<job name="Engineer" />
|
<job name="Engineer" />
|
||||||
|
|||||||
Reference in New Issue
Block a user