(a00338777) v0.9.2.1

This commit is contained in:
Joonas Rikkonen
2019-08-26 19:58:19 +03:00
parent 0f63da27b2
commit 80698b58b0
311 changed files with 11763 additions and 4507 deletions
@@ -104,6 +104,9 @@ namespace Barotrauma
public readonly bool IsHumanoid;
public bool IsTraitor;
public string TraitorCurrentObjective = "";
//the name of the species (e.q. human)
public readonly string SpeciesName;
@@ -1515,12 +1518,12 @@ namespace Barotrauma
bool leftHand = Inventory.IsInLimbSlot(item, InvSlotType.LeftHand);
bool selected = false;
if (rightHand && SelectedItems[0] == null)
if (rightHand && (SelectedItems[0] == null || SelectedItems[0] == item))
{
selectedItems[0] = item;
selected = true;
}
if (leftHand && SelectedItems[1] == null)
if (leftHand && (SelectedItems[1] == null || SelectedItems[1] == item))
{
selectedItems[1] = item;
selected = true;
@@ -1839,7 +1842,7 @@ namespace Barotrauma
{
DeselectCharacter();
}
else if (focusedCharacter != null && IsKeyHit(InputType.Grab) && FocusedCharacter.CanInventoryBeAccessed)
else if (focusedCharacter != null && IsKeyHit(InputType.Grab) && FocusedCharacter.CanBeDragged)
{
SelectCharacter(focusedCharacter);
}
@@ -1954,6 +1957,10 @@ namespace Barotrauma
//disable AI characters that are far away from the sub and the controlled character
float distSqr = Vector2.DistanceSquared(Submarine.MainSub.WorldPosition, c.WorldPosition);
if (Controlled != null)
{
distSqr = Math.Min(distSqr, Vector2.DistanceSquared(Controlled.WorldPosition, c.WorldPosition));
}
else
{
distSqr = Math.Min(distSqr, Vector2.DistanceSquared(GameMain.GameScreen.Cam.GetPosition(), c.WorldPosition));
}
@@ -2198,16 +2205,15 @@ namespace Barotrauma
private void UpdateSightRange()
{
if (aiTarget == null) { return; }
// TODO: the formula might need some tweaking
float range = (float)Math.Sqrt(Mass) * 1000.0f + AnimController.Collider.LinearVelocity.Length() * 500.0f;
aiTarget.SightRange = MathHelper.Clamp(range, 0, 15000.0f);
float range = (float)Math.Sqrt(Mass) * 250 + AnimController.Collider.LinearVelocity.Length() * 500;
aiTarget.SightRange = MathHelper.Clamp(range, 0, 10000);
}
private void UpdateSoundRange()
{
if (aiTarget == null) { return; }
float range = Mass / 5 * AnimController.TargetMovement.Length() * Noise;
aiTarget.SoundRange = MathHelper.Clamp(range, 0f, 5000f);
float range = ((float)Math.Sqrt(Mass) / 3) * (AnimController.TargetMovement.Length() * 2) * Noise;
aiTarget.SoundRange = MathHelper.Clamp(range, 0, 10000);
}
public void SetOrder(Order order, string orderOption, Character orderGiver, bool speak = true)
@@ -2598,6 +2604,7 @@ namespace Barotrauma
{
if (selectedItems[i] != null) selectedItems[i].Drop(this);
}
SelectedConstruction = null;
AnimController.ResetPullJoints();