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:
Joonas Rikkonen
2018-01-11 13:22:04 +02:00
parent 2dde3cb0a8
commit aa0fdfb790
3 changed files with 16 additions and 15 deletions
@@ -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;