Further lighting optimization, fixed (railgun) controller movement, physicsbody collisioncategory changes, command room reactor controls in Vellamo

This commit is contained in:
Regalis11
2015-10-14 22:10:37 +03:00
parent 8df9133e84
commit 2bb5d41836
27 changed files with 135 additions and 126 deletions
@@ -30,6 +30,12 @@ namespace Subsurface.Items.Components
public readonly int[] wireId;
public bool IsPower
{
get;
private set;
}
public List<Connection> Recipients
{
get
@@ -69,6 +75,8 @@ namespace Subsurface.Items.Components
IsOutput = (element.Name.ToString() == "output");
Name = ToolBox.GetAttributeString(element, "name", (IsOutput) ? "output" : "input");
IsPower = Name == "power_in" || Name == "power" || Name == "power_out";
effects = new List<StatusEffect>();
wireId = new int[MaxLinked];
@@ -63,6 +63,21 @@ namespace Subsurface.Items.Components
light.Position += amount;
}
public override bool IsActive
{
get
{
return base.IsActive;
}
set
{
if (base.IsActive == value) return;
base.IsActive = value;
light.Color = value ? lightColor : Color.Transparent;
}
}
public LightComponent(Item item, XElement element)
: base (item, element)
{
@@ -122,10 +137,11 @@ namespace Subsurface.Items.Components
public override void Draw(SpriteBatch spriteBatch, bool editing)
{
if (!IsActive)
{
light.Color = Color.Transparent;
}
if (!editing) return;
//Vector2 center = new Vector2(item.Rect.Center.X, -item.Rect.Y + item.Rect.Height/2.0f);
//GUI.DrawLine(spriteBatch, center - Vector2.One * range, center + Vector2.One * range, lightColor);
}
public override void Remove()
@@ -304,7 +304,7 @@ namespace Subsurface.Items.Components
GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y - 3, 6, 6), Color.Red, true, 0.0f);
if (GUIComponent.MouseOn != null ||
Vector2.Distance(GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) > 20.0f)
Vector2.Distance(GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) > 10.0f)
{
continue;
}