RedCore
Loading...
Searching...
No Matches
red::Registrar Class Reference

Per-mod registrar object from which all registrations must be made. More...

#include <Registrar.h>

Public Member Functions

 Registrar (const char *nameSpace)
template<class T>
requires std::derived_from<T, ActorBase>
ProfileCreateBuilder< T > newProfile (const char *name) const
 Register a new profile by string-name.
template<class T>
requires std::derived_from<T, ActorBase>
ProfileReplaceBuilder< T > replaceProfile (s32 id) const
 Replace a vanilla profile by its numeric ID.
ProfileEditBuilder editProfile (s32 id) const
 Partially modify fields on a vanilla profile by its numeric ID.

Detailed Description

Per-mod registrar object from which all registrations must be made.

Every mod should construct and maintain its own global red::Registrar with a unique namespace.

Constructor & Destructor Documentation

◆ Registrar()

red::Registrar::Registrar ( const char * nameSpace)
inlineexplicit

Construct a registrar using a namespace.

Parameters
nameSpaceThe unique namespace for the mod.

Member Function Documentation

◆ newProfile()

template<class T>
requires std::derived_from<T, ActorBase>
ProfileCreateBuilder< T > red::Registrar::newProfile ( const char * name) const
inline

Register a new profile by string-name.

Template Parameters
TTarget actor class that this profile represents and will instantiate.
Parameters
nameThe identifier of this profile, to which the namespace will automatically be prefixed.
Returns
A builder on which additional methods for setting parameters are available.
Warning
One profile per instantiation of T, meaning if two profiles with the same class are desired, a second class that inherits the first is required to force creation of a new template instance.

◆ replaceProfile()

template<class T>
requires std::derived_from<T, ActorBase>
ProfileReplaceBuilder< T > red::Registrar::replaceProfile ( s32 id) const
inline

Replace a vanilla profile by its numeric ID.

Template Parameters
TActor class that this profile will now instantiate.
Parameters
idThe target profile ID to replace.
Returns
A builder on which additional methods for setting parameters are available.

◆ editProfile()

ProfileEditBuilder red::Registrar::editProfile ( s32 id) const
inline

Partially modify fields on a vanilla profile by its numeric ID.

Parameters
idThe target profile ID to modify.
Returns
A builder on which additional methods for setting parameters are available.