Table of Contents

Class Feature

Namespace
MonkeyLoader
Assembly
MonkeyLoader.dll

Base type for all feature definitions.
Features can be compared / sorted - earlier in sort order means smaller. If features aren't super- or sub-features of eachother, they compare for the same position.

public abstract class Feature : IEquatable<Feature>, IComparable<Feature>
Inheritance
Feature
Implements
Inherited Members

Remarks

These provide a non-exhaustive list of different features.
Game data packs should strive to provide at least the most common ones, but mods can also add their own (sub-)features.

Game data packs and mods should use inheritance to indicate sub-features.
For example ControllerInput : InputSystem would mean that ControllerInput is a sub-feature of the InputSystem.

Constructors

Feature()

Creates a new game feature instance.

protected Feature()

Properties

AscendingComparer

Gets a Feature-comparer, that sorts larger / shallower features first.

public static IComparer<Feature> AscendingComparer { get; }

Property Value

IComparer<Feature>

Assemblies

Gets the names of all assemblies that this feature is implemented in.

public virtual IEnumerable<AssemblyName> Assemblies { get; }

Property Value

IEnumerable<AssemblyName>

Remarks

Should usually just be one assembly per feature, defined using Assembly.
Defaults to returning just that single assembly's name.

Assembly

Gets the name of the (main) assembly that this feature is implemented in.

public abstract AssemblyName Assembly { get; }

Property Value

AssemblyName

Remarks

If a feature is spread over multiple assemblies, override Assemblies.

DescendingComparer

Gets a Feature-comparer, that sorts smaller / deeper features first.

public static IComparer<Feature> DescendingComparer { get; }

Property Value

IComparer<Feature>

Description

Gets the description of the feature.

public abstract string Description { get; }

Property Value

string

EqualityComparer

Gets an equality comparer that uses the feature's Type.

public static IEqualityComparer<Feature> EqualityComparer { get; }

Property Value

IEqualityComparer<Feature>

Name

Gets the name of the feature.

public abstract string Name { get; }

Property Value

string

SpreadOverMultipleAssemblies

Gets whether this feature is spread over multiple assemblies, i.e. whether Assemblies.Count() is > 1.

public bool SpreadOverMultipleAssemblies { get; }

Property Value

bool

Methods

CompareTo(Feature?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(Feature? other)

Parameters

other Feature

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes other in the sort order. Zero This instance occurs in the same position in the sort order as other. Greater than zero This instance follows other in the sort order.

Remarks

Sorts using AscendingComparer: larger / shallower features first.

Equals(Feature?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Feature? other)

Parameters

other Feature

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Operators

operator ==(Feature, Feature)

Checks if the left feature is equal to the right one.

public static bool operator ==(Feature left, Feature right)

Parameters

left Feature

The first feature.

right Feature

The second feature.

Returns

bool

true if the features are equal; otherwise, false.

operator >(Feature, Feature)

Checks if the left feature sorts bigger than the right one.

public static bool operator >(Feature left, Feature right)

Parameters

left Feature

The first feature.

right Feature

The second feature.

Returns

bool

true if the right feature comes first in the sort order; otherwise, false.

operator !=(Feature, Feature)

Checks if the left feature is unequal to the right one.

public static bool operator !=(Feature left, Feature right)

Parameters

left Feature

The first feature.

right Feature

The second feature.

Returns

bool

true if the features are unequal; otherwise, false.

operator <(Feature, Feature)

Checks if the left feature sorts smaller than the right one.

public static bool operator <(Feature left, Feature right)

Parameters

left Feature

The first feature.

right Feature

The second feature.

Returns

bool

true if the left feature comes first in the sort order; otherwise, false.