(5f6bab490) Fixed AI characters being unable to open doors w/ the built-in buttons
This commit is contained in:
@@ -388,13 +388,25 @@ namespace Barotrauma
|
|||||||
buttonPressCooldown = ButtonPressInterval;
|
buttonPressCooldown = ButtonPressInterval;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!door.HasRequiredItems(character, false) && shouldBeOpen)
|
||||||
|
{
|
||||||
|
currentPath.Unreachable = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
door.Item.TryInteract(character, false, true, true);
|
||||||
|
buttonPressCooldown = ButtonPressInterval;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float? GetNodePenalty(PathNode node, PathNode nextNode)
|
private float? GetNodePenalty(PathNode node, PathNode nextNode)
|
||||||
{
|
{
|
||||||
if (character == null) return 0.0f;
|
if (character == null) { return 0.0f; }
|
||||||
|
|
||||||
float penalty = 0.0f;
|
float penalty = 0.0f;
|
||||||
if (nextNode.Waypoint.ConnectedGap != null && nextNode.Waypoint.ConnectedGap.Open < 0.9f)
|
if (nextNode.Waypoint.ConnectedGap != null && nextNode.Waypoint.ConnectedGap.Open < 0.9f)
|
||||||
@@ -403,21 +415,23 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
penalty = 100.0f;
|
penalty = 100.0f;
|
||||||
}
|
}
|
||||||
|
else if (!canBreakDoors)
|
||||||
if (!canBreakDoors)
|
|
||||||
{
|
{
|
||||||
//door closed and the character can't open doors -> node can't be traversed
|
//door closed and the character can't open doors -> node can't be traversed
|
||||||
if (!canOpenDoors || character.LockHands) return null;
|
if (!canOpenDoors || character.LockHands) { return null; }
|
||||||
|
|
||||||
var doorButtons = nextNode.Waypoint.ConnectedDoor.Item.GetConnectedComponents<Controller>();
|
var doorButtons = nextNode.Waypoint.ConnectedDoor.Item.GetConnectedComponents<Controller>();
|
||||||
if (!doorButtons.Any()) return null;
|
if (!doorButtons.Any())
|
||||||
|
{
|
||||||
|
if (!nextNode.Waypoint.ConnectedDoor.HasRequiredItems(character, false)) { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Controller button in doorButtons)
|
foreach (Controller button in doorButtons)
|
||||||
{
|
{
|
||||||
if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) !=
|
if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) !=
|
||||||
Math.Sign(node.Position.X - nextNode.Position.X)) continue;
|
Math.Sign(node.Position.X - nextNode.Position.X)) { continue; }
|
||||||
|
|
||||||
if (!button.HasRequiredItems(character, false)) return null;
|
if (!button.HasRequiredItems(character, false)) { return null; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,6 +166,25 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string DisplayName
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string roomName;
|
||||||
|
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
|
||||||
|
public string RoomName
|
||||||
|
{
|
||||||
|
get { return roomName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (roomName == value) { return; }
|
||||||
|
roomName = value;
|
||||||
|
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Rectangle Rect
|
public override Rectangle Rect
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
Reference in New Issue
Block a user