- AI crew can avoid firesources in nearby hulls, not just the one they're currently inside
- fixed fires, oxygen and water level not being taken into account in path cost calculations - particle collision fix
This commit is contained in:
@@ -56,6 +56,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public float DamageRange
|
||||
{
|
||||
get { return (float)Math.Sqrt(size.X) * 20.0f; }
|
||||
}
|
||||
|
||||
public Hull Hull
|
||||
{
|
||||
get { return hull; }
|
||||
@@ -125,12 +130,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(Vector2 pos)
|
||||
{
|
||||
return pos.X > position.X && pos.X<position.X + size.X;
|
||||
}
|
||||
|
||||
|
||||
private bool CheckOverLap(FireSource fireSource)
|
||||
{
|
||||
return !(position.X > fireSource.position.X + fireSource.size.X ||
|
||||
@@ -251,7 +251,7 @@ namespace Barotrauma
|
||||
Character c = Character.CharacterList[i];
|
||||
if (c.AnimController.CurrentHull == null || c.IsDead) continue;
|
||||
|
||||
float range = (float)Math.Sqrt(size.X) * 20.0f;
|
||||
float range = DamageRange;
|
||||
if (c.Position.X < position.X - range || c.Position.X > position.X + size.X + range) continue;
|
||||
if (c.Position.Y < position.Y - size.Y || c.Position.Y > hull.Rect.Y) continue;
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (limb.WearingItems.Find(w => w != null && w.WearableComponent.Item.FireProof) != null) continue;
|
||||
limb.Burnt += dmg * 10.0f;
|
||||
c.AddDamage(limb.SimPosition, DamageType.None, dmg, 0, 0, false);
|
||||
c.AddDamage(limb.SimPosition, DamageType.Burn, dmg, 0, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,6 +348,7 @@ namespace Barotrauma
|
||||
{
|
||||
fireSource.Remove();
|
||||
}
|
||||
fireSources.Clear();
|
||||
|
||||
if (soundIndex > -1)
|
||||
{
|
||||
@@ -399,7 +400,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (PlayerInput.LeftButtonClicked())
|
||||
{
|
||||
new FireSource(position);
|
||||
new FireSource(position, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,7 +561,6 @@ namespace Barotrauma
|
||||
//pos.Normalize();
|
||||
item.body.ApplyForce((gap.LerpedFlowForce/distance) * deltaTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Extinquish(float deltaTime, float amount, Vector2 position)
|
||||
@@ -578,6 +578,33 @@ namespace Barotrauma
|
||||
if (GameMain.Server != null) GameMain.Server.CreateEntityEvent(this);
|
||||
}
|
||||
|
||||
public List<Hull> GetConnectedHulls(int? searchDepth)
|
||||
{
|
||||
return GetAdjacentHulls(new List<Hull>(), 0, searchDepth);
|
||||
|
||||
}
|
||||
|
||||
private List<Hull> GetAdjacentHulls(List<Hull> connectedHulls, int steps, int? searchDepth)
|
||||
{
|
||||
connectedHulls.Add(this);
|
||||
|
||||
if (searchDepth != null && steps >= searchDepth.Value) return connectedHulls;
|
||||
|
||||
foreach (Gap g in ConnectedGaps)
|
||||
{
|
||||
for (int i = 0; i < 2 && i < g.linkedTo.Count; i++)
|
||||
{
|
||||
Hull hull = g.linkedTo[i] as Hull;
|
||||
if (hull != null && !connectedHulls.Contains(hull))
|
||||
{
|
||||
hull.GetAdjacentHulls(connectedHulls, steps++, searchDepth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return connectedHulls;
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
|
||||
{
|
||||
//if (back) return;
|
||||
|
||||
Reference in New Issue
Block a user