Option to hide waypoints and spawnpoints in editor, fixed cam "twitching" in multiplayer, additional light sprites for lightcomponents, wire bugfixes, fixed excessive camera shake when firing the railgun

This commit is contained in:
Regalis
2016-01-04 22:36:39 +02:00
parent bc9ff32023
commit ca7febfcab
20 changed files with 123 additions and 55 deletions

View File

@@ -325,10 +325,12 @@ namespace Barotrauma.Items.Components
if (index>-1 && wireComponent!=null && !Wires.Contains(wireComponent))
{
bool alreadyConnected = wireComponent.IsConnectedTo(item);
wireComponent.RemoveConnection(item);
Wires[index] = wireComponent;
wireComponent.Connect(this);
wireComponent.Connect(this, !alreadyConnected);
}
}
//far away -> disconnect if the wire is linked to this connector

View File

@@ -13,13 +13,11 @@ namespace Barotrauma.Items.Components
private Color lightColor;
//private Sprite sprite;
private LightSource light;
LightSource light;
private float range;
float range;
float lightBrightness;
private float lightBrightness;
private float flicker;
@@ -81,18 +79,17 @@ namespace Barotrauma.Items.Components
public LightComponent(Item item, XElement element)
: base (item, element)
{
//foreach (XElement subElement in element.Elements())
//{
// if (subElement.Name.ToString().ToLower() != "sprite") continue;
// sprite = new Sprite(subElement);
// break;
//}
light = new LightSource(item.Position, 100.0f, Color.White, item.CurrentHull == null ? null : item.CurrentHull.Submarine);
IsActive = true;
//lightColor = new Color(ToolBox.GetAttributeVector4(element, "color", Vector4.One));
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLower() != "sprite") continue;
light.LightSprite = new Sprite(subElement);
light.LightSprite.Origin = light.LightSprite.size / 2.0f;
break;
}
}
public override void Update(float deltaTime, Camera cam)
@@ -101,9 +98,7 @@ namespace Barotrauma.Items.Components
if (item.CurrentHull != null)
{
light.Submarine = item.CurrentHull.Submarine;
}
}
if (item.container != null)
{

View File

@@ -57,6 +57,12 @@ namespace Barotrauma.Items.Components
return null;
}
public bool IsConnectedTo(Item item)
{
if (connections[0] != null && connections[0].Item == item) return true;
return (connections[1] != null && connections[1].Item == item);
}
public void RemoveConnection(Item item)
{
for (int i = 0; i<2; i++)