MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / initFromJSONDescriptor

Method initFromJSONDescriptor

src/logic/MobController.cpp:246–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void MobController::initFromJSONDescriptor(const json& j)
247{
248 m_FocusName = j["focusName"];
249 m_zObjectClass = j["objectClass"];
250
251 if (m_FocusName == "Bed")
252 m_MobCore = new MobCores::Bed(m_World, m_Entity);
253 else if (m_FocusName == "Ladder")
254 m_MobCore = new MobCores::Ladder(m_World, m_Entity);
255 else if (m_zObjectClass.find("oCMobContainer:") != std::string::npos)
256 m_MobCore = new MobCores::Container(m_World, m_Entity);
257 else
258 m_MobCore = new MobCore(m_World, m_Entity);
259
260 assert(m_MobCore);
261
262 // Apply animation scheme
263 m_MobCore->setSchemeName(m_FocusName);
264
265 m_MobCore->importCore(j["core"]);
266
267 // Setting the visual AFTER the mobcore is important, since then the scheme-name will be propergated
268 // since it is derived from the visual-name
269}
270
271void MobController::onMessage(std::shared_ptr<EventMessages::EventMessage> message, Handle::EntityHandle sourceVob)
272{

Callers

nothing calls this directly

Calls 3

findMethod · 0.80
setSchemeNameMethod · 0.80
importCoreMethod · 0.45

Tested by

no test coverage detected