Tons of AI + pathfinding bugfixes:
- waypoints are created between docked subs and removed when they undock - fixed start waypoint being left out of steering paths - NPCs won't close doors/hatches on themselves - NPCs won't let go of ladders until their feet are above the lower edge of the hull - fixed FindDivingGear "loops": need to find a suit -> need to get to a suit -> need a suit to get to the suit -> need to find a suit... - fixed characters constantly turning from side to side in small rooms - recursive function for finding the button which opens a door (so a button doesn't have to be connected straight to a door for an NPC to be able to open it) - AIObjectiveGetItem keeps searching for more suitable items even if a path to a matching item has been found
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Barotrauma
|
||||
|
||||
if (currentHull != null)
|
||||
{
|
||||
if (currentHull.Volume / currentHull.FullVolume > 0.5f || character.Oxygen < 80.0f)
|
||||
if (NeedsDivingGear())
|
||||
{
|
||||
if (!FindDivingGear(deltaTime)) return;
|
||||
}
|
||||
@@ -131,6 +131,19 @@ namespace Barotrauma
|
||||
return (otherObjective is AIObjectiveFindSafety);
|
||||
}
|
||||
|
||||
private bool NeedsDivingGear()
|
||||
{
|
||||
var currentHull = character.AnimController.CurrentHull;
|
||||
if (currentHull == null) return true;
|
||||
|
||||
//there's lots of water in the room -> get a suit
|
||||
if (currentHull.Volume / currentHull.FullVolume > 0.5f) return true;
|
||||
|
||||
if (currentHull.OxygenPercentage < 30.0f) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override float GetPriority(Character character)
|
||||
{
|
||||
if (character.Oxygen < 80.0f)
|
||||
@@ -142,8 +155,12 @@ namespace Barotrauma
|
||||
currenthullSafety = GetHullSafety(character.AnimController.CurrentHull, character);
|
||||
priority = 100.0f - currenthullSafety;
|
||||
|
||||
if (divingGearObjective != null && !divingGearObjective.IsCompleted()) priority += 20.0f;
|
||||
|
||||
if (NeedsDivingGear())
|
||||
{
|
||||
if (divingGearObjective != null && !divingGearObjective.IsCompleted()) priority += 20.0f;
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user