Build 0.20.12.0

This commit is contained in:
Markus Isberg
2022-12-09 20:08:36 +02:00
parent a10cc13566
commit 6f788fb8b4
24 changed files with 203 additions and 456 deletions
@@ -915,7 +915,7 @@ namespace Barotrauma
else
{
// Wander around outside or swimming
steeringManager.SteeringWander();
steeringManager.SteeringWander(avoidWanderingOutsideLevel: true);
if (Character.AnimController.InWater)
{
SteeringManager.SteeringAvoid(deltaTime, lookAheadDistance: avoidLookAheadDistance, weight: 5);
@@ -1860,7 +1860,7 @@ namespace Barotrauma
{
if (Character.CurrentHull == null && !canAttack)
{
SteeringManager.SteeringWander();
SteeringManager.SteeringWander(avoidWanderingOutsideLevel: true);
SteeringManager.SteeringAvoid(deltaTime, lookAheadDistance: avoidLookAheadDistance, weight: 5);
}
else
@@ -3831,7 +3831,7 @@ namespace Barotrauma
}
else
{
SteeringManager.SteeringWander();
SteeringManager.SteeringWander(avoidWanderingOutsideLevel: Character.CurrentHull == null);
if (Character.CurrentHull == null)
{
SteeringManager.SteeringAvoid(deltaTime, lookAheadDistance: avoidLookAheadDistance, weight: 5);
@@ -43,9 +43,9 @@ namespace Barotrauma
steering += DoSteeringSeek(targetSimPos, weight);
}
public void SteeringWander(float weight = 1)
public void SteeringWander(float weight = 1, bool avoidWanderingOutsideLevel = false)
{
steering += DoSteeringWander(weight);
steering += DoSteeringWander(weight, avoidWanderingOutsideLevel);
}
public void SteeringAvoid(float deltaTime, float lookAheadDistance, float weight = 1)
@@ -119,7 +119,7 @@ namespace Barotrauma
//return newSteering;
}
protected virtual Vector2 DoSteeringWander(float weight)
protected virtual Vector2 DoSteeringWander(float weight, bool avoidWanderingOutsideLevel)
{
Vector2 circleCenter = (host.Steering == Vector2.Zero) ? Vector2.UnitY : host.Steering;
circleCenter = Vector2.Normalize(circleCenter) * CircleDistance;
@@ -127,19 +127,35 @@ namespace Barotrauma
Vector2 displacement = new Vector2(
(float)Math.Cos(wanderAngle),
(float)Math.Sin(wanderAngle));
displacement = displacement * CircleRadius;
displacement *= CircleRadius;
float angleChange = 1.5f;
wanderAngle += Rand.Range(0.0f, 1.0f) * angleChange - angleChange * 0.5f;
Vector2 newSteering = circleCenter + displacement;
if (avoidWanderingOutsideLevel && Level.Loaded != null)
{
float margin = 5000.0f;
if (host.WorldPosition.X < -margin)
{
// Too far left
newSteering.X += (-margin - host.WorldPosition.X) * weight / margin;
}
else if (host.WorldPosition.X > Level.Loaded.Size.X - margin)
{
// Too far right
newSteering.X -= (host.WorldPosition.X - (Level.Loaded.Size.X - margin)) * weight / margin;
}
}
float steeringSpeed = (newSteering + host.Steering).Length();
if (steeringSpeed > weight)
{
newSteering = Vector2.Normalize(newSteering) * weight;
}
return newSteering;
}
@@ -377,6 +377,7 @@ namespace Barotrauma
public readonly bool HealableInMedicalClinic;
public readonly float HealCostMultiplier;
public readonly int BaseHealCost;
public readonly bool ShowBarInHealthMenu;
public readonly LocalizedString CauseOfDeathDescription, SelfCauseOfDeathDescription;
@@ -473,6 +474,8 @@ namespace Barotrauma
IsBuff = element.GetAttributeBool(nameof(IsBuff), false);
AffectMachines = element.GetAttributeBool(nameof(AffectMachines), true);
ShowBarInHealthMenu = element.GetAttributeBool("showbarinhealthmenu", true);
HealableInMedicalClinic = element.GetAttributeBool("healableinmedicalclinic",
!IsBuff &&
AfflictionType != "geneticmaterialbuff" &&
@@ -10,12 +10,15 @@ namespace Barotrauma.Abilities
private readonly bool inSameRoom;
private readonly ImmutableHashSet<Identifier> jobIdentifiers;
public override bool AllowClientSimulation { get; }
public CharacterAbilityApplyStatusEffectsToAllies(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
allowSelf = abilityElement.GetAttributeBool("allowself", true);
maxDistance = abilityElement.GetAttributeFloat("maxdistance", float.MaxValue);
inSameRoom = abilityElement.GetAttributeBool("insameroom", false);
jobIdentifiers = abilityElement.GetAttributeIdentifierImmutableHashSet("jobs", ImmutableHashSet<Identifier>.Empty);
AllowClientSimulation = abilityElement.GetAttributeBool("allowclientsimulation", true);
}