(edb24c37f) Fixed ItemComponents overwriting the Msg-tags ("ItemMsgPressSelect" etc) with the text fetched from the text xml, preventing the texts from being translated after the sub has been saved.
This commit is contained in:
@@ -496,7 +496,11 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
msg = msg.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
msg = msg.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
||||||
}
|
}
|
||||||
Msg = msg;
|
DisplayMsg = msg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DisplayMsg = Msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (attachable)
|
if (attachable)
|
||||||
{
|
{
|
||||||
prevMsg = Msg;
|
prevMsg = DisplayMsg;
|
||||||
prevPickKey = PickKey;
|
prevPickKey = PickKey;
|
||||||
prevRequiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(requiredItems);
|
prevRequiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(requiredItems);
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ namespace Barotrauma.Items.Components
|
|||||||
base.Load(componentElement);
|
base.Load(componentElement);
|
||||||
if (attachable)
|
if (attachable)
|
||||||
{
|
{
|
||||||
prevMsg = Msg;
|
prevMsg = DisplayMsg;
|
||||||
prevPickKey = PickKey;
|
prevPickKey = PickKey;
|
||||||
prevRequiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(requiredItems);
|
prevRequiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(requiredItems);
|
||||||
}
|
}
|
||||||
@@ -405,7 +405,7 @@ namespace Barotrauma.Items.Components
|
|||||||
body.Enabled = false;
|
body.Enabled = false;
|
||||||
item.body = null;
|
item.body = null;
|
||||||
|
|
||||||
Msg = prevMsg;
|
DisplayMsg = prevMsg;
|
||||||
PickKey = prevPickKey;
|
PickKey = prevPickKey;
|
||||||
requiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(prevRequiredItems);
|
requiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(prevRequiredItems);
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
//make the item pickable with the default pick key and with no specific tools/items when it's deattached
|
//make the item pickable with the default pick key and with no specific tools/items when it's deattached
|
||||||
requiredItems.Clear();
|
requiredItems.Clear();
|
||||||
Msg = "";
|
DisplayMsg = "";
|
||||||
PickKey = InputType.Select;
|
PickKey = InputType.Select;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ namespace Barotrauma.Items.Components
|
|||||||
protected CoroutineHandle delayedCorrectionCoroutine;
|
protected CoroutineHandle delayedCorrectionCoroutine;
|
||||||
protected float correctionTimer;
|
protected float correctionTimer;
|
||||||
|
|
||||||
private string msg;
|
|
||||||
|
|
||||||
[Editable, Serialize(0.0f, false)]
|
[Editable, Serialize(0.0f, false)]
|
||||||
public float PickingTime
|
public float PickingTime
|
||||||
{
|
{
|
||||||
@@ -192,12 +190,23 @@ namespace Barotrauma.Items.Components
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: this shouldn't be saved as-is, causes tags ("ItemMsgPressSelect" etc) to be converted into actual texts when saving the subs
|
|
||||||
[Editable, Serialize("", true)]
|
[Editable, Serialize("", true)]
|
||||||
public string Msg
|
public string Msg
|
||||||
{
|
{
|
||||||
get { return msg; }
|
get;
|
||||||
set { msg = value; }
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DisplayMsg
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AITarget AITarget
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AITarget AITarget
|
public AITarget AITarget
|
||||||
@@ -238,7 +247,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
string pickKeyStr = element.GetAttributeString("pickkey", "Select");
|
string pickKeyStr = element.GetAttributeString("pickkey", "Select");
|
||||||
pickKeyStr = ToolBox.ConvertInputType(pickKeyStr);
|
pickKeyStr = ToolBox.ConvertInputType(pickKeyStr);
|
||||||
PickKey = (InputType)Enum.Parse(typeof(InputType),pickKeyStr, true);
|
PickKey = (InputType)Enum.Parse(typeof(InputType), pickKeyStr, true);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -535,6 +544,7 @@ namespace Barotrauma.Items.Components
|
|||||||
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
float average = skillSuccessSum / requiredSkills.Count;
|
||||||
|
|
||||||
float skillSuccessSum = 0.0f;
|
float skillSuccessSum = 0.0f;
|
||||||
for (int i = 0; i < requiredSkills.Count; i++)
|
for (int i = 0; i < requiredSkills.Count; i++)
|
||||||
|
|||||||
@@ -1551,14 +1551,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (ItemComponent ic in components)
|
foreach (ItemComponent ic in components)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(ic.Msg)) continue;
|
if (string.IsNullOrEmpty(ic.DisplayMsg)) continue;
|
||||||
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
|
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
|
||||||
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
|
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
|
||||||
|
|
||||||
Color color = Color.Red;
|
Color color = Color.Red;
|
||||||
if (ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false)) color = Color.Orange;
|
if (ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false)) color = Color.Orange;
|
||||||
|
|
||||||
texts.Add(new ColoredText(ic.Msg, color, false));
|
texts.Add(new ColoredText(ic.DisplayMsg, color, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return texts;
|
return texts;
|
||||||
|
|||||||
Reference in New Issue
Block a user