MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / GetDefinitionForGameObject

Method GetDefinitionForGameObject

src/Core/Script/GameObject.cpp:53–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 vili::node GameObjectDatabase::GetDefinitionForGameObject(const std::string& type)
54 {
55 if (allDefinitions[type].is_null())
56 {
57 const std::string objectDefinitionPath = System::Path("Data/GameObjects/")
58 .add(type)
59 .add(type + ".obj.vili")
60 .find();
61 if (objectDefinitionPath.empty())
62 throw Exceptions::ObjectDefinitionNotFound(type, EXC_INFO);
63 vili::node getGameObjectFile = vili::parser::from_file(
64 objectDefinitionPath, Config::Templates::getGameObjectTemplates());
65 if (!getGameObjectFile[type].is_null())
66 {
67 vili::node& definitionData = getGameObjectFile.at(type);
68 allDefinitions[type] = definitionData;
69 return definitionData;
70 }
71 throw Exceptions::ObjectDefinitionBlockNotFound(type, EXC_INFO);
72 }
73 return allDefinitions.at(type);
74 }
75
76 void GameObjectDatabase::ApplyRequirements(
77 sol::environment environment, vili::node& requires)

Callers

nothing calls this directly

Calls 10

PathClass · 0.85
from_fileFunction · 0.85
getGameObjectTemplatesFunction · 0.85
is_nullMethod · 0.45
findMethod · 0.45
addMethod · 0.45
emptyMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected