Unstable 0.1300.1.11

This commit is contained in:
Markus Isberg
2021-04-26 21:07:23 +03:00
parent 841d755394
commit 2c750282ec
76 changed files with 671 additions and 396 deletions
@@ -245,6 +245,12 @@ namespace Barotrauma
{
IsCompleted = true;
}
else if (Enemy.IsKnockedDown &&
!objectiveManager.IsCurrentObjective<AIObjectiveFightIntruders>() &&
!HumanAIController.HasItem(character, "handlocker", out _, requireEquipped: false))
{
IsCompleted = true;
}
break;
}
}
@@ -738,7 +744,7 @@ namespace Barotrauma
},
onAbandon: () => Abandon = true);
if (followTargetObjective == null) { return; }
if (Mode == CombatMode.Arrest && (Enemy.Stun > 1 || Enemy.IsKnockedDown))
if (Mode == CombatMode.Arrest && Enemy.IsKnockedDown)
{
if (HumanAIController.HasItem(character, "handlocker", out _))
{
@@ -786,6 +792,23 @@ namespace Barotrauma
private void OnArrestTargetReached()
{
if (!Enemy.IsKnockedDown)
{
RemoveFollowTarget();
return;
}
if (character.TeamID == CharacterTeamType.FriendlyNPC)
{
// Confiscate stolen goods.
foreach (var item in Enemy.Inventory.AllItemsMod)
{
if (item.StolenDuringRound)
{
item.Drop(character);
character.Inventory.TryPutItem(item, character, CharacterInventory.anySlot);
}
}
}
if (HumanAIController.HasItem(character, "handlocker", out IEnumerable<Item> matchingItems) && !Enemy.IsUnconscious && Enemy.IsKnockedDown && character.CanInteractWith(Enemy))
{
var handCuffs = matchingItems.First();
@@ -794,20 +817,18 @@ namespace Barotrauma
#if DEBUG
DebugConsole.NewMessage($"{character.Name}: Failed to handcuff the target.", Color.Red);
#endif
}
// Confiscate stolen goods.
foreach (var item in Enemy.Inventory.AllItemsMod)
{
if (item == handCuffs) { continue; }
if (item.StolenDuringRound)
if (objectiveManager.IsCurrentObjective<AIObjectiveFightIntruders>())
{
item.Drop(character);
character.Inventory.TryPutItem(item, character, CharacterInventory.anySlot);
Abandon = true;
return;
}
}
character.Speak(TextManager.Get("DialogTargetArrested"), null, 3.0f, "targetarrested", 30.0f);
}
IsCompleted = true;
if (!objectiveManager.IsCurrentObjective<AIObjectiveFightIntruders>())
{
IsCompleted = true;
}
}
/// <summary>
@@ -941,14 +962,6 @@ namespace Barotrauma
return;
}
if (reloadTimer > 0) { return; }
if (Mode == CombatMode.Arrest)
{
// If the target is arrested or if it's stunned and we can't lock the target up, consider the objective done.
if (Enemy.IsKnockedDown && !HumanAIController.HasItem(character, "handlocker", out _, requireEquipped: false) || HumanAIController.HasItem(Enemy, "handlocker", out _, requireEquipped: true))
{
IsCompleted = true;
}
}
if (holdFireCondition != null && holdFireCondition()) { return; }
float sqrDist = Vector2.DistanceSquared(character.Position, Enemy.Position);
if (WeaponComponent is MeleeWeapon meleeWeapon)
@@ -334,9 +334,15 @@ namespace Barotrauma
return (int)Math.Round(MathHelper.Lerp(minValue, maxValue, Level.Loaded.Difficulty * 0.01f * Config.AgentSpawnCountDifficultyMultiplier));
}
private float GetSpawnTime() =>
Math.Max(Config.AgentSpawnDelay * Rand.Range(Config.AgentSpawnDelayRandomFactor, 1 + Config.AgentSpawnDelayRandomFactor)
/ (Math.Max(Level.Loaded.Difficulty, 1) * 0.01f * Config.AgentSpawnDelayDifficultyMultiplier), Config.AgentSpawnDelay);
private float GetSpawnTime()
{
float randomFactor = Config.AgentSpawnDelayRandomFactor;
float delay = Config.AgentSpawnDelay;
float min = delay;
float max = delay * 6;
float t = Level.Loaded.Difficulty * Config.AgentSpawnDelayDifficultyMultiplier * Rand.Range(1 - randomFactor, 1 + randomFactor);
return MathHelper.Lerp(max, min, MathUtils.InverseLerp(0, 100, t));
}
void UpdateReinforcements(float deltaTime)
{
@@ -3414,7 +3414,7 @@ namespace Barotrauma
/// Is the character knocked down regardless whether the technical state is dead, unconcious, paralyzed, or stunned.
/// With stunning, the parameter uses a half a second delay before the character is treated as knocked down. The purpose of this is to ignore minor stunning. If you don't want to to ignore any stun, use the Stun property.
/// </summary>
public bool IsKnockedDown => IsDead || IsIncapacitated || CharacterHealth.StunTimer > 0.5f;
public bool IsKnockedDown => IsDead || IsIncapacitated || CharacterHealth.StunTimer > 0.5f || IsRagdolled;
public void SetStun(float newStun, bool allowStunDecrease = false, bool isNetworkMessage = false)
{
@@ -131,7 +131,12 @@ namespace Barotrauma
public static string GetFolder(XDocument doc, string filePath)
{
var folder = doc.Root?.Element("animations")?.GetAttributeString("folder", string.Empty);
var root = doc.Root;
if (root?.IsOverride() ?? false)
{
root = root.FirstElement();
}
var folder = root?.Element("animations")?.GetAttributeString("folder", string.Empty);
if (string.IsNullOrEmpty(folder) || folder.Equals("default", StringComparison.OrdinalIgnoreCase))
{
folder = Path.Combine(Path.GetDirectoryName(filePath), "Animations");
@@ -105,7 +105,12 @@ namespace Barotrauma
public static string GetFolder(XDocument doc, string filePath)
{
var folder = doc.Root?.Element("ragdolls")?.GetAttributeString("folder", string.Empty);
var root = doc.Root;
if (root?.IsOverride() ?? false)
{
root = root.FirstElement();
}
var folder = root?.Element("ragdolls")?.GetAttributeString("folder", string.Empty);
if (string.IsNullOrEmpty(folder) || folder.Equals("default", StringComparison.OrdinalIgnoreCase))
{
folder = Path.Combine(Path.GetDirectoryName(filePath), "Ragdolls") + Path.DirectorySeparatorChar;