Show / Hide Table of Contents

Class RootConfigurator<T, TBuilder>

Builder API for creating and modifying blueprints.

Inheritance
System.Object
Configurator
RootConfigurator<T, TBuilder>
BaseBlueprintConfigurator<T, TBuilder>
Namespace: BlueprintCore.Blueprints.CustomConfigurators
Assembly: BlueprintCore.dll
Syntax
public abstract class RootConfigurator<T, TBuilder> : Configurator where T : BlueprintScriptableObject where TBuilder : RootConfigurator<T, TBuilder>
Type Parameters
Name Description
T
TBuilder
Remarks

Each supported blueprint type has a corresponding Configurator class to create and modify blueprints of that type, e.g. FeatureConfigurator supports BlueprintFeature. Configurators exist for all blueprint types inheriting from Kingmaker.Blueprints.BlueprintScriptableObject, excluding any that are not used in the base game.

Creating a Blueprint

Use New(string, string) to create a blueprint:

FeatureConfigurator.New(MyBlueprintName, MyBlueprintGuid)

Once New() is called the blueprint is added to the game library and can be referenced.

Using the Configurator

New() returns a configurator with methods to set or modify blueprint fields and add or modify Kingmaker.Blueprints.BlueprintComponent:

FeatureConfigurator.New(MyBlueprintName, MyBlueprintGuid).AddToGroups(FeatureGroup.Feat).AddPrerequisiteAlignment(AlignmentMaskType.LawfulGood).Configure();

Each method call returns the configurator allowing you to chain calls. Nothing is modified on the blueprint until Configure() is called, at which point the changes are applied and validated. Potential problems with the blueprint are logged as warnings.

Modifying an Existing Blueprint

Use For(Blueprint) to modify existing blueprints:

CharacterClassConfigurator.For(WizardClassGuid)

Usage is otherwise identical to creating a new blueprint.

For more information see Using BlueprintCore.

Constructors

| Improve this Doc View Source

RootConfigurator(Blueprint<BlueprintReference<T>>)

Declaration
protected RootConfigurator(Blueprint<BlueprintReference<T>> blueprint)
Parameters
Type Name Description
Blueprint<Kingmaker.Blueprints.BlueprintReference<T>> blueprint

Fields

| Improve this Doc View Source

Blueprint

Declaration
protected readonly T Blueprint
Field Value
Type Description
T
| Improve this Doc View Source

Configured

Declaration
protected bool Configured
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

Logger

Declaration
protected static readonly LogWrapper Logger
Field Value
Type Description
LogWrapper
| Improve this Doc View Source

Self

Declaration
protected readonly TBuilder Self
Field Value
Type Description
TBuilder

Methods

| Improve this Doc View Source

AddComponent(BlueprintComponent)

Adds the specified Kingmaker.Blueprints.BlueprintComponent to the blueprint.

Declaration
public TBuilder AddComponent(BlueprintComponent component)
Parameters
Type Name Description
Kingmaker.Blueprints.BlueprintComponent component
Returns
Type Description
TBuilder
Remarks

It is recommended to only call this from within a configurator class or when adding a component type not supported by the configurator.

| Improve this Doc View Source

AddComponent<C>(Action<C>)

Creates a new Kingmaker.Blueprints.BlueprintComponent of the specified type and adds it to the blueprint.

Declaration
public TBuilder AddComponent<C>(Action<C> init = null)
    where C : BlueprintComponent, new()
Parameters
Type Name Description
System.Action<C> init

Optional initialization System.Action run on the component.

Returns
Type Description
TBuilder
Type Parameters
Name Description
C
Remarks

This is intended to support component types not implemented in the configurator API, such as custom components of your own or from another mod library.

| Improve this Doc View Source

AddUniqueComponent(BlueprintComponent, ComponentMerge, Action<BlueprintComponent, BlueprintComponent>)

Adds the specified Kingmaker.Blueprints.BlueprintComponent to the blueprint with merge handling.

Declaration
public TBuilder AddUniqueComponent(BlueprintComponent component, ComponentMerge behavior = ComponentMerge.Fail, Action<BlueprintComponent, BlueprintComponent> merge = null)
Parameters
Type Name Description
Kingmaker.Blueprints.BlueprintComponent component
ComponentMerge behavior
System.Action<Kingmaker.Blueprints.BlueprintComponent, Kingmaker.Blueprints.BlueprintComponent> merge
Returns
Type Description
TBuilder
Remarks

This is intended to support component types not implemented in the configurator API, such as custom components of your own or from another mod library.

Use this for components which should be unique within the blueprint.

| Improve this Doc View Source

Configure(Boolean)

Commits the configuration changes to the blueprint.

Declaration
public T Configure(bool delayed = false)
Parameters
Type Name Description
System.Boolean delayed

If true, queues this blueprint to be configured when ConfigureDelayedBlueprints() is called

Returns
Type Description
T

The resulting blueprint.

Remarks

After commiting the changes the blueprint is validated and any errors are logged as a warning.

Throws System.InvalidOperationException if called twice on the same configurator.
| Improve this Doc View Source

ConfigureDelayedBlueprints()

Configures any delayed blueprints.

Declaration
public static void ConfigureDelayedBlueprints()
Remarks

This is useful if you want to interact with other content mods without having a dependency. For example you can use this to add a new BlueprintFeature to the appropriate BlueprintFeatureSelection from another mod.

It's recommended to call this after StartGameLoader.LoadPackTOC() by postfixing it. If you use TTT-Core this can be done by implementing IBlueprintCacheInitHandler and calling it in AfterBlueprintCachePatches().

// Note that the blueprint is created and registered here, but not configured
var feature =
  FeatureConfigurator.New(FeatName, FeatGuid, FeatureGroup.Feat, FeatureGroup.CombatFeat)
    .Configure(delayed: true);

// This method should be declared in a class implementing IBlueprintCacheInitHandler public void AfterBlueprintCachePatches() { // Now the feature is configured. Any mods that add BlueprintFeatureSelections matching FeatureGroup.Feat or // FeatureGroup.CombatFeat will include your feat. RootConfigurator.ConfigureDelayed(); }

| Improve this Doc View Source

CopyFrom(Blueprint<BlueprintReference<BlueprintScriptableObject>>, Predicate<BlueprintComponent>)

Copies fields and components of the specified types from the blueprint.

Declaration
public TBuilder CopyFrom(Blueprint<BlueprintReference<BlueprintScriptableObject>> blueprint, Predicate<BlueprintComponent> componentMatcher)
Parameters
Type Name Description
Blueprint<Kingmaker.Blueprints.BlueprintReference<Kingmaker.Blueprints.BlueprintScriptableObject>> blueprint
System.Predicate<Kingmaker.Blueprints.BlueprintComponent> componentMatcher

Any components in blueprint matching the predicate are copied. These are shallow copies that are shared by both blueprints.

Returns
Type Description
TBuilder
Remarks

NOT A DEEP COPY. This means objects copied are shared between blueprints. Changes to copied objects affect both blueprints.

Recommended when you need to create a nearly identical ability but change some parts such as a ContextRankConfig.

// Copy the Undead Bloodline's Incorporeal Form ability, replacing the duration w/ Character Level rounds
AbilityConfigurator.New(NewIncorporealForm, Guids.NewIncorporealForm)
  .CopyFrom(
    AbilityRefs.BloodlineUndeadIncorporealFormAbility,
    typeof(AbilityEffectRunAction),
    typeof(AbilityResourceLogic),
    typeof(SpellComponent))
  .AddContextRankConfig(ContextRankConfigs.CharacterLevel())
  .Configure();
| Improve this Doc View Source

CopyFrom(Blueprint<BlueprintReference<BlueprintScriptableObject>>, Type[])

Copies fields and components of the specified types from the blueprint.

Declaration
public TBuilder CopyFrom(Blueprint<BlueprintReference<BlueprintScriptableObject>> blueprint, params Type[] componentTypes)
Parameters
Type Name Description
Blueprint<Kingmaker.Blueprints.BlueprintReference<Kingmaker.Blueprints.BlueprintScriptableObject>> blueprint
System.Type[] componentTypes

Any components in blueprint of the listed types are copied. These are shallow copies that are shared by both blueprints.

Returns
Type Description
TBuilder
Remarks

NOT A DEEP COPY. This means objects copied are shared between blueprints. Changes to copied objects affect both blueprints.

Recommended when you need to create a nearly identical ability but change some parts such as a ContextRankConfig.

// Copy the Undead Bloodline's Incorporeal Form ability, replacing the duration w/ Character Level rounds
AbilityConfigurator.New(NewIncorporealForm, Guids.NewIncorporealForm)
  .CopyFrom(
    AbilityRefs.BloodlineUndeadIncorporealFormAbility,
    typeof(AbilityEffectRunAction),
    typeof(AbilityResourceLogic),
    typeof(SpellComponent))
  .AddContextRankConfig(ContextRankConfigs.CharacterLevel())
  .Configure();
| Improve this Doc View Source

EditComponent<C>(Action<C>)

Edits the first Kingmaker.Blueprints.BlueprintComponent of the specified type in the blueprint.

Declaration
public TBuilder EditComponent<C>(Action<C> edit)
    where C : BlueprintComponent
Parameters
Type Name Description
System.Action<C> edit

Action invoked with the component as an input argument. Run when Configure(Boolean) is called.

Returns
Type Description
TBuilder
Type Parameters
Name Description
C
| Improve this Doc View Source

EditComponents<C>(Action<C>, Func<C, Boolean>)

Edits all Kingmaker.Blueprints.BlueprintComponent matching the predicate.

Declaration
public TBuilder EditComponents<C>(Action<C> edit, Func<C, bool> predicate)
    where C : BlueprintComponent
Parameters
Type Name Description
System.Action<C> edit

Action invoked with the component as an input argument. Run when Configure(Boolean) is called.

System.Func<C, System.Boolean> predicate
Returns
Type Description
TBuilder
Type Parameters
Name Description
C
| Improve this Doc View Source

OnConfigure(Action<T>[])

Executes the specified actions when Configure(Boolean) is called.

Declaration
public TBuilder OnConfigure(params Action<T>[] actions)
Parameters
Type Name Description
System.Action<T>[] actions
Returns
Type Description
TBuilder
Remarks

Runs as the last step of configuration, after all components are added and all other changes are applied.

| Improve this Doc View Source

OnConfigureCompleted()

Declaration
protected virtual void OnConfigureCompleted()
| Improve this Doc View Source

OnConfigureInternal(Action<T>[])

Internal function comparable to OnConfigure(Action<T>[]).

Declaration
protected TBuilder OnConfigureInternal(params Action<T>[] actions)
Parameters
Type Name Description
System.Action<T>[] actions
Returns
Type Description
TBuilder
Remarks

Runs after all configuration is done but before OnConfigure(Action<T>[]). Configurator functions should use this to ensure the blueprint is configured before user configuration actions are run.

| Improve this Doc View Source

RemoveComponents(Func<BlueprintComponent, Boolean>)

Removed components from the blueprint matching the specified predicate.

Declaration
public TBuilder RemoveComponents(Func<BlueprintComponent, bool> predicate)
Parameters
Type Name Description
System.Func<Kingmaker.Blueprints.BlueprintComponent, System.Boolean> predicate
Returns
Type Description
TBuilder
Remarks

Has no effect on components added with the configurator.

| Improve this Doc View Source

Validate(Object)

Declaration
protected void Validate(object obj)
Parameters
Type Name Description
System.Object obj
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX