(3fbeb4c70) Option to make items use the name and description of another item

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:05:16 +03:00
parent 92e4c824f4
commit 36ee088738
13 changed files with 410 additions and 84 deletions
@@ -867,6 +867,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>();
@@ -1920,6 +1920,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; }
@@ -443,8 +443,19 @@ namespace Barotrauma
identifier = element.GetAttributeString("identifier", "");
name = TextManager.Get("EntityName." + identifier, true) ?? element.GetAttributeString("name", "");
if (name == "") DebugConsole.ThrowError("Unnamed item in " + filePath + "!");
//nameidentifier can be used to make multiple items use the same names and descriptions
string nameIdentifier = element.GetAttributeString("nameidentifier", "");
if (string.IsNullOrEmpty(nameIdentifier))
{
name = TextManager.Get("EntityName." + identifier, true) ?? element.GetAttributeString("name", "");
}
else
{
name = TextManager.Get("EntityName." + nameIdentifier, true) ?? element.GetAttributeString("name", "");
}
if (name == "") { DebugConsole.ThrowError("Unnamed item in " + filePath + "!"); }
DebugConsole.Log(" " + name);
@@ -480,7 +491,15 @@ namespace Barotrauma
SerializableProperty.DeserializeProperties(this, element);
string translatedDescription = TextManager.Get("EntityDescription." + identifier, true);
string translatedDescription = "";
if (string.IsNullOrEmpty(nameIdentifier))
{
translatedDescription = TextManager.Get("EntityDescription." + identifier, true);
}
else
{
translatedDescription = TextManager.Get("EntityDescription." + nameIdentifier, true);
}
if (!string.IsNullOrEmpty(translatedDescription)) Description = translatedDescription;
foreach (XElement subElement in element.Elements())