Nebula
|
#include <blueprintmanager.h>
Loads the 'data:tables/blueprint.json' file and subsequently sets up categories based on the blueprints in the entity manager.
You can instantiate entities from blueprints via the entity interface.
Classes | |
struct | Blueprint |
an entity blueprint More... | |
struct | ComponentEntry |
struct | Template |
Public Member Functions | |
EntityMapping | Instantiate (World *const world, BlueprintId blueprint) |
create an instance from blueprint. Note that this does not tie it to an entity! It's not recommended to create entities this way. | |
EntityMapping | Instantiate (World *const world, TemplateId templateId) |
create an instance from template. Note that this does not tie it to an entity! It's not recommended to create entities this way. | |
Static Public Member Functions | |
static ManagerAPI | Create () |
Create the singleton. | |
static void | Destroy () |
Destroy the singleton. | |
static void | SetBlueprintsFilename (const Util::String &name, const Util::String &folder) |
set a optional blueprints.xml, which is used instead of standard blueprint.xml | |
static BlueprintId const | GetBlueprintId (Util::StringAtom name) |
get a blueprint id | |
static TemplateId const | GetTemplateId (Util::StringAtom name) |
get a template id | |
static Util::StringAtom const | GetTemplateName (TemplateId const templateId) |
get template name | |
static Util::Array< Template > const & | ListTemplates () |
Private Member Functions | |
__DeclareSingleton (BlueprintManager) | |
BlueprintManager () | |
constructor | |
~BlueprintManager () | |
destructor | |
bool | ParseBlueprint (Util::String const &blueprintsPath) |
parse entity blueprints file | |
bool | LoadTemplateFolder (Util::String const &path) |
load a template folder | |
bool | ParseTemplate (Util::String const &templatePath) |
parse blueprint template file | |
void | SetupBlueprints () |
setup blueprint database | |
MemDb::TableId | CreateCategory (World *const world, BlueprintId bid) |
create a table in the world db | |
Static Private Member Functions | |
static void | OnActivate () |
called when attached to game server. Needs to be attached after categorymanager | |
Private Attributes | |
Util::Array< Template > | templates |
Util::Array< Blueprint > | blueprints |
contains all blueprints and their information. | |
Ids::IdGenerationPool | templateIdPool |
Util::HashTable< Util::StringAtom, TemplateId > | templateMap |
maps from template name to template id | |
Util::HashTable< Util::StringAtom, BlueprintId > | blueprintMap |
maps from blueprint name to blueprint id, which is the index in the blueprints array. | |
Static Private Attributes | |
static Util::String | blueprintFolder |
static Util::String | templatesFolder |
|
private |
constructor
|
private |
destructor
|
private |
|
static |
Create the singleton.
|
private |
create a table in the world db
|
static |
Destroy the singleton.
|
static |
get a blueprint id
|
static |
get a template id
|
static |
get template name
EntityMapping Game::BlueprintManager::Instantiate | ( | World *const | world, |
BlueprintId | blueprint ) |
create an instance from blueprint. Note that this does not tie it to an entity! It's not recommended to create entities this way.
EntityMapping Game::BlueprintManager::Instantiate | ( | World *const | world, |
TemplateId | templateId ) |
create an instance from template. Note that this does not tie it to an entity! It's not recommended to create entities this way.
|
static |
|
private |
load a template folder
|
staticprivate |
called when attached to game server. Needs to be attached after categorymanager
|
private |
parse entity blueprints file
This method parses the file data:tables/blueprints.json into the blueprints array.
|
private |
parse blueprint template file
|
static |
set a optional blueprints.xml, which is used instead of standard blueprint.xml
|
private |
setup blueprint database
|
staticprivate |
|
private |
maps from blueprint name to blueprint id, which is the index in the blueprints array.
|
private |
contains all blueprints and their information.
|
private |
|
private |
maps from template name to template id
|
private |
|
staticprivate |