Fixed railgun aiming, fixed EntityEvent not being sent if a character is killed by something else than health dropping to zero
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
|
||||
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
|
||||
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk>
|
||||
<Self_CauseOfDeath.Disconnected>You have been disconnected from the server.</Self_CauseOfDeath.Disconnected>
|
||||
<Self_CauseOfDeath.Disconnected>You were disconnected from the server.</Self_CauseOfDeath.Disconnected>
|
||||
|
||||
<HuskDormant>Your throat feels sore</HuskDormant>
|
||||
<HuskDormant>Your feel feverish</HuskDormant>
|
||||
|
||||
@@ -159,11 +159,10 @@ namespace Barotrauma
|
||||
public Entity ViewTarget
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
set;
|
||||
}
|
||||
|
||||
private CharacterInfo info;
|
||||
|
||||
public CharacterInfo Info
|
||||
{
|
||||
get
|
||||
@@ -834,6 +833,7 @@ namespace Barotrauma
|
||||
|
||||
public void Control(float deltaTime, Camera cam)
|
||||
{
|
||||
ViewTarget = null;
|
||||
if (!AllowInput) return;
|
||||
|
||||
Vector2 targetMovement = GetTargetMovement();
|
||||
@@ -1326,7 +1326,7 @@ namespace Barotrauma
|
||||
if (GameMain.Client!=null && this==Controlled && !isSynced) return;
|
||||
|
||||
if (!Enabled) return;
|
||||
|
||||
|
||||
PreviousHull = CurrentHull;
|
||||
CurrentHull = Hull.FindHull(WorldPosition, CurrentHull, true);
|
||||
//if (PreviousHull != CurrentHull && Character.Controlled == this) Hull.DetectItemVisibility(this); //WIP item culling
|
||||
@@ -1369,8 +1369,9 @@ namespace Barotrauma
|
||||
|
||||
dequeuedInput = memInput[memInput.Count - 1].states;
|
||||
|
||||
double aimAngle = ((double)memInput[memInput.Count - 1].intAim/65535.0)*2.0*Math.PI;
|
||||
cursorPosition = AnimController.Collider.Position+new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle))*60.0f;
|
||||
double aimAngle = ((double)memInput[memInput.Count - 1].intAim / 65535.0) * 2.0 * Math.PI;
|
||||
cursorPosition = (ViewTarget == null ? AnimController.Collider.Position : ViewTarget.Position)
|
||||
+ new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle)) * 60.0f;
|
||||
|
||||
closestItem = Entity.FindEntityByID(memInput[memInput.Count - 1].interact) as Item;
|
||||
memInput.RemoveAt(memInput.Count - 1);
|
||||
@@ -1406,7 +1407,7 @@ namespace Barotrauma
|
||||
|
||||
if (AnimController.TargetDir == Direction.Left) newInput |= InputNetFlags.FacingLeft;
|
||||
|
||||
Vector2 relativeCursorPos = cursorPosition - AnimController.Collider.Position;
|
||||
Vector2 relativeCursorPos = cursorPosition - (ViewTarget == null ? AnimController.Collider.Position : ViewTarget.Position);
|
||||
relativeCursorPos.Normalize();
|
||||
UInt16 intAngle = (UInt16)(65535.0*Math.Atan2(relativeCursorPos.Y,relativeCursorPos.X)/(2.0*Math.PI));
|
||||
|
||||
@@ -1915,6 +1916,9 @@ namespace Barotrauma
|
||||
GameMain.LightManager.LosEnabled = false;
|
||||
controlled = null;
|
||||
}
|
||||
|
||||
if (GameMain.Server != null)
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
}
|
||||
|
||||
AnimController.Frozen = false;
|
||||
@@ -1926,7 +1930,7 @@ namespace Barotrauma
|
||||
PlaySound(CharacterSound.SoundType.Die);
|
||||
|
||||
isDead = true;
|
||||
|
||||
|
||||
this.causeOfDeath = causeOfDeath;
|
||||
AnimController.movement = Vector2.Zero;
|
||||
AnimController.TargetMovement = Vector2.Zero;
|
||||
@@ -2174,7 +2178,7 @@ namespace Barotrauma
|
||||
|
||||
if (aiming)
|
||||
{
|
||||
Vector2 relativeCursorPos = cursorPosition - AnimController.Collider.Position;
|
||||
Vector2 relativeCursorPos = cursorPosition - (ViewTarget == null ? AnimController.Collider.Position : ViewTarget.Position);
|
||||
tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI)));
|
||||
}
|
||||
|
||||
@@ -2247,7 +2251,8 @@ namespace Barotrauma
|
||||
if (aimInput)
|
||||
{
|
||||
double aimAngle = ((double)msg.ReadUInt16() / 65535.0) * 2.0 * Math.PI;
|
||||
cursorPosition = AnimController.Collider.Position + new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle)) * 60.0f;
|
||||
cursorPosition = (ViewTarget == null ? AnimController.Collider.Position : ViewTarget.Position)
|
||||
+ new Vector2((float)Math.Cos(aimAngle), (float)Math.Sin(aimAngle)) * 60.0f;
|
||||
|
||||
TransformCursorPos();
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ namespace Barotrauma.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
character.ViewTarget = focusTarget;
|
||||
if (character == Character.Controlled && cam != null)
|
||||
{
|
||||
Lights.LightManager.ViewTarget = focusTarget;
|
||||
|
||||
Reference in New Issue
Block a user