All highlighted items are rendered to the lightmap, not just the ones the player is focusing on. -> Highlighted wires and the items they are connected to now glow in the dark.
Fixed LightComponent light source position not being updated if the item has no body, causing the light source to appear in a wrong position when attaching lights to walls.
This commit is contained in:
@@ -209,14 +209,20 @@ namespace Barotrauma.Lights
|
||||
if (Character.Controlled.FocusedItem != null)
|
||||
{
|
||||
Character.Controlled.FocusedItem.IsHighlighted = true;
|
||||
Character.Controlled.FocusedItem.Draw(spriteBatch, false, true);
|
||||
Character.Controlled.FocusedItem.IsHighlighted = true;
|
||||
}
|
||||
else if (Character.Controlled.FocusedCharacter != null)
|
||||
if (Character.Controlled.FocusedCharacter != null)
|
||||
{
|
||||
Character.Controlled.FocusedCharacter.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.IsHighlighted)
|
||||
{
|
||||
item.Draw(spriteBatch, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 drawPos = Character.Controlled.DrawPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Barotrauma.Lights
|
||||
if (position == value) return;
|
||||
position = value;
|
||||
|
||||
if (Vector2.Distance(prevCalculatedPosition, position) < 5.0f) return;
|
||||
if (Vector2.DistanceSquared(prevCalculatedPosition, position) < 5.0f * 5.0f) return;
|
||||
|
||||
NeedsHullCheck = true;
|
||||
NeedsRecalculation = true;
|
||||
|
||||
@@ -128,20 +128,17 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
#if CLIENT
|
||||
light.ParentSub = item.Submarine;
|
||||
#endif
|
||||
|
||||
#if CLIENT
|
||||
if (item.Container != null)
|
||||
{
|
||||
light.Color = Color.Transparent;
|
||||
return;
|
||||
}
|
||||
light.Position = item.Position;
|
||||
#endif
|
||||
|
||||
if (item.body != null)
|
||||
{
|
||||
#if CLIENT
|
||||
light.Position = item.Position;
|
||||
light.Rotation = item.body.Dir > 0.0f ? item.body.Rotation : item.body.Rotation - MathHelper.Pi;
|
||||
#endif
|
||||
if (!item.body.Enabled)
|
||||
@@ -181,19 +178,17 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
protected override void RemoveComponentSpecific()
|
||||
{
|
||||
base.RemoveComponentSpecific();
|
||||
|
||||
#if CLIENT
|
||||
light.Remove();
|
||||
}
|
||||
#endif
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power=0.0f)
|
||||
|
||||
Reference in New Issue
Block a user