Converted the GetAttribute methods in the ToolBox class to extension methods
This commit is contained in:
@@ -44,9 +44,9 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
limbPositions = new List<LimbPos>();
|
||||
|
||||
userPos = ToolBox.GetAttributeVector2(element, "UserPos", Vector2.Zero);
|
||||
userPos = element.GetAttributeVector2("UserPos", Vector2.Zero);
|
||||
|
||||
Enum.TryParse<Direction>(ToolBox.GetAttributeString(element, "direction", "None"), out dir);
|
||||
Enum.TryParse<Direction>(element.GetAttributeString("direction", "None"), out dir);
|
||||
|
||||
foreach (XElement el in element.Elements())
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace Barotrauma.Items.Components
|
||||
DebugConsole.ThrowError("Error in " + element + ": " + e.Message, e);
|
||||
}
|
||||
|
||||
lp.position = ToolBox.GetAttributeVector2(el, "position", Vector2.Zero);
|
||||
lp.position = el.GetAttributeVector2("position", Vector2.Zero);
|
||||
|
||||
limbPositions.Add(lp);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (focusTarget == null)
|
||||
{
|
||||
item.SendSignal(0, ToolBox.Vector2ToString(character.CursorWorldPosition), "position_out", character);
|
||||
item.SendSignal(0, XMLExtensions.Vector2ToString(character.CursorWorldPosition), "position_out", character);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (!character.IsRemotePlayer || character.ViewTarget == focusTarget)
|
||||
{
|
||||
item.SendSignal(0, ToolBox.Vector2ToString(character.CursorWorldPosition), "position_out", character);
|
||||
item.SendSignal(0, XMLExtensions.Vector2ToString(character.CursorWorldPosition), "position_out", character);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public FabricableItem(XElement element)
|
||||
{
|
||||
string name = ToolBox.GetAttributeString(element, "name", "");
|
||||
string name = element.GetAttributeString("name", "");
|
||||
|
||||
TargetItem = ItemPrefab.list.Find(ip => ip.Name.ToLowerInvariant() == name.ToLowerInvariant()) as ItemPrefab;
|
||||
if (TargetItem == null)
|
||||
@@ -31,11 +31,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
RequiredSkills = new List<Skill>();
|
||||
|
||||
RequiredTime = ToolBox.GetAttributeFloat(element, "requiredtime", 1.0f);
|
||||
RequiredTime = element.GetAttributeFloat("requiredtime", 1.0f);
|
||||
|
||||
RequiredItems = new List<Tuple<ItemPrefab, int>>();
|
||||
|
||||
string[] requiredItemNames = ToolBox.GetAttributeString(element, "requireditems", "").Split(',');
|
||||
string[] requiredItemNames = element.GetAttributeString("requireditems", "").Split(',');
|
||||
foreach (string requiredItemName in requiredItemNames)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(requiredItemName)) continue;
|
||||
@@ -68,8 +68,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
case "requiredskill":
|
||||
RequiredSkills.Add(new Skill(
|
||||
ToolBox.GetAttributeString(subElement, "name", ""),
|
||||
ToolBox.GetAttributeInt(subElement, "level", 0)));
|
||||
subElement.GetAttributeString("name", ""),
|
||||
subElement.GetAttributeInt("level", 0)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Barotrauma.Items.Components
|
||||
radarBlips = new List<RadarBlip>();
|
||||
#endif
|
||||
|
||||
displayBorderSize = ToolBox.GetAttributeFloat(element, "displaybordersize", 0.0f);
|
||||
displayBorderSize = element.GetAttributeFloat("displaybordersize", 0.0f);
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
|
||||
@@ -336,7 +336,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (connection.Name == "velocity_in")
|
||||
{
|
||||
currVelocity = ToolBox.ParseToVector2(signal, false);
|
||||
currVelocity = XMLExtensions.ParseToVector2(signal, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user