(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:
Joonas Rikkonen
2019-03-28 12:36:11 +02:00
parent d7526934e6
commit a8222e429f
4 changed files with 31 additions and 17 deletions
@@ -56,9 +56,7 @@ namespace Barotrauma.Items.Components
protected const float CorrectionDelay = 1.0f;
protected CoroutineHandle delayedCorrectionCoroutine;
protected float correctionTimer;
private string msg;
[Editable, Serialize(0.0f, false)]
public float PickingTime
{
@@ -191,13 +189,24 @@ namespace Barotrauma.Items.Components
{
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)]
public string Msg
{
get { return msg; }
set { msg = value; }
get;
set;
}
public string DisplayMsg
{
get;
set;
}
public AITarget AITarget
{
get;
private set;
}
public AITarget AITarget
@@ -238,13 +247,13 @@ namespace Barotrauma.Items.Components
{
string pickKeyStr = element.GetAttributeString("pickkey", "Select");
pickKeyStr = ToolBox.ConvertInputType(pickKeyStr);
PickKey = (InputType)Enum.Parse(typeof(InputType),pickKeyStr, true);
PickKey = (InputType)Enum.Parse(typeof(InputType), pickKeyStr, true);
}
catch (Exception e)
{
DebugConsole.ThrowError("Invalid pick key in " + element + "!", e);
}
SerializableProperties = SerializableProperty.DeserializeProperties(this, element);
ParseMsg();
@@ -535,6 +544,7 @@ namespace Barotrauma.Items.Components
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return 0.0f;
}
float average = skillSuccessSum / requiredSkills.Count;
float skillSuccessSum = 0.0f;
for (int i = 0; i < requiredSkills.Count; i++)