Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
update multi coupler check
Browse files Browse the repository at this point in the history
  • Loading branch information
Crzyrndm committed Feb 8, 2015
1 parent c81028c commit 303e97f
Show file tree
Hide file tree
Showing 49 changed files with 56 additions and 700 deletions.
1 change: 1 addition & 0 deletions FilterExtension/ConfigNodes/customCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ private void generateEngineTypes()
checks.Add(new Check("propellant", s));
props += s;
}
checks.Add(new Check("propellant", props, true, false)); // exact match to propellant list. Nothing extra, nothing less

customSubCategory sC = new customSubCategory(props, this.categoryName, "stock_Engines");

Expand Down
25 changes: 15 additions & 10 deletions FilterExtension/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void associateParts()
foreach (AvailablePart p in PartLoader.Instance.parts)
{
// don't want dummy parts
if (p.category == PartCategories.none)
if (p == null || p.category == PartCategories.none)
continue;

if (string.IsNullOrEmpty(p.partUrl))
Expand All @@ -168,7 +168,7 @@ private void associateParts()
else
Log(p.name + " duplicated part key in part-mod dictionary");

if (p != null && PartType.isEngine(p))
if (PartType.isEngine(p))
{
foreach (ModuleEngines e in p.partPrefab.GetModuleEngines())
{
Expand Down Expand Up @@ -222,7 +222,7 @@ private bool stringListComparer(List<string> propellants)
internal void editor()
{
// set state == 1, we have started processing
state = 1;
// state = 1;

// clear manufacturers from Filter by Manufacturer
// Don't rename incase other mods depend on finding it (and the name isn't half bad either...)
Expand Down Expand Up @@ -261,14 +261,12 @@ internal void editor()

// Remove any category with no subCategories (causes major breakages). Removal doesn't actually prevent icon showing, just breakages
PartCategorizer.Instance.filters.RemoveAll(c => c.subcategories.Count == 0);
// refresh icons - doesn't work >.<
// PartCategorizer.Instance.UpdateCategoryNameLabel();

// reveal categories
PartCategorizer.Instance.SetAdvancedMode();

// set state == -1, we have finished processing with no critical errors
state = -1;
// state = -1;
}

public void refreshList()
Expand Down Expand Up @@ -371,7 +369,7 @@ private static void loadIcons()
i++;
if (i != 1000)
name = name + i.ToString();
Log("Duplicated texture name by texture " + t.name + ". New reference is: " + name);
Log("Duplicated texture name \"" + t.name.Split(new char[] { '/', '\\' }).Last() + "\" at:\r\n" + t.name + "\r\n New reference is: " + name);
}

PartCategorizer.Icon icon = new PartCategorizer.Icon(name, t.texture, selectedTex, false);
Expand All @@ -394,9 +392,14 @@ public static PartCategorizer.Icon getIcon(string name)
}
else if (name.StartsWith("stock_"))
{
PartCategorizer.Category fbf = PartCategorizer.Instance.filters.Find(c => c.button.categoryName == "Filter by Function");
name = name.Substring(6);
return fbf.subcategories.FirstOrDefault(sC => sC.button.categoryName == name).button.icon;
foreach (PartCategorizer.Category C in PartCategorizer.Instance.filters)
{
foreach (PartCategorizer.Category sC in C.subcategories)
{
if (name.Substring(6) == sC.button.categoryName)
return sC.button.icon;
}
}
}
return null;
}
Expand All @@ -418,6 +421,8 @@ private void checkForEmptySubCategories()

foreach (customSubCategory sC in subCategories)
{
Debug.Log(sC.subCategoryTitle);
Debug.Log(sC.oldTitle);
if (!sC.hasFilters)
{
notEmpty.Add(sC);
Expand Down
5 changes: 3 additions & 2 deletions FilterExtension/FilterExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
<PostBuildEvent>set SOURCE="D:\Users\Joshua\GitHub\Filter-Extensions\FilterExtension\GameData"
set DESTINATION="D:\Users\Joshua\Desktop\Kerbal Space Program Dev\GameData"
xcopy %25SOURCE%25 %25DESTINATION%25 /e /c /r /i /u /y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
7 changes: 5 additions & 2 deletions FilterExtension/Utility/PartType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ internal static bool checkPropellant(AvailablePart part, string value, bool cont
{
foreach (Propellant p in Lp)
{
Core.Log(p.name);
if (!value.Split(',').Contains(p.name))
return true;
}
Expand Down Expand Up @@ -301,8 +300,12 @@ public static bool isFuselage(AvailablePart part)

public static bool isMultiCoupler(AvailablePart part)
{
if (part.partPrefab.attachNodes.Count > 2)
if (part.partPrefab.attachNodes.Count <= 2 || part.title.Contains("Cargo Bay"))
return false;
float pos = part.partPrefab.attachNodes.Last().position.y;
if (part.partPrefab.attachNodes.FindAll(n => n.position.y == pos).Count > 1 && part.partPrefab.attachNodes.FindAll(n => n.position.y == pos).Count < part.partPrefab.attachNodes.Count)
return true;

return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CATEGORY
{
name = Resource Storage and Processing
name = Resource Mining and Processing
icon = Resources
colour = #FF90F090
all = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CATEGORY
{
name = Electrical
icon = ElectricalParts
icon = ElectricCharge
colour = #FF90F090
all = true
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 303e97f

Please sign in to comment.