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:
Regalis
2017-01-14 14:45:19 +02:00
parent 9b03b2bcc1
commit fdbdf9638f
3 changed files with 16 additions and 10 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure> <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.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk> <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 throat feels sore</HuskDormant>
<HuskDormant>Your feel feverish</HuskDormant> <HuskDormant>Your feel feverish</HuskDormant>
+12 -7
View File
@@ -159,11 +159,10 @@ namespace Barotrauma
public Entity ViewTarget public Entity ViewTarget
{ {
get; get;
private set; set;
} }
private CharacterInfo info; private CharacterInfo info;
public CharacterInfo Info public CharacterInfo Info
{ {
get get
@@ -834,6 +833,7 @@ namespace Barotrauma
public void Control(float deltaTime, Camera cam) public void Control(float deltaTime, Camera cam)
{ {
ViewTarget = null;
if (!AllowInput) return; if (!AllowInput) return;
Vector2 targetMovement = GetTargetMovement(); Vector2 targetMovement = GetTargetMovement();
@@ -1369,8 +1369,9 @@ namespace Barotrauma
dequeuedInput = memInput[memInput.Count - 1].states; dequeuedInput = memInput[memInput.Count - 1].states;
double aimAngle = ((double)memInput[memInput.Count - 1].intAim/65535.0)*2.0*Math.PI; 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; 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; closestItem = Entity.FindEntityByID(memInput[memInput.Count - 1].interact) as Item;
memInput.RemoveAt(memInput.Count - 1); memInput.RemoveAt(memInput.Count - 1);
@@ -1406,7 +1407,7 @@ namespace Barotrauma
if (AnimController.TargetDir == Direction.Left) newInput |= InputNetFlags.FacingLeft; 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(); relativeCursorPos.Normalize();
UInt16 intAngle = (UInt16)(65535.0*Math.Atan2(relativeCursorPos.Y,relativeCursorPos.X)/(2.0*Math.PI)); 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; GameMain.LightManager.LosEnabled = false;
controlled = null; controlled = null;
} }
if (GameMain.Server != null)
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
} }
AnimController.Frozen = false; AnimController.Frozen = false;
@@ -2174,7 +2178,7 @@ namespace Barotrauma
if (aiming) 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))); tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI)));
} }
@@ -2247,7 +2251,8 @@ namespace Barotrauma
if (aimInput) if (aimInput)
{ {
double aimAngle = ((double)msg.ReadUInt16() / 65535.0) * 2.0 * Math.PI; 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(); TransformCursorPos();
} }
@@ -198,6 +198,7 @@ namespace Barotrauma.Items.Components
return; return;
} }
character.ViewTarget = focusTarget;
if (character == Character.Controlled && cam != null) if (character == Character.Controlled && cam != null)
{ {
Lights.LightManager.ViewTarget = focusTarget; Lights.LightManager.ViewTarget = focusTarget;