Adds ragdoll button. Because why not.
Also adds admin ragdoll command to force people into ragdoll mode. The networking/syncing wasn't yet tested for this but hopefully everything should work. Updates config.xml to add default keybinds for radio chat and ragdoll
This commit is contained in:
@@ -109,6 +109,10 @@ namespace Barotrauma
|
||||
|
||||
TransformCursorPos();
|
||||
}
|
||||
bool ragdollInput = msg.ReadBoolean();
|
||||
keys[(int)InputType.Ragdoll].Held = ragdollInput;
|
||||
keys[(int)InputType.Ragdoll].SetState(false, ragdollInput);
|
||||
|
||||
facingRight = msg.ReadBoolean();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Barotrauma
|
||||
partial class Character : Entity, IDamageable, ISerializableEntity, IClientSerializable, IServerSerializable
|
||||
{
|
||||
public static List<Character> CharacterList = new List<Character>();
|
||||
|
||||
|
||||
public static bool DisableControls;
|
||||
|
||||
|
||||
private bool enabled = true;
|
||||
public bool Enabled
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
protected Key[] keys;
|
||||
|
||||
|
||||
private Item selectedConstruction;
|
||||
private Item[] selectedItems;
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Barotrauma
|
||||
private bool isDead;
|
||||
private CauseOfDeath lastAttackCauseOfDeath;
|
||||
private CauseOfDeath causeOfDeath;
|
||||
|
||||
|
||||
public readonly bool IsHumanoid;
|
||||
|
||||
//the name of the species (e.q. human)
|
||||
@@ -113,16 +113,16 @@ namespace Barotrauma
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
private CharacterInfo info;
|
||||
public CharacterInfo Info
|
||||
{
|
||||
get
|
||||
{
|
||||
{
|
||||
return info;
|
||||
}
|
||||
set
|
||||
set
|
||||
{
|
||||
if (info != null && info != value) info.Remove();
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Barotrauma
|
||||
{
|
||||
get { return inventory; }
|
||||
}
|
||||
|
||||
|
||||
private Color speechBubbleColor;
|
||||
private float speechBubbleTimer;
|
||||
|
||||
@@ -184,8 +184,8 @@ namespace Barotrauma
|
||||
public Vector2 CursorPosition
|
||||
{
|
||||
get { return cursorPosition; }
|
||||
set
|
||||
{
|
||||
set
|
||||
{
|
||||
if (!MathUtils.IsValid(value)) return;
|
||||
cursorPosition = value;
|
||||
}
|
||||
@@ -246,6 +246,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRagdolled;
|
||||
public bool IsForceRagdolled;
|
||||
|
||||
public bool IsUnconscious
|
||||
{
|
||||
get { return (needsAir && oxygen <= 0.0f) || health <= 0.0f; }
|
||||
@@ -661,6 +664,8 @@ namespace Barotrauma
|
||||
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
||||
case InputType.Use:
|
||||
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
||||
case InputType.Ragdoll:
|
||||
return !(dequeuedInput.HasFlag(InputType.Ragdoll)) && (prevDequeuedInput.HasFlag(InputType.Ragdoll));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -695,6 +700,8 @@ namespace Barotrauma
|
||||
return dequeuedInput.HasFlag(InputNetFlags.Use);
|
||||
case InputType.Attack:
|
||||
return dequeuedInput.HasFlag(InputNetFlags.Attack);
|
||||
case InputType.Ragdoll:
|
||||
return dequeuedInput.HasFlag(InputNetFlags.Ragdoll);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1435,7 +1442,22 @@ namespace Barotrauma
|
||||
UpdateUnconscious(deltaTime);
|
||||
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);
|
||||
if (controlled != this && (!(this is AICharacter) || IsRemotePlayer))
|
||||
{
|
||||
|
||||
@@ -52,8 +52,9 @@ namespace Barotrauma
|
||||
Use = 0x100,
|
||||
Aim = 0x200,
|
||||
Attack = 0x400,
|
||||
Ragdoll = 0x800,
|
||||
|
||||
MaxVal = 0x7FF
|
||||
MaxVal = 0xFFF
|
||||
}
|
||||
private InputNetFlags dequeuedInput = 0;
|
||||
private InputNetFlags prevDequeuedInput = 0;
|
||||
@@ -208,6 +209,7 @@ namespace Barotrauma
|
||||
if (IsKeyDown(InputType.Use)) newInput |= InputNetFlags.Use;
|
||||
if (IsKeyDown(InputType.Aim)) newInput |= InputNetFlags.Aim;
|
||||
if (IsKeyDown(InputType.Attack)) newInput |= InputNetFlags.Attack;
|
||||
if (IsKeyDown(InputType.Ragdoll)) newInput |= InputNetFlags.Ragdoll;
|
||||
|
||||
if (AnimController.TargetDir == Direction.Left) newInput |= InputNetFlags.FacingLeft;
|
||||
|
||||
@@ -438,6 +440,7 @@ namespace Barotrauma
|
||||
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(IsRagdolled);
|
||||
|
||||
tempBuffer.Write(AnimController.TargetDir == Direction.Right);
|
||||
}
|
||||
|
||||
@@ -647,6 +647,24 @@ namespace Barotrauma
|
||||
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) =>
|
||||
{
|
||||
Character.Controlled = null;
|
||||
|
||||
@@ -11,7 +11,8 @@ namespace Barotrauma
|
||||
Up, Down, Left, Right,
|
||||
Attack,
|
||||
Run, Crouch,
|
||||
Chat, RadioChat, CrewOrders
|
||||
Chat, RadioChat, CrewOrders,
|
||||
Ragdoll
|
||||
}
|
||||
|
||||
public class KeyOrMouse
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<config masterserverurl="http://www.undertowgames.com/baromaster" autocheckupdates="true" musicvolume="0.5" soundvolume="0.5" verboselogging="false">
|
||||
<graphicsmode fullscreen="true" vsync="true" />
|
||||
<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>
|
||||
<jobpreferences>
|
||||
<job name="Engineer" />
|
||||
|
||||
Reference in New Issue
Block a user