Multiplayer fixes

This commit is contained in:
Regalis
2015-12-12 16:23:01 +02:00
parent 17e8a2171f
commit 04cfca0ede
14 changed files with 46 additions and 37 deletions
@@ -61,7 +61,7 @@ namespace Barotrauma.Items.Components
{
base.Draw(spriteBatch, editing);
textBlock.Rect = new Rectangle(item.WorldRect.X, -(item.WorldRect.Y - item.Rect.Height/2), item.Rect.Width, item.Rect.Height);
textBlock.Rect = new Rectangle((int)item.DrawPosition.X - item.Rect.Width/2, -(int)(item.DrawPosition.Y + item.Rect.Height/2), item.Rect.Width, item.Rect.Height);
textBlock.Draw(spriteBatch);
}
}
@@ -118,7 +118,7 @@ namespace Barotrauma.Items.Components
fmj.WorldAnchorB = position;
}
item.SendSignal(ToolBox.Vector2ToString(character.CursorPosition), "position_out");
item.SendSignal(ToolBox.Vector2ToString(character.CursorWorldPosition), "position_out");
}
public override bool Use(float deltaTime, Character activator = null)
@@ -152,12 +152,12 @@ namespace Barotrauma.Items.Components
{
if (c2 == null || c2.Item==null || !c2.Item.Prefab.FocusOnSelected) continue;
Vector2 centerPos = c2.Item.Position;
Vector2 centerPos = c2.Item.WorldPosition;
if (character == Character.Controlled && cam != null)
{
Lights.LightManager.ViewPos = centerPos;
cam.TargetPos = c2.Item.Position;
cam.TargetPos = c2.Item.WorldPosition;
}
break;
@@ -50,6 +50,8 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam)
{
currPowerConsumption = powerConsumption;
base.Update(deltaTime, cam);
for (int i = radarBlips.Count - 1; i >= 0; i-- )
@@ -71,6 +73,8 @@ namespace Barotrauma.Items.Components
{
pingState = 0.0f;
}
voltage = 0.0f;
}
public override bool Use(float deltaTime, Character character = null)
@@ -262,7 +266,6 @@ namespace Barotrauma.Items.Components
prevPos = pos;
}
voltage = 0.0f;
}
private void DrawBlip(SpriteBatch spriteBatch, RadarBlip blip, Vector2 center, Color color, float radius)
+2 -2
View File
@@ -153,7 +153,7 @@ namespace Barotrauma.Items.Components
projectile.body.ResetDynamics();
projectile.body.Enabled = true;
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y)), -rotation);
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation);
projectiles[0].Use(deltaTime);
if (projectile.container != null) projectile.container.RemoveContained(projectile);
@@ -301,7 +301,7 @@ namespace Barotrauma.Items.Components
case "position_in":
Vector2 receivedPos = ToolBox.ParseToVector2(signal, false);
Vector2 centerPos = new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y);
Vector2 centerPos = new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y);
Vector2 offset = receivedPos - centerPos;
offset.Y = -offset.Y;