- disabled unnecessary hull updates during loading (items/gaps find the hull when everything is loaded instead of every time a hull is created or moved)
- fixed item.Submarine not being set in item.FindHull
This commit is contained in:
@@ -319,7 +319,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
rect = newRect;
|
rect = newRect;
|
||||||
|
|
||||||
FindHull();
|
if (submarine==null || !submarine.Loading) FindHull();
|
||||||
|
|
||||||
condition = 100.0f;
|
condition = 100.0f;
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ namespace Barotrauma
|
|||||||
ic.Move(amount);
|
ic.Move(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body != null) FindHull();
|
if (body != null && (Submarine==null || !Submarine.Loading)) FindHull();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle TransformTrigger(Rectangle trigger, bool world = false)
|
public Rectangle TransformTrigger(Rectangle trigger, bool world = false)
|
||||||
@@ -512,11 +512,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
CurrentHull = Hull.FindHull(WorldPosition, CurrentHull);
|
CurrentHull = Hull.FindHull(WorldPosition, CurrentHull);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (body!=null)
|
if (body!=null)
|
||||||
{
|
{
|
||||||
body.Submarine = CurrentHull == null ? null : Submarine.Loaded;
|
Submarine = CurrentHull == null ? null : Submarine.Loaded;
|
||||||
|
body.Submarine = Submarine;
|
||||||
}
|
}
|
||||||
return CurrentHull;
|
return CurrentHull;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -603,8 +603,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void OnMapLoaded()
|
public override void OnMapLoaded()
|
||||||
{
|
{
|
||||||
UpdateHulls();
|
FindHulls();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override XElement Save(XDocument doc)
|
public override XElement Save(XDocument doc)
|
||||||
{
|
{
|
||||||
XElement element = new XElement("Gap");
|
XElement element = new XElement("Gap");
|
||||||
|
|||||||
@@ -85,8 +85,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
base.Rect = value;
|
base.Rect = value;
|
||||||
|
|
||||||
Item.UpdateHulls();
|
if (Submarine == null || !Submarine.Loading)
|
||||||
Gap.UpdateHulls();
|
{
|
||||||
|
Item.UpdateHulls();
|
||||||
|
Gap.UpdateHulls();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,14 +208,15 @@ namespace Barotrauma
|
|||||||
hullList.Add(this);
|
hullList.Add(this);
|
||||||
|
|
||||||
ConnectedGaps = new List<Gap>();
|
ConnectedGaps = new List<Gap>();
|
||||||
|
|
||||||
Item.UpdateHulls();
|
if (submarine==null || !submarine.Loading)
|
||||||
Gap.UpdateHulls();
|
{
|
||||||
|
Item.UpdateHulls();
|
||||||
|
Gap.UpdateHulls();
|
||||||
|
}
|
||||||
|
|
||||||
Volume = 0.0f;
|
Volume = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
InsertToList();
|
InsertToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,16 +283,22 @@ namespace Barotrauma
|
|||||||
rect.X += (int)amount.X;
|
rect.X += (int)amount.X;
|
||||||
rect.Y += (int)amount.Y;
|
rect.Y += (int)amount.Y;
|
||||||
|
|
||||||
Item.UpdateHulls();
|
if (Submarine==null || !Submarine.Loading)
|
||||||
Gap.UpdateHulls();
|
{
|
||||||
|
Item.UpdateHulls();
|
||||||
|
Gap.UpdateHulls();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Remove()
|
public override void Remove()
|
||||||
{
|
{
|
||||||
base.Remove();
|
base.Remove();
|
||||||
|
|
||||||
Item.UpdateHulls();
|
if (Submarine == null || !Submarine.Loading)
|
||||||
Gap.UpdateHulls();
|
{
|
||||||
|
Item.UpdateHulls();
|
||||||
|
Gap.UpdateHulls();
|
||||||
|
}
|
||||||
|
|
||||||
List<FireSource> fireSourcesToRemove = new List<FireSource>(fireSources);
|
List<FireSource> fireSourcesToRemove = new List<FireSource>(fireSources);
|
||||||
foreach (FireSource fireSource in fireSourcesToRemove)
|
foreach (FireSource fireSource in fireSourcesToRemove)
|
||||||
|
|||||||
@@ -627,16 +627,14 @@ namespace Barotrauma
|
|||||||
if (linked != null) e.linkedTo.Add(linked);
|
if (linked != null) e.linkedTo.Add(linked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mapEntityList.Count; i++)
|
|
||||||
{
|
|
||||||
if (mapEntityList[i].Submarine != null) mapEntityList[i].Move(Submarine.HiddenSubPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i<mapEntityList.Count; i++)
|
for (int i = 0; i<mapEntityList.Count; i++)
|
||||||
{
|
{
|
||||||
mapEntityList[i].OnMapLoaded();
|
mapEntityList[i].OnMapLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item.UpdateHulls();
|
||||||
|
Gap.UpdateHulls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ namespace Barotrauma
|
|||||||
get { return lastPickedFraction; }
|
get { return lastPickedFraction; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Loading
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
public bool GodMode
|
public bool GodMode
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -676,7 +682,8 @@ namespace Barotrauma
|
|||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
Unload();
|
Unload();
|
||||||
//string file = filePath;
|
|
||||||
|
Loading = true;
|
||||||
|
|
||||||
XDocument doc = OpenDoc(filePath);
|
XDocument doc = OpenDoc(filePath);
|
||||||
if (doc == null || doc.Root == null) return;
|
if (doc == null || doc.Root == null) return;
|
||||||
@@ -758,6 +765,14 @@ namespace Barotrauma
|
|||||||
loaded = this;
|
loaded = this;
|
||||||
|
|
||||||
Hull.GenerateEntityGrid();
|
Hull.GenerateEntityGrid();
|
||||||
|
|
||||||
|
for (int i = 0; i < MapEntity.mapEntityList.Count; i++)
|
||||||
|
{
|
||||||
|
if (MapEntity.mapEntityList[i].Submarine != this) continue;
|
||||||
|
MapEntity.mapEntityList[i].Move(HiddenSubPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading = false;
|
||||||
|
|
||||||
MapEntity.MapLoaded();
|
MapEntity.MapLoaded();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user