(91366496d) Removed connection displayname attributes from ItemAssemblies (ended up there with liberal use of Find & Replace, but it's better to use values from the item prefab)

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:48:06 +03:00
parent 90e1786f92
commit 1973a824bf
4 changed files with 25 additions and 14 deletions
@@ -218,6 +218,22 @@ namespace Barotrauma
return true; return true;
} }
private bool RefreshJoinButtonState(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) { return false; }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{
joinButton.Enabled = true;
}
else
{
joinButton.Enabled = false;
}
return true;
}
private bool SelectServer(GUIComponent component, object obj) private bool SelectServer(GUIComponent component, object obj)
{ {
if (obj == null || waitingForRefresh) { return false; } if (obj == null || waitingForRefresh) { return false; }
@@ -553,8 +553,6 @@ namespace Barotrauma
public static bool HasItem(Character character, string tag, string containedTag, float conditionPercentage = 0) public static bool HasItem(Character character, string tag, string containedTag, float conditionPercentage = 0)
{ {
if (character == null) { return false; }
if (character.Inventory == null) { return false; }
var item = character.Inventory.FindItemByTag(tag); var item = character.Inventory.FindItemByTag(tag);
return item != null && return item != null &&
item.ConditionPercentage > conditionPercentage && item.ConditionPercentage > conditionPercentage &&
@@ -16,9 +16,6 @@ namespace Barotrauma
public Func<bool> customCondition; public Func<bool> customCondition;
public bool followControlledCharacter;
public bool mimic;
/// <summary> /// <summary>
/// Display units /// Display units
/// </summary> /// </summary>
@@ -27,11 +24,9 @@ namespace Barotrauma
public bool AllowGoingOutside { get; set; } public bool AllowGoingOutside { get; set; }
public bool CheckVisibility { get; set; } public bool CheckVisibility { get; set; }
public ISpatialEntity Target { get; private set; }
public override float GetPriority() public override float GetPriority()
{ {
if (followControlledCharacter && Character.Controlled == null) { return 0.0f; } if (FollowControlledCharacter && Character.Controlled == null) { return 0.0f; }
if (Target is Entity e && e.Removed) { return 0.0f; } if (Target is Entity e && e.Removed) { return 0.0f; }
if (IgnoreIfTargetDead && Target is Character character && character.IsDead) { return 0.0f; } if (IgnoreIfTargetDead && Target is Character character && character.IsDead) { return 0.0f; }
if (objectiveManager.CurrentOrder == this) if (objectiveManager.CurrentOrder == this)
@@ -41,6 +36,10 @@ namespace Barotrauma
return 1.0f; return 1.0f;
} }
public ISpatialEntity Target { get; private set; }
public bool FollowControlledCharacter;
public AIObjectiveGoTo(ISpatialEntity target, Character character, AIObjectiveManager objectiveManager, bool repeat = false, bool getDivingGearIfNeeded = true, float priorityModifier = 1) public AIObjectiveGoTo(ISpatialEntity target, Character character, AIObjectiveManager objectiveManager, bool repeat = false, bool getDivingGearIfNeeded = true, float priorityModifier = 1)
: base (character, objectiveManager, priorityModifier) : base (character, objectiveManager, priorityModifier)
{ {
@@ -53,7 +52,7 @@ namespace Barotrauma
protected override void Act(float deltaTime) protected override void Act(float deltaTime)
{ {
if (followControlledCharacter) if (FollowControlledCharacter)
{ {
if (Character.Controlled == null) if (Character.Controlled == null)
{ {
@@ -138,9 +137,8 @@ namespace Barotrauma
} }
if (getDivingGearIfNeeded) if (getDivingGearIfNeeded)
{ {
Character followTarget = Target as Character; bool needsDivingGear = HumanAIController.NeedsDivingGear(targetHull);
bool needsDivingGear = HumanAIController.NeedsDivingGear(targetHull) || mimic && HumanAIController.HasDivingMask(followTarget); bool needsDivingSuit = needsDivingGear && (targetHull == null || targetIsOutside || targetHull.WaterPercentage > 90);
bool needsDivingSuit = needsDivingGear && (targetHull == null || targetIsOutside || targetHull.WaterPercentage > 90) || mimic && HumanAIController.HasDivingSuit(followTarget);
bool needsEquipment = false; bool needsEquipment = false;
if (needsDivingSuit) if (needsDivingSuit)
{ {
@@ -239,8 +239,7 @@ namespace Barotrauma
CloseEnough = 150, CloseEnough = 150,
AllowGoingOutside = true, AllowGoingOutside = true,
IgnoreIfTargetDead = true, IgnoreIfTargetDead = true,
followControlledCharacter = orderGiver == character, FollowControlledCharacter = orderGiver == character
mimic = true
}; };
break; break;
case "wait": case "wait":