(98ad00fa2) v0.9.1.0

This commit is contained in:
Joonas Rikkonen
2019-07-10 13:52:12 +03:00
parent 2a791887ed
commit afa2137bd2
104 changed files with 3041 additions and 3134 deletions
@@ -17,7 +17,8 @@ namespace Barotrauma
const float coolDown = 10.0f;
public Character Enemy { get; private set; }
public bool HoldPosition { get; set; }
private Item _weapon;
private Item Weapon
{
@@ -125,7 +126,10 @@ namespace Barotrauma
TryArm();
if (seekAmmunition == null || !subObjectives.Contains(seekAmmunition))
{
Move();
if (!HoldPosition)
{
Move();
}
if (WeaponComponent != null)
{
OperateWeapon(deltaTime);
@@ -151,6 +155,8 @@ namespace Barotrauma
private bool TryArm()
{
if (character.LockHands) { return false; }
if (Weapon != null)
{
if (!character.Inventory.Items.Contains(Weapon) || WeaponComponent == null)
@@ -160,7 +166,7 @@ namespace Barotrauma
else if (!WeaponComponent.HasRequiredContainedItems(false))
{
// Seek ammunition only if cannot find a new weapon
if (!Reload(true, () => GetWeapon(out _) == null))
if (!Reload(!HoldPosition, () => GetWeapon(out _) == null))
{
if (seekAmmunition != null && subObjectives.Contains(seekAmmunition))
{
@@ -266,7 +272,7 @@ namespace Barotrauma
private void Unequip()
{
if (character.SelectedItems.Contains(Weapon))
if (!character.LockHands && character.SelectedItems.Contains(Weapon))
{
if (!Weapon.AllowedSlots.Contains(InvSlotType.Any) || !character.Inventory.TryPutItem(Weapon, character, new List<InvSlotType>() { InvSlotType.Any }))
{
@@ -277,6 +283,7 @@ namespace Barotrauma
private bool Equip()
{
if (character.LockHands) { return false; }
if (!WeaponComponent.HasRequiredContainedItems(false))
{
Mode = CombatMode.Retreat;
@@ -322,6 +329,13 @@ namespace Barotrauma
private void Engage()
{
if (character.LockHands)
{
Mode = CombatMode.Retreat;
SteeringManager.Reset();
return;
}
retreatTarget = null;
RemoveSubObjective(ref retreatObjective);
RemoveSubObjective(ref seekAmmunition);
@@ -186,13 +186,14 @@ namespace Barotrauma
}
}
public Hull FindBestHull(IEnumerable<Hull> ignoredHulls = null)
public Hull FindBestHull(IEnumerable<Hull> ignoredHulls = null, bool allowChangingTheSubmarine = true)
{
Hull bestHull = null;
float bestValue = 0;
foreach (Hull hull in Hull.hullList)
{
if (hull.Submarine == null) { continue; }
if (!allowChangingTheSubmarine && hull.Submarine != character.Submarine) { continue; }
if (ignoredHulls != null && ignoredHulls.Contains(hull)) { continue; }
if (unreachable.Contains(hull)) { continue; }
float hullSafety = 0;
@@ -96,6 +96,12 @@ namespace Barotrauma
protected override void Act(float deltaTime)
{
if (character.LockHands)
{
abandon = true;
return;
}
FindTargetItem();
if (targetItem == null || moveToTarget == null)
{
@@ -37,14 +37,21 @@ namespace Barotrauma
float isSelected = character.SelectedConstruction == Item ? 50 : 0;
float devotion = (Math.Min(Priority, 10) + isSelected) / 100;
float max = MathHelper.Min(AIObjectiveManager.OrderPriority - 1, 90);
bool isCompleted = Item.IsFullCondition;
if (isCompleted && character.SelectedConstruction == Item)
{
character?.Speak(TextManager.GetWithVariable("DialogItemRepaired", "[itemname]", Item.Name, true), null, 0.0f, "itemrepaired", 10.0f);
}
return MathHelper.Lerp(0, max, MathHelper.Clamp(devotion + damagePriority * distanceFactor * successFactor * PriorityModifier, 0, 1));
}
public override bool IsCompleted()
{
bool isCompleted = Item.IsFullCondition;
if (isCompleted)
{
if (isCompleted && character.SelectedConstruction == Item)
{
character?.Speak(TextManager.GetWithVariable("DialogItemRepaired", "[itemname]", Item.Name, true), null, 0.0f, "itemrepaired", 10.0f);
}
return isCompleted;