(2a4bd39c2) Merge branch 'dev' into human-ai
This commit is contained in:
@@ -580,8 +580,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public virtual bool HasRequiredItems(Character character, bool addMessage, string msg = null)
|
||||
{
|
||||
if (!requiredItems.Any()) return true;
|
||||
if (character.Inventory == null) return false;
|
||||
if (!requiredItems.Any()) { return true; }
|
||||
if (character.Inventory == null) { return false; }
|
||||
bool hasRequiredItems = false;
|
||||
bool canContinue = true;
|
||||
if (requiredItems.ContainsKey(RelatedItem.RelationType.Equipped))
|
||||
@@ -615,7 +615,15 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
bool Predicate(Item it) => it != null && it.Condition > 0.0f && relatedItem.MatchesItem(it);
|
||||
bool shouldBreak = false;
|
||||
if (relatedItem.IsOptional)
|
||||
bool inEditor = false;
|
||||
#if CLIENT
|
||||
inEditor = Screen.Selected == GameMain.SubEditorScreen;
|
||||
#endif
|
||||
if (relatedItem.IgnoreInEditor && inEditor)
|
||||
{
|
||||
hasRequiredItems = true;
|
||||
}
|
||||
else if (relatedItem.IsOptional)
|
||||
{
|
||||
if (!hasRequiredItems)
|
||||
{
|
||||
@@ -784,6 +792,7 @@ namespace Barotrauma.Items.Components
|
||||
newRequiredItem.statusEffects = prevRequiredItem.statusEffects;
|
||||
newRequiredItem.Msg = prevRequiredItem.Msg;
|
||||
newRequiredItem.IsOptional = prevRequiredItem.IsOptional;
|
||||
newRequiredItem.IgnoreInEditor = prevRequiredItem.IgnoreInEditor;
|
||||
}
|
||||
|
||||
if (!requiredItems.ContainsKey(newRequiredItem.Type))
|
||||
|
||||
@@ -829,6 +829,25 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (targetItem.Prefab.DeconstructItems.Any())
|
||||
{
|
||||
inputContainer.Inventory.RemoveItem(targetItem);
|
||||
Entity.Spawner.AddToRemoveQueue(targetItem);
|
||||
MoveInputQueue();
|
||||
PutItemsToLinkedContainer();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outputContainer.Inventory.Items.All(i => i != null))
|
||||
{
|
||||
targetItem.Drop(dropper: null);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputContainer.Inventory.TryPutItem(targetItem, user: null, createNetworkEvent: true);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetItem.Prefab.DeconstructItems.Any())
|
||||
{
|
||||
inputContainer.Inventory.RemoveItem(targetItem);
|
||||
|
||||
@@ -212,33 +212,6 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2? PosToMaintain
|
||||
{
|
||||
get { return posToMaintain; }
|
||||
set { posToMaintain = value; }
|
||||
}
|
||||
|
||||
struct ObstacleDebugInfo
|
||||
{
|
||||
public Vector2 Point1;
|
||||
public Vector2 Point2;
|
||||
|
||||
public Vector2? Intersection;
|
||||
|
||||
public float Dot;
|
||||
|
||||
public Vector2 AvoidStrength;
|
||||
|
||||
public ObstacleDebugInfo(GraphEdge edge, Vector2? intersection, float dot, Vector2 avoidStrength)
|
||||
{
|
||||
Point1 = edge.Point1;
|
||||
Point2 = edge.Point2;
|
||||
Intersection = intersection;
|
||||
Dot = dot;
|
||||
AvoidStrength = avoidStrength;
|
||||
}
|
||||
}
|
||||
|
||||
//edge point 1, edge point 2, avoid strength
|
||||
private List<ObstacleDebugInfo> debugDrawObstacles = new List<ObstacleDebugInfo>();
|
||||
|
||||
|
||||
@@ -1464,6 +1464,10 @@ namespace Barotrauma
|
||||
{
|
||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||
}
|
||||
if (!broken)
|
||||
{
|
||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||
}
|
||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||
|
||||
if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; }
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public bool IsOptional { get; set; }
|
||||
|
||||
private string[] identifiers;
|
||||
|
||||
public bool IgnoreInEditor { get; set; }
|
||||
|
||||
private string[] excludedIdentifiers;
|
||||
|
||||
@@ -35,23 +35,20 @@ namespace Barotrauma
|
||||
|
||||
public string JoinedIdentifiers
|
||||
{
|
||||
get { return string.Join(",", identifiers); }
|
||||
get { return string.Join(",", Identifiers); }
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
|
||||
identifiers = value.Split(',');
|
||||
for (int i = 0; i < identifiers.Length; i++)
|
||||
Identifiers = value.Split(',');
|
||||
for (int i = 0; i < Identifiers.Length; i++)
|
||||
{
|
||||
identifiers[i] = identifiers[i].Trim().ToLowerInvariant();
|
||||
Identifiers[i] = Identifiers[i].Trim().ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string[] Identifiers
|
||||
{
|
||||
get { return identifiers; }
|
||||
}
|
||||
|
||||
public string[] Identifiers { get; private set; }
|
||||
|
||||
public string JoinedExcludedIdentifiers
|
||||
{
|
||||
@@ -72,7 +69,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (item == null) return false;
|
||||
if (excludedIdentifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id))) return false;
|
||||
return identifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id));
|
||||
return Identifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id));
|
||||
}
|
||||
|
||||
public RelatedItem(string[] identifiers, string[] excludedIdentifiers)
|
||||
@@ -81,7 +78,7 @@ namespace Barotrauma
|
||||
{
|
||||
identifiers[i] = identifiers[i].Trim().ToLowerInvariant();
|
||||
}
|
||||
this.identifiers = identifiers;
|
||||
this.Identifiers = identifiers;
|
||||
|
||||
for (int i = 0; i < excludedIdentifiers.Length; i++)
|
||||
{
|
||||
@@ -141,7 +138,8 @@ namespace Barotrauma
|
||||
element.Add(
|
||||
new XAttribute("identifiers", JoinedIdentifiers),
|
||||
new XAttribute("type", type.ToString()),
|
||||
new XAttribute("optional", IsOptional));
|
||||
new XAttribute("optional", IsOptional),
|
||||
new XAttribute("ignoreineditor", IgnoreInEditor));
|
||||
|
||||
if (excludedIdentifiers.Length > 0)
|
||||
{
|
||||
@@ -223,6 +221,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
ri.IsOptional = element.GetAttributeBool("optional", false);
|
||||
ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false);
|
||||
return ri;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user