v1.1.19.3 (Treacherous Tides Hotfix 2)

This commit is contained in:
Regalis11
2023-10-30 17:38:29 +02:00
parent b968376247
commit a8f9c97dda
38 changed files with 517 additions and 256 deletions
@@ -167,10 +167,6 @@ namespace Barotrauma
public HumanAIController(Character c) : base(c)
{
if (!c.IsHuman)
{
throw new Exception($"Tried to create a human ai controller for a non-human: {c.SpeciesName}!");
}
insideSteering = new IndoorsSteeringManager(this, true, false);
outsideSteering = new SteeringManager(this);
objectiveManager = new AIObjectiveManager(c);
@@ -1223,19 +1223,15 @@ namespace Barotrauma
public static Character Create(CharacterPrefab prefab, Vector2 position, string seed, CharacterInfo characterInfo = null, ushort id = Entity.NullEntityID, bool isRemotePlayer = false, bool hasAi = true, bool createNetworkEvent = true, RagdollParams ragdoll = null, bool spawnInitialItems = true)
{
Character newCharacter = null;
if (prefab.Identifier != CharacterPrefab.HumanSpeciesName)
if (prefab.Identifier != CharacterPrefab.HumanSpeciesName || hasAi)
{
var aiCharacter = new AICharacter(prefab, position, seed, characterInfo, id, isRemotePlayer, ragdoll, spawnInitialItems);
var ai = new EnemyAIController(aiCharacter, seed);
var ai = (prefab.Identifier == CharacterPrefab.HumanSpeciesName || aiCharacter.Params.UseHumanAI) ?
new HumanAIController(aiCharacter) as AIController :
new EnemyAIController(aiCharacter, seed);
aiCharacter.SetAI(ai);
newCharacter = aiCharacter;
}
else if (hasAi)
{
var aiCharacter = new AICharacter(prefab, position, seed, characterInfo, id, isRemotePlayer, ragdoll, spawnInitialItems);
var ai = new HumanAIController(aiCharacter);
aiCharacter.SetAI(ai);
newCharacter = aiCharacter;
newCharacter = aiCharacter;
}
else
{
@@ -4656,7 +4652,7 @@ namespace Barotrauma
}
partial void KillProjSpecific(CauseOfDeathType causeOfDeath, Affliction causeOfDeathAffliction, bool log);
public void Revive(bool removeAfflictions = true)
public void Revive(bool removeAfflictions = true, bool createNetworkEvent = false)
{
if (Removed)
{
@@ -4705,7 +4701,11 @@ namespace Barotrauma
limb.IsSevered = false;
}
GameMain.GameSession?.ReviveCharacter(this);
GameMain.GameSession?.ReviveCharacter(this);
if (createNetworkEvent && GameMain.NetworkMember is { IsServer: true })
{
GameMain.NetworkMember.CreateEntityEvent(this, new CharacterStatusEventData());
}
}
public override void Remove()
@@ -148,11 +148,6 @@ namespace Barotrauma
return minVitality;
}
return vitality;
}
private set
{
vitality = value;
}
}
@@ -254,7 +249,7 @@ namespace Barotrauma
public CharacterHealth(Character character)
{
this.Character = character;
Vitality = 100.0f;
vitality = 100.0f;
DoesBleed = true;
UseHealthWindow = false;
@@ -271,7 +266,7 @@ namespace Barotrauma
this.Character = character;
InitIrremovableAfflictions();
Vitality = UnmodifiedMaxVitality;
vitality = UnmodifiedMaxVitality;
minVitality = character.IsHuman ? -100.0f : 0.0f;
@@ -971,7 +966,7 @@ namespace Barotrauma
public void CalculateVitality()
{
Vitality = MaxVitality;
vitality = MaxVitality;
IsParalyzed = false;
if (Unkillable || Character.GodMode) { return; }
@@ -984,7 +979,7 @@ namespace Barotrauma
{
vitalityDecrease *= GetVitalityMultiplier(affliction, limbHealth);
}
Vitality -= vitalityDecrease;
vitality -= vitalityDecrease;
affliction.CalculateDamagePerSecond(vitalityDecrease);
if (affliction.Strength >= affliction.Prefab.MaxStrength &&
@@ -50,6 +50,9 @@ namespace Barotrauma
[Serialize(false, IsPropertySaveable.Yes, description: "Can the creature live without water or does it die on dry land?"), Editable]
public bool NeedsWater { get; set; }
[Serialize(false, IsPropertySaveable.Yes, description: "Note: non-humans with a human AI aren't fully supported. Enabling this on a non-human character may lead to issues.")]
public bool UseHumanAI { get; set; }
[Serialize(false, IsPropertySaveable.Yes, description: "Is this creature an artificial creature, like robot or machine that shouldn't be affected by afflictions that affect only organic creatures? Overrides DoesBleed."), Editable]
public bool IsMachine { get; set; }