- 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">
|
<ragdoll waveamplitude="50.0" wavelength="500" swimspeed="3.0" walkspeed="0.3" flip="false" canentersubmarine="false">
|
||||||
|
|
||||||
<!-- head -->
|
<!-- 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"/>
|
<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"/>
|
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="20" damagetype="blunt" targetforce="80"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
<!-- body -->
|
<!-- 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"/>
|
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,125,108,105" depth="0.03" origin="0.5,0.5"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
<!-- body -->
|
<!-- 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"/>
|
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,239,90,136" depth="0.02" origin="0.5,0.5"/>
|
||||||
</limb>
|
</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"/>
|
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.01" origin="0.5,0.5"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<ragdoll waveamplitude="0.0" swimspeed="1.0" walkspeed="0.3" flip="false" canentersubmarine="false" rotatetowardsmovement="false">
|
<ragdoll waveamplitude="0.0" swimspeed="1.0" walkspeed="0.3" flip="false" canentersubmarine="false" rotatetowardsmovement="false">
|
||||||
|
|
||||||
<!-- head -->
|
<!-- 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"/>
|
<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"/>
|
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="20" damagetype="blunt" targetforce="100"/>
|
||||||
</limb>
|
</limb>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<limb id = "1" width="30" height="178" impacttolerance="100.0">
|
<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"/>
|
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="183,60,53,178" depth="0.08" origin="0.5,0.5"/>
|
||||||
</limb>
|
</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"/>
|
<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"/>
|
<attack type="PinchCCW" range="150" duration="0.5" damage="30" stun="1.0" damagetype="slash"/>
|
||||||
</limb>
|
</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"/>
|
<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>
|
||||||
|
|
||||||
<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"/>
|
<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"/>
|
<attack type="PinchCW" range="150" duration="0.5" damage="30" stun="1.0" damagetype="slash"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace Barotrauma
|
|||||||
//negative values = escapes targets of this type
|
//negative values = escapes targets of this type
|
||||||
private float attackRooms, attackHumans, attackWeaker, attackStronger;
|
private float attackRooms, attackHumans, attackWeaker, attackStronger;
|
||||||
|
|
||||||
|
private SteeringManager outsideSteering, insideSteering;
|
||||||
|
|
||||||
private float updateTargetsTimer;
|
private float updateTargetsTimer;
|
||||||
|
|
||||||
private float raycastTimer;
|
private float raycastTimer;
|
||||||
@@ -88,7 +90,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
attackWhenProvoked = ToolBox.GetAttributeBool(aiElement, "attackwhenprovoked", false);
|
attackWhenProvoked = ToolBox.GetAttributeBool(aiElement, "attackwhenprovoked", false);
|
||||||
|
|
||||||
steeringManager = new SteeringManager(this);
|
outsideSteering = new SteeringManager(this);
|
||||||
|
insideSteering = new IndoorsSteeringManager(this, false);
|
||||||
|
|
||||||
|
steeringManager = outsideSteering;
|
||||||
|
|
||||||
state = AiState.None;
|
state = AiState.None;
|
||||||
}
|
}
|
||||||
@@ -135,6 +140,8 @@ namespace Barotrauma
|
|||||||
//if (coolDownTimer >= 0.0f) return;
|
//if (coolDownTimer >= 0.0f) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
steeringManager = Character.Submarine == null ? outsideSteering : insideSteering;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case AiState.None:
|
case AiState.None:
|
||||||
@@ -210,7 +217,7 @@ namespace Barotrauma
|
|||||||
raycastTimer = RaycastInterval;
|
raycastTimer = RaycastInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
//steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
||||||
steeringManager.SteeringSeek(attackSimPosition);
|
steeringManager.SteeringSeek(attackSimPosition);
|
||||||
|
|
||||||
//check if any of the limbs is close enough to attack the target
|
//check if any of the limbs is close enough to attack the target
|
||||||
@@ -253,6 +260,12 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
targetEntity = null;
|
targetEntity = null;
|
||||||
|
|
||||||
|
if (Character.AnimController.CurrentHull != null)
|
||||||
|
{
|
||||||
|
wallAttackPos = Vector2.Zero;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//check if there's a wall between the target and the Character
|
//check if there's a wall between the target and the Character
|
||||||
Vector2 rayStart = Character.SimPosition;
|
Vector2 rayStart = Character.SimPosition;
|
||||||
Vector2 rayEnd = selectedAiTarget.SimPosition;
|
Vector2 rayEnd = selectedAiTarget.SimPosition;
|
||||||
@@ -274,7 +287,7 @@ namespace Barotrauma
|
|||||||
if (wall == null)
|
if (wall == null)
|
||||||
{
|
{
|
||||||
wallAttackPos = Submarine.LastPickedPosition;
|
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
|
else
|
||||||
@@ -370,7 +383,6 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dist < limb.attack.Range)
|
if (dist < limb.attack.Range)
|
||||||
{
|
{
|
||||||
attackTimer += deltaTime;
|
attackTimer += deltaTime;
|
||||||
@@ -413,6 +425,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
distanceAccumulator = 0.0f;
|
distanceAccumulator = 0.0f;
|
||||||
|
|
||||||
|
wallAttackPos = Vector2.Zero;
|
||||||
|
|
||||||
selectedAiTarget = null;
|
selectedAiTarget = null;
|
||||||
selectedTargetMemory = null;
|
selectedTargetMemory = null;
|
||||||
targetValue = 0.0f;
|
targetValue = 0.0f;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (inWater)
|
if (inWater || RefLimb.inWater)
|
||||||
{
|
{
|
||||||
UpdateSineAnim(deltaTime);
|
UpdateSineAnim(deltaTime);
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mirror)
|
if (mirror || !inWater)
|
||||||
{
|
{
|
||||||
if (!character.IsNetworkPlayer)
|
if (!character.IsNetworkPlayer)
|
||||||
{
|
{
|
||||||
@@ -278,28 +278,44 @@ namespace Barotrauma
|
|||||||
//out whether the ragdoll is standing on ground
|
//out whether the ragdoll is standing on ground
|
||||||
float closestFraction = 1;
|
float closestFraction = 1;
|
||||||
//Structure closestStructure = null;
|
//Structure closestStructure = null;
|
||||||
|
|
||||||
GameMain.World.RayCast((fixture, point, normal, fraction) =>
|
GameMain.World.RayCast((fixture, point, normal, fraction) =>
|
||||||
{
|
{
|
||||||
//other limbs and bodies with no collision detection are ignored
|
switch (fixture.CollisionCategories)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
if (structure.StairDirection != Direction.None && (stairs == null)) return -1;
|
case Physics.CollisionStairs:
|
||||||
if (structure.IsPlatform && (IgnorePlatforms || stairs != null)) return -1;
|
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;
|
onGround = true;
|
||||||
|
if (fraction < closestFraction)
|
||||||
|
{
|
||||||
|
closestFraction = fraction;
|
||||||
|
}
|
||||||
onFloorTimer = 0.05f;
|
onFloorTimer = 0.05f;
|
||||||
|
return closestFraction;
|
||||||
if (fraction < closestFraction) closestFraction = fraction;
|
} , rayStart, rayEnd);
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
, rayStart, rayEnd);
|
|
||||||
|
|
||||||
//the ragdoll "stays on ground" for 50 millisecs after separation
|
//the ragdoll "stays on ground" for 50 millisecs after separation
|
||||||
if (onFloorTimer <= 0.0f)
|
if (onFloorTimer <= 0.0f)
|
||||||
|
|||||||
Reference in New Issue
Block a user