- fractal guardians have higher impact tolerance to stop them from killing themselves by slamming at the walls
- enemies use pathfinding when inside the sub and handle platforms/stairs better
This commit is contained in:
@@ -7,22 +7,22 @@
|
||||
<ragdoll waveamplitude="50.0" wavelength="500" swimspeed="3.0" walkspeed="0.3" flip="false" canentersubmarine="false">
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="65" type="Head" steerforce="3.0">
|
||||
<limb id = "0" radius="65" type="Head" steerforce="3.0" impacttolerance="100">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,0,129,128" depth="0.04"/>
|
||||
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="20" damagetype="blunt" targetforce="80"/>
|
||||
</limb>
|
||||
|
||||
<!-- body -->
|
||||
<limb id = "1" radius="50" type="Torso">
|
||||
<limb id = "1" radius="50" type="Torso" impacttolerance="100">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,125,108,105" depth="0.03" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<!-- body -->
|
||||
<limb id = "2" radius="45" height="75" type="Torso">
|
||||
<limb id = "2" radius="45" height="75" type="Torso" impacttolerance="100">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,239,90,136" depth="0.02" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "3" width="30" height="175" type="Tail">
|
||||
<limb id = "3" width="30" height="175" type="Tail" impacttolerance="100">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.01" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<ragdoll waveamplitude="0.0" swimspeed="1.0" walkspeed="0.3" flip="false" canentersubmarine="false" rotatetowardsmovement="false">
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="80" height="30" type="Head" steerforce="3.0">
|
||||
<limb id = "0" radius="80" height="30" type="Head" steerforce="3.0" impacttolerance="100">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="299,0,171,208" depth="0.05"/>
|
||||
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="20" damagetype="blunt" targetforce="100"/>
|
||||
</limb>
|
||||
@@ -16,7 +16,7 @@
|
||||
<limb id = "1" width="30" height="178" impacttolerance="100.0">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="183,60,53,178" depth="0.08" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
<limb id = "2" width="30" height="175">
|
||||
<limb id = "2" width="30" height="175" impacttolerance="100">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.1" origin="0.5,0.5"/>
|
||||
<attack type="PinchCCW" range="150" duration="0.5" damage="30" stun="1.0" damagetype="slash"/>
|
||||
</limb>
|
||||
@@ -25,7 +25,7 @@
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="236,60,53,178" size="-1,1" depth="0.08" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "4" width="30" height="175">
|
||||
<limb id = "4" width="30" height="175" impacttolerance="100">
|
||||
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.1" origin="0.5,0.5"/>
|
||||
<attack type="PinchCW" range="150" duration="0.5" damage="30" stun="1.0" damagetype="slash"/>
|
||||
</limb>
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace Barotrauma
|
||||
//negative values = escapes targets of this type
|
||||
private float attackRooms, attackHumans, attackWeaker, attackStronger;
|
||||
|
||||
private SteeringManager outsideSteering, insideSteering;
|
||||
|
||||
private float updateTargetsTimer;
|
||||
|
||||
private float raycastTimer;
|
||||
@@ -88,7 +90,10 @@ namespace Barotrauma
|
||||
|
||||
attackWhenProvoked = ToolBox.GetAttributeBool(aiElement, "attackwhenprovoked", false);
|
||||
|
||||
steeringManager = new SteeringManager(this);
|
||||
outsideSteering = new SteeringManager(this);
|
||||
insideSteering = new IndoorsSteeringManager(this, false);
|
||||
|
||||
steeringManager = outsideSteering;
|
||||
|
||||
state = AiState.None;
|
||||
}
|
||||
@@ -133,7 +138,9 @@ namespace Barotrauma
|
||||
state = (targetValue > 0.0f) ? AiState.Attack : AiState.Escape;
|
||||
}
|
||||
//if (coolDownTimer >= 0.0f) return;
|
||||
}
|
||||
}
|
||||
|
||||
steeringManager = Character.Submarine == null ? outsideSteering : insideSteering;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@@ -210,7 +217,7 @@ namespace Barotrauma
|
||||
raycastTimer = RaycastInterval;
|
||||
}
|
||||
|
||||
steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
||||
//steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
||||
steeringManager.SteeringSeek(attackSimPosition);
|
||||
|
||||
//check if any of the limbs is close enough to attack the target
|
||||
@@ -252,6 +259,12 @@ namespace Barotrauma
|
||||
private void GetTargetEntity()
|
||||
{
|
||||
targetEntity = null;
|
||||
|
||||
if (Character.AnimController.CurrentHull != null)
|
||||
{
|
||||
wallAttackPos = Vector2.Zero;
|
||||
return;
|
||||
}
|
||||
|
||||
//check if there's a wall between the target and the Character
|
||||
Vector2 rayStart = Character.SimPosition;
|
||||
@@ -274,7 +287,7 @@ namespace Barotrauma
|
||||
if (wall == null)
|
||||
{
|
||||
wallAttackPos = Submarine.LastPickedPosition;
|
||||
if (selectedAiTarget.Entity.Submarine!=null) wallAttackPos -= ConvertUnits.ToSimUnits(selectedAiTarget.Entity.Submarine.Position);
|
||||
if (selectedAiTarget.Entity.Submarine!=null && Character.Submarine == null) wallAttackPos -= ConvertUnits.ToSimUnits(selectedAiTarget.Entity.Submarine.Position);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -370,7 +383,6 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (dist < limb.attack.Range)
|
||||
{
|
||||
attackTimer += deltaTime;
|
||||
@@ -413,6 +425,8 @@ namespace Barotrauma
|
||||
}
|
||||
distanceAccumulator = 0.0f;
|
||||
|
||||
wallAttackPos = Vector2.Zero;
|
||||
|
||||
selectedAiTarget = null;
|
||||
selectedTargetMemory = null;
|
||||
targetValue = 0.0f;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inWater)
|
||||
if (inWater || RefLimb.inWater)
|
||||
{
|
||||
UpdateSineAnim(deltaTime);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (mirror)
|
||||
if (mirror || !inWater)
|
||||
{
|
||||
if (!character.IsNetworkPlayer)
|
||||
{
|
||||
@@ -278,28 +278,44 @@ namespace Barotrauma
|
||||
//out whether the ragdoll is standing on ground
|
||||
float closestFraction = 1;
|
||||
//Structure closestStructure = null;
|
||||
|
||||
GameMain.World.RayCast((fixture, point, normal, fraction) =>
|
||||
{
|
||||
//other limbs and bodies with no collision detection are ignored
|
||||
if (fixture == null ||
|
||||
fixture.CollisionCategories == Physics.CollisionCharacter ||
|
||||
fixture.CollisionCategories == Physics.CollisionNone ||
|
||||
fixture.CollisionCategories == Physics.CollisionItem) return -1;
|
||||
|
||||
Structure structure = fixture.Body.UserData as Structure;
|
||||
if (structure != null)
|
||||
switch (fixture.CollisionCategories)
|
||||
{
|
||||
if (structure.StairDirection != Direction.None && (stairs == null)) return -1;
|
||||
if (structure.IsPlatform && (IgnorePlatforms || stairs != null)) return -1;
|
||||
case Physics.CollisionStairs:
|
||||
if (inWater && TargetMovement.Y < 0.5f) return -1;
|
||||
Structure structure = fixture.Body.UserData as Structure;
|
||||
if (stairs == null && structure != null)
|
||||
{
|
||||
if (LowestLimb.SimPosition.Y < structure.SimPosition.Y)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
stairs = structure;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Physics.CollisionPlatform:
|
||||
Structure platform = fixture.Body.UserData as Structure;
|
||||
if (IgnorePlatforms || LowestLimb.Position.Y < platform.Rect.Y) return -1;
|
||||
break;
|
||||
case Physics.CollisionWall:
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
onGround = true;
|
||||
if (fraction < closestFraction)
|
||||
{
|
||||
closestFraction = fraction;
|
||||
}
|
||||
onFloorTimer = 0.05f;
|
||||
|
||||
if (fraction < closestFraction) closestFraction = fraction;
|
||||
return 1;
|
||||
}
|
||||
, rayStart, rayEnd);
|
||||
return closestFraction;
|
||||
} , rayStart, rayEnd);
|
||||
|
||||
//the ragdoll "stays on ground" for 50 millisecs after separation
|
||||
if (onFloorTimer <= 0.0f)
|
||||
|
||||
Reference in New Issue
Block a user