Skip to content

Commit

Permalink
remove tag texts
Browse files Browse the repository at this point in the history
dump mechdefs
  • Loading branch information
Denadan committed May 26, 2019
1 parent fc93c65 commit 6c6c173
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
9 changes: 9 additions & 0 deletions source/AutoFixer/Patches/SimGameState_Rehydrate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ public static void FixMechInMechbay(SimGameState __instance, StatCollection ___c
{
var mechDefs = ___ActiveMechs.Values.Union(___ReadyingMechs.Values).ToList();
AutoFixer.Shared.FixSavedMech(mechDefs, __instance);

foreach (var mechDef in mechDefs)
{
string value = $"{mechDef.Description.Id}({mechDef.Description.UIName}) [";
if(mechDef.MechTags != null && !mechDef.MechTags.IsEmpty)
foreach (var mechDefMechTag in mechDef.MechTags)
value += mechDefMechTag + " ";
Control.LogError(value);
}
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using BattleTech.UI;
Expand All @@ -18,6 +19,19 @@ public static void FixDefaults(SkirmishMechBayPanel __instance)
{
var mechDefs = __instance.dataManager.MechDefs.Select(pair => pair.Value).ToList();
AutoFixer.Shared.FixMechDef(mechDefs);


if(Control.Settings.DEBUG_DumpMechDefs && System.IO.Directory.Exists(Control.Settings.DEBUG_MechDefsDir))
foreach (var mechDef in mechDefs)
{
string str = mechDef.ToJSON();
FileStream fs = new FileStream(System.IO.Path.Combine(Control.Settings.DEBUG_MechDefsDir, $"{mechDef.Description.Id}.json"), FileMode.Create);
var sw = new StreamWriter(fs);
sw.Write(str);
sw.Flush();
fs.Close();
}

}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public static void Postfix(object target, Dictionary<string, object> values)
trav.Value = def.Description.Details + "\n" + description;
}

TagRestrictionsHandler.Shared.ProcessDescription(def.ComponentTags, def.Description);
//TagRestrictionsHandler.Shared.ProcessDescription(def.ComponentTags, def.Description);
}
else if(target is MechDef mdef)
TagRestrictionsHandler.Shared.ProcessDescription(mdef.MechTags, mdef.Description);
else if (target is ChassisDef cdef)
TagRestrictionsHandler.Shared.ProcessDescription(cdef.ChassisTags, cdef.Description);
//else if(target is MechDef mdef)
// TagRestrictionsHandler.Shared.ProcessDescription(mdef.MechTags, mdef.Description);
//else if (target is ChassisDef cdef)
// TagRestrictionsHandler.Shared.ProcessDescription(cdef.ChassisTags, cdef.Description);
}
}
}
3 changes: 3 additions & 0 deletions source/CustomComponentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public class CustomComponentSettings
{
public DType DebugInfo = DType.EffectNull | DType.SalvageProccess | DType.ComponentInstall;

public bool DEBUG_DumpMechDefs = false;
public string DEBUG_MechDefsDir = "D:/MechDefs";

public LogLevel LogLevel = LogLevel.Debug;
public List<TagColor> ColorTags = new List<TagColor>();

Expand Down
4 changes: 2 additions & 2 deletions source/TagRestrictions/TagRestrictions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class TagRestrictions
public string[] RequiredAnyTags;
public string[] IncompatibleTags;

public string ShortText = null;
public string FullText = null;
//public string ShortText = null;
//public string FullText = null;


//public class SearchOptions
Expand Down
3 changes: 2 additions & 1 deletion source/TagRestrictions/TagRestrictionsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ private static string NameForTag(string tag)

return tag;
}

/*
public void ProcessDescription(TagSet tags, DescriptionDef description)
{
try
Expand Down Expand Up @@ -366,5 +366,6 @@ public void ProcessDescription(TagSet tags, DescriptionDef description)
}
}
*/
}
}

0 comments on commit 6c6c173

Please sign in to comment.