- fixed AICharacters being updated even if they're disabled
- enemies can spot targets from further away if they've previously spotted the target - physics bodies are immediately moved to the correct position if they're really far (instead of lerping)
This commit is contained in:
@@ -73,6 +73,6 @@
|
|||||||
<joint limb1="0" limb1anchor="160,50" limb2="9" limb2anchor="0,-200" lowerlimit="-50" upperlimit="20"/>
|
<joint limb1="0" limb1anchor="160,50" limb2="9" limb2anchor="0,-200" lowerlimit="-50" upperlimit="20"/>
|
||||||
</ragdoll>
|
</ragdoll>
|
||||||
|
|
||||||
<ai attackrooms="100.0" attackweaker="50" attackstronger="-30" sight="0.5" hearing="1.0"/>
|
<ai attackrooms="100.0" attackweaker="50" attackstronger="-30" sight="0.1" hearing="2.0"/>
|
||||||
</Character>
|
</Character>
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<Sprite texture ="DivingMask.png" depth="0.5"/>
|
<Sprite texture ="DivingMask.png" depth="0.5"/>
|
||||||
|
|
||||||
<Body radius="18" density="20"/>
|
<Body radius="18" density="15"/>
|
||||||
|
|
||||||
<Wearable limbtype="Head" slots="Any,Head">
|
<Wearable limbtype="Head" slots="Any,Head">
|
||||||
<sprite texture="DivingMask.png" limb="Head" sourcerect="1,1,37,38"/>
|
<sprite texture="DivingMask.png" limb="Head" sourcerect="1,1,37,38"/>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
<Sprite texture ="DivingSuit.png" sourcerect="82,0,46,128" depth="0.55"/>
|
<Sprite texture ="DivingSuit.png" sourcerect="82,0,46,128" depth="0.55"/>
|
||||||
|
|
||||||
<Body width="37" height="113" density="50"/>
|
<Body width="37" height="113" density="15"/>
|
||||||
|
|
||||||
<Wearable slots="Head+Torso+Legs" armorvalue="10.0">
|
<Wearable slots="Head+Torso+Legs" armorvalue="10.0">
|
||||||
<sprite texture="DivingSuit.png" limb="Head" sourcerect="0,0,1,1" origin="0.5,0.5" hidelimb="true"/>
|
<sprite texture="DivingSuit.png" limb="Head" sourcerect="0,0,1,1" origin="0.5,0.5" hidelimb="true"/>
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
<Sprite texture ="DivingSuit.png" depth="0.5" sourcerect="22,98,59,32" origin="0.6,0.66"/>
|
<Sprite texture ="DivingSuit.png" depth="0.5" sourcerect="22,98,59,32" origin="0.6,0.66"/>
|
||||||
|
|
||||||
<Body width="55" height="30" density="20"/>
|
<Body width="55" height="30" density="15"/>
|
||||||
|
|
||||||
<Holdable slots="Any,RightHand+LeftHand" aimpos="100,0" handle1="0,11" handle2="2,11"/>
|
<Holdable slots="Any,RightHand+LeftHand" aimpos="100,0" handle1="0,11" handle2="2,11"/>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static List<AITarget> List = new List<AITarget>();
|
public static List<AITarget> List = new List<AITarget>();
|
||||||
|
|
||||||
public Entity Entity;
|
public readonly Entity Entity;
|
||||||
|
|
||||||
private float soundRange;
|
private float soundRange;
|
||||||
private float sightRange;
|
private float sightRange;
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
valueModifier = attackHumans;
|
valueModifier = attackHumans;
|
||||||
}
|
}
|
||||||
else if (target.Entity!=null && attackRooms!=0.0f)
|
else if (target.Entity!=null && attackRooms != 0.0f)
|
||||||
{
|
{
|
||||||
//skip the target if it's the room the Character is inside of
|
//skip the target if it's the room the Character is inside of
|
||||||
if (character.AnimController.CurrentHull != null && character.AnimController.CurrentHull == target.Entity as Hull) continue;
|
if (character.AnimController.CurrentHull != null && character.AnimController.CurrentHull == target.Entity as Hull) continue;
|
||||||
@@ -450,12 +450,17 @@ namespace Barotrauma
|
|||||||
character.WorldPosition,
|
character.WorldPosition,
|
||||||
target.WorldPosition);
|
target.WorldPosition);
|
||||||
|
|
||||||
|
//if the target has been within range earlier, the character will notice it more easily
|
||||||
|
//(i.e. remember where the target was)
|
||||||
|
if (targetMemories.ContainsKey(target)) dist *= 0.5f;
|
||||||
|
|
||||||
|
//ignore target if it's too far to see or hear
|
||||||
|
if (dist > target.SightRange * sight && dist > target.SoundRange * hearing) continue;
|
||||||
|
|
||||||
AITargetMemory targetMemory = FindTargetMemory(target);
|
AITargetMemory targetMemory = FindTargetMemory(target);
|
||||||
|
|
||||||
valueModifier = valueModifier * targetMemory.Priority / dist;
|
valueModifier = valueModifier * targetMemory.Priority / dist;
|
||||||
//dist -= targetMemory.Priority;
|
|
||||||
|
|
||||||
if (Math.Abs(valueModifier) > Math.Abs(targetValue) && (dist < target.SightRange * sight || dist < target.SoundRange * hearing))
|
if (Math.Abs(valueModifier) > Math.Abs(targetValue))
|
||||||
{
|
{
|
||||||
Vector2 rayStart = character.AnimController.Limbs[0].SimPosition;
|
Vector2 rayStart = character.AnimController.Limbs[0].SimPosition;
|
||||||
Vector2 rayEnd = target.SimPosition;
|
Vector2 rayEnd = target.SimPosition;
|
||||||
@@ -517,7 +522,7 @@ namespace Barotrauma
|
|||||||
foreach(KeyValuePair<AITarget, AITargetMemory> memory in targetMemories)
|
foreach(KeyValuePair<AITarget, AITargetMemory> memory in targetMemories)
|
||||||
{
|
{
|
||||||
memory.Value.Priority += 0.5f;
|
memory.Value.Priority += 0.5f;
|
||||||
if (memory.Value.Priority == 0.0f || !AITarget.List.Contains(memory.Key)) toBeRemoved.Add(memory.Key);
|
if (Math.Abs(memory.Value.Priority) < 1.0f || !AITarget.List.Contains(memory.Key)) toBeRemoved.Add(memory.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (AITarget target in toBeRemoved)
|
foreach (AITarget target in toBeRemoved)
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void Update(Camera cam, float deltaTime)
|
public override void Update(Camera cam, float deltaTime)
|
||||||
{
|
{
|
||||||
|
if (!Enabled) return;
|
||||||
|
|
||||||
base.Update(cam, deltaTime);
|
base.Update(cam, deltaTime);
|
||||||
|
|
||||||
float dist = Vector2.Distance(cam.WorldViewCenter, WorldPosition);
|
float dist = Vector2.Distance(cam.WorldViewCenter, WorldPosition);
|
||||||
|
|||||||
@@ -417,11 +417,8 @@ namespace Barotrauma
|
|||||||
new GUIMessageBox(commands[1], commands[2]);
|
new GUIMessageBox(commands[1], commands[2]);
|
||||||
break;
|
break;
|
||||||
case "debugdraw":
|
case "debugdraw":
|
||||||
//Hull.DebugDraw = !Hull.DebugDraw;
|
|
||||||
//Ragdoll.DebugDraw = !Ragdoll.DebugDraw;
|
|
||||||
GameMain.DebugDraw = !GameMain.DebugDraw;
|
GameMain.DebugDraw = !GameMain.DebugDraw;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "drawaitargets":
|
case "drawaitargets":
|
||||||
case "showaitargets":
|
case "showaitargets":
|
||||||
AITarget.ShowAITargets = !AITarget.ShowAITargets;
|
AITarget.ShowAITargets = !AITarget.ShowAITargets;
|
||||||
@@ -429,11 +426,11 @@ namespace Barotrauma
|
|||||||
case "sendrandomdata":
|
case "sendrandomdata":
|
||||||
int messageCount = 1;
|
int messageCount = 1;
|
||||||
|
|
||||||
if (commands.Length>1) int.TryParse(commands[1], out messageCount);
|
if (commands.Length > 1) int.TryParse(commands[1], out messageCount);
|
||||||
|
|
||||||
for (int i = 0; i < messageCount; i++ )
|
for (int i = 0; i < messageCount; i++)
|
||||||
{
|
{
|
||||||
if (GameMain.Server!=null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
GameMain.Server.SendRandomData();
|
GameMain.Server.SendRandomData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (limb.SimPosition == Vector2.Zero || pointDist > radius) continue;
|
if (limb.SimPosition == Vector2.Zero || pointDist > radius) continue;
|
||||||
|
|
||||||
if (pointDist > radius) continue;
|
|
||||||
if (pointDist > prevPingRadius && pointDist < pingRadius)
|
if (pointDist > prevPingRadius && pointDist < pingRadius)
|
||||||
{
|
{
|
||||||
for (int i = 0; i<=limb.Mass/100.0f; i++)
|
for (int i = 0; i<=limb.Mass/100.0f; i++)
|
||||||
|
|||||||
@@ -352,8 +352,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
FireSource.UpdateAll(fireSources, deltaTime);
|
FireSource.UpdateAll(fireSources, deltaTime);
|
||||||
|
|
||||||
aiTarget.SightRange = Submarine == null ? 0.0f : Submarine.Velocity.Length() * 500.0f;
|
aiTarget.SightRange = Submarine == null ? 0.0f : Math.Max(Submarine.Velocity.Length() * 500.0f, 500.0f);
|
||||||
aiTarget.SoundRange -= deltaTime*1000.0f;
|
aiTarget.SoundRange -= deltaTime * 1000.0f;
|
||||||
|
|
||||||
float strongestFlow = 0.0f;
|
float strongestFlow = 0.0f;
|
||||||
foreach (Gap gap in ConnectedGaps)
|
foreach (Gap gap in ConnectedGaps)
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lerp)
|
if (lerp && Vector2.Distance(targetPosition, body.Position)<10.0f)
|
||||||
{
|
{
|
||||||
offsetFromTargetPos = targetPosition - (body.Position - offsetFromTargetPos);
|
offsetFromTargetPos = targetPosition - (body.Position - offsetFromTargetPos);
|
||||||
prevPosition = targetPosition;
|
prevPosition = targetPosition;
|
||||||
|
|||||||
Reference in New Issue
Block a user