Item UI replacements, fabricator bugfix, randomly spawning artifacts, AI can fix leaks, LimbAttacks do damage once (not each frame for the duration of the attack)

This commit is contained in:
Regalis
2016-01-14 21:06:08 +02:00
parent eb20af622d
commit 0fc085c86d
33 changed files with 340 additions and 123 deletions

View File

@@ -854,6 +854,40 @@ namespace Barotrauma
return normal;
}
public Vector2 GetRandomItemPos(float offsetFromWall = 10.0f)
{
Vector2 position = Vector2.Zero;
offsetFromWall = ConvertUnits.ToSimUnits(offsetFromWall);
int tries = 0;
do
{
Vector2 startPos = ConvertUnits.ToSimUnits(PositionsOfInterest[Rand.Int(PositionsOfInterest.Count, false)]);
Vector2 endPos = startPos - ConvertUnits.ToSimUnits(Vector2.UnitY * Size.Y);
if (Submarine.PickBody(
startPos,
endPos,
null, Physics.CollisionLevel) != null)
{
position = ConvertUnits.ToDisplayUnits(Submarine.LastPickedPosition - Vector2.Normalize(startPos - endPos)*offsetFromWall);
break;
}
tries++;
if (tries == 10)
{
position = EndPosition - Vector2.UnitY * 300.0f;
}
} while (tries < 10);
return position;
}
//public void SetPosition(Vector2 pos)
//{
// Vector2 amount = pos - Position;