(d752a1b58) Fixed lightsprite scale being wrong until the LightComponent is updated for the first time (caused fluorescent lights to look wrong in the sub editor)

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:55:59 +03:00
parent 9dc33984a9
commit 2de6c7e47d
12 changed files with 213 additions and 259 deletions
@@ -772,6 +772,25 @@ namespace Barotrauma.Items.Components
}
}
if (targetItem.Prefab.DeconstructItems.Any())
{
inputContainer.Inventory.RemoveItem(targetItem);
Entity.Spawner.AddToRemoveQueue(targetItem);
MoveInputQueue();
PutItemsToLinkedContainer();
}
else
{
if (outputContainer.Inventory.Items.All(i => i != null))
{
targetItem.Drop(dropper: null);
}
else
{
outputContainer.Inventory.TryPutItem(targetItem, user: null, createNetworkEvent: true);
}
}
if (targetItem.Prefab.DeconstructItems.Any())
{
inputContainer.Inventory.RemoveItem(targetItem);
@@ -212,6 +212,33 @@ namespace Barotrauma.Items.Components
}
}
public Vector2? PosToMaintain
{
get { return posToMaintain; }
set { posToMaintain = value; }
}
struct ObstacleDebugInfo
{
public Vector2 Point1;
public Vector2 Point2;
public Vector2? Intersection;
public float Dot;
public Vector2 AvoidStrength;
public ObstacleDebugInfo(GraphEdge edge, Vector2? intersection, float dot, Vector2 avoidStrength)
{
Point1 = edge.Point1;
Point2 = edge.Point2;
Intersection = intersection;
Dot = dot;
AvoidStrength = avoidStrength;
}
}
//edge point 1, edge point 2, avoid strength
private List<ObstacleDebugInfo> debugDrawObstacles = new List<ObstacleDebugInfo>();
@@ -144,7 +144,7 @@ namespace Barotrauma.Items.Components
}
public LightComponent(Item item, XElement element)
: base (item, element)
: base(item, element)
{
#if CLIENT
light = new LightSource(element)
@@ -152,7 +152,8 @@ namespace Barotrauma.Items.Components
ParentSub = item.CurrentHull?.Submarine,
Position = item.Position,
CastShadows = castShadows,
IsBackground = drawBehindSubs
IsBackground = drawBehindSubs,
SpriteScale = Vector2.One * item.Scale
};
#endif