Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
7ranceaddic7 committed Jul 27, 2020
1 parent 9642e05 commit 8d86f47
Show file tree
Hide file tree
Showing 9 changed files with 510 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,4 @@ PartDatabase.cfg
Physics.cfg
*.dll
.vs
.history
87 changes: 87 additions & 0 deletions Wiki/10-Config_References-CATEGORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Config References: CATEGORY

A CATEGORY definition provides the topmost-level of filtering available.

In this example, we use the 'Filter by Function' definition to define the CATEGORY.

```ksp
CATEGORY
{
name = Filter by Function
type = stock
value = replace
FILTER
{
CHECK
{
type = folder
value = Squad
}
}
SUBCATEGORIES
{
list = 0,Pods
list = 1,Fuel Tanks
list = 2,Engines
list = 3,Command and Control
list = 4,Structural
list = 5,Aerodynamics
list = 6,Utility
list = 7,Science, don't template
}
}
```

In-depth explanation of each element:

```ksp
CATEGORY
{
// The name/title of the category that will be visible in-game and the id used for Module Manager patches.
// e.g. @CATEGORY[Filter?by?Function] will target this node.
// This field must be unique.
name = Filter by Function
// The type and value fields are used to specify some of the more interesting behavioral characteristics of a category.
// Making changes to any of the 6 stock categories requires the line "type = stock" with the value line choosing between completely replacing all subcategories or just appending new ones.
// There is also the "type = engines" which generates and adds subcategories for every variant of engine present.
type = stock
value = replace
// Any Filter nodes found inside a category are applied prior to those in each subcategory, further limiting the parts that will show up.
// This template for example would limit the visible parts of any subcategory added to those located inside the Squad folder.
FILTER
{
CHECK
{
type = folder
value = Squad
}
}
// The SUBCATEGORIES node contains a 0 indexed list of all the subcategories to be added to this category.
// No particular key is required, "list" is just used as a default.
// The index specifies the position the subcategory will be visible at.
// If two entries use the same index, the latter will replace the former.
// If no index is used, the subcategory will be tacked on to the end after all indexed additions.
SUBCATEGORIES
{
list = 0,Pods
list = 1,Fuel Tanks
list = 2,Engines
list = 3,Command and Control
list = 4,Structural
list = 5,Aerodynamics
list = 6,Utility
list = 7,Science, don't template // the "don't template" keyword excludes this subcategory from the category level filtering
}
// NOTE: Regardless where FILTER:CHECK nodes are placed they will be loaded before any SUBCATEGORIES.
}
```
95 changes: 95 additions & 0 deletions Wiki/12-Config_References-SUBCATEGORIES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Config References: SUBCATEGORIES

A SUBCATEGORIES definition provides an additional level of filtering below the CATEGORY level.

```ksp
SUBCATEGORY
{
name = Ablative Heat Shields
icon = Ablative_Shield
FILTER
{
// invert = false
CHECK
{
type = moduleName
value = ModuleHeatShield, ModuleAblator
// invert = true
// contains = true
// equality = Equals
}
}
}
```

In depth explanation of each element:

```ksp
// Three node types are used to completely define a subcategory.
// SUBCATEGORY, root node, contains the UI and logic elements.
// FILTER and CHECK nodes are used to identify which parts should be visible within the subcategory
// A part must pass all CHECK's in any of the FILTER's to be visible in the SUBCATEGORY
SUBCATEGORY
{
// The name/title of the subcategory that will be visible in-game and the id used for Module Manager
// e.g. @SUBCATEGORY[Ablative?Heat?Shields] will target this node.
// This field must be unique.
name = Ablative Heat Shields
// The name of any image file in GameData with dimensions between 25 and 40 pixels and without the file extension.
// NOTE: Internal KSP limitations prevent DDS formatted images being loaded as of 1.0.4.
icon = Ablative_Shield
// FILTER type nodes form one part of the system which specifies which parts will show in a subcategory.
// Multiple FILTER nodes are OR'd together when checking parts.
FILTER
{
// NOT logic elements are specified using the line "invert = true".
// Default is false.
// invert = false
// CHECK type nodes form the majority of the logic required to identify which parts should show in this subcategory.
// Multiple CHECK nodes are AND'd together when checking parts.
CHECK
{
// The check type specifies which parameters the check is performed against.
// As of v2.3.0, there are 21 types to choose from. Of these, 18 are directed at basic part stats while.
// 3 special types enable faster and/or more complex filtering.
type = moduleName
// The value line lists all the things to match against. Most check types support comma separated values.
// Only one value in a list needs to be matched (so this check is: has(ModuleHeatShield OR ModuleAblator)).
value = ModuleHeatShield, ModuleAblator
// By default checks evaluate true if a match is found. This can be changed by adding the line "invert = true
// Default is false.
// invert = true
// The contains element is valid for all check types that accept lists of values.
// When true, matching any one element in the list of values will set the CHECK state to true
// When false, matching any one element NOT in the list of values will set the CHECK state true
// Most commonly it is used in combination with "invert = false" to specify that there is nothing other than the listed elements
// Default is true.
// contains = true
// The equality element is valid for types accepting numeric values.
// Accepted values: "Equals", "GreaterThan", "LessThan".
// Default is "Equals".
// equality = Equals
}
}
}
```
32 changes: 32 additions & 0 deletions Wiki/14-Config_References-Filters-and-Checks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Config References: Filters and Checks

FILTER and CHECK nodes are the basis for setting which parts are visible in each CATEGORY and SUBCATEGORIES.

## FILTER nodes

These nodes are wrappers for a set of conditions defined by each CHECH node.

Each category and subcategory can have multiple filters available, with a part being required to meet all the conditions of at least one filter to be visible. Filters can also be inverted so the reverse is true (must not pass any nodes to be visible) but this is generally not required.

## CHECK nodes

These nodes contain the details of a single condition.

Each check node contains a single yes/no condition that a part must pass to be accepted. Each Check has a type which details what on the part will be compared against as well as a value (or list of values) and several optional parameters.

## Example

```ksp
// An example Filter checking for all parts that would be visible in the stock "Pods" subcategory.
FILTER
{
CHECK
{
type = category
value = Pods
}
}
```

All valid Check Types are listed [HERE](https://github.com/7ranceaddic7/FilterExtension/wiki/16-Config_References-Check-Types)
138 changes: 138 additions & 0 deletions Wiki/16-Config_References-Check-Types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Config References: Check Types

The type field of a CHECK controls what piece of information the comparison will be made against.

All types support the optional field: _invert_

## Check Type: Basic

All basic types support comma separated lists of values.

---

Module Name : _moduleName_

_Checks for the presence of a module name **as listed in the part.cfg** (e.g. ModuleEngines, ModuleCommand). Respects inheritance of stock classes (e.g. checking for ModuleEngines will catch parts using ModuleEngines, ModuleEnginesFX, and a wide variety of Mod Engine modules)_.

---

Part Name : _name_

_Check will compare against the name field **as listed in the part.cfg** (e.g. Mark1Cockpit)_.

---

Module Title : _moduleTitle_

_Checks for the presence of a module by the module name **as listed in the editor right click menu**_.

---

Part Title : _title_

_Checks for the presence of a case insensitive substring **as listed in the part title**. This is searching for partial matches so "cargo bay" will catch all stock cargo bays_.

---

Technology : _tech_

_Matches the ID of a tech node (**NOT** the title visible in-game)_.

---

Manufacturer : _manufacturer_

_Matches the manufacturer field in the part.cfg_.

---

Folder : _folder_

<!-- markdownlint-disable MD033 -->

_Matches to the **root** <ksp>/GameData folder the part is found in (e.g. Squad)_.

<!-- markdownlint-restore -->

---

Path : _path_

_Matches to the full file path from the GameData directory to the part (e.g. Squad/Parts/FuelTanks/)_.

---

Category : _category_

_Matches to the category field in the part.cfg (e.g. Pods)_.

---

Resource : _resource_

_Matches to parts containing a specific resource. Matches against the in-game title (e.g. Electric Charge)_.

---

Profile : _profile_

_Matches to parts with a certain bulkhead profile listed in their part.cfg file_.

## Check Type: Numeric

Optional field valid for use with numeric types are: equality.
All numeric checks support comma separated lists of values to compare against.

---

Crew Capacity : _crew_

_Compares against the part crew capacity_.

---

Attach Node Size : _size_

_Compares against the size parameter of all the attach nodes on a part_.

---

Mass : _mass_

_Compares against the **wet** mass (the value listed when right clicking in the editor) of each part_.

---

Cost : _cost_

_Compares against the purchase price for a single part in career mode_.

---

Crash Tolerance : _crash_

_Compares against the impact speed required to destroy the part_.

## Check Type: Other

Custom : _custom_

_Custom type checks are shorthand for some checks that would be difficult or impossible to achieve with the standard syntax. Current valid values are: "adapter", "multicoupler", "purchased"_.

---

Propellant : _propellant_

_Checks against the resources consumed by engine modules on the part_.

---

Condition Group : _check_

_Used to group several conditions together (e.g. NOT category(Pods) AND NOT category(Engines) is different to NOT (category(Pods) AND category(Engines)). The second requires a conditional grouping to express_.

---

Subcategories : _subcategory_

_Checks against the full conditions defined in another subcategory_.
Loading

0 comments on commit 8d86f47

Please sign in to comment.