| 308 | } |
| 309 | |
| 310 | void Player::init(World* world, EntityId entityId, EntityMode mode) { |
| 311 | Entity::init(world, entityId, mode); |
| 312 | |
| 313 | |
| 314 | m_tools->init(this); |
| 315 | m_movementController->init(world); |
| 316 | m_movementController->setIgnorePhysicsEntities({entityId}); |
| 317 | m_statusController->init(this, m_movementController.get()); |
| 318 | m_techController->init(this, m_movementController.get(), m_statusController.get()); |
| 319 | |
| 320 | if (mode == EntityMode::Master) { |
| 321 | auto speciesDefinition = Root::singleton().speciesDatabase()->species(m_identity.species); |
| 322 | m_movementController->setRotation(0); |
| 323 | m_statusController->setStatusProperty("ouchNoise", speciesDefinition->ouchNoise(m_identity.gender)); |
| 324 | m_emoteState = HumanoidEmote::Idle; |
| 325 | m_questManager->init(world); |
| 326 | m_companions->init(this, world); |
| 327 | m_deployment->init(this, world); |
| 328 | m_missionRadioMessages.clear(); |
| 329 | |
| 330 | m_statusController->setPersistentEffects("species", speciesDefinition->statusEffects()); |
| 331 | |
| 332 | for (auto& p : m_genericScriptContexts) { |
| 333 | p.second->addActorMovementCallbacks(m_movementController.get()); |
| 334 | p.second->addCallbacks("player", LuaBindings::makePlayerCallbacks(this)); |
| 335 | p.second->addCallbacks("status", LuaBindings::makeStatusControllerCallbacks(m_statusController.get())); |
| 336 | p.second->addCallbacks("songbook", LuaBindings::makeSongbookCallbacks(m_songbook.get())); |
| 337 | if (m_client) |
| 338 | p.second->addCallbacks("celestial", LuaBindings::makeCelestialCallbacks(m_client)); |
| 339 | p.second->init(world); |
| 340 | } |
| 341 | |
| 342 | for (auto& p : m_inventory->pullOverflow()) { |
| 343 | world->addEntity(ItemDrop::createRandomizedDrop(p, m_movementController->position(), true)); |
| 344 | } |
| 345 | |
| 346 | setNetArmorSecrets(); |
| 347 | } |
| 348 | |
| 349 | m_xAimPositionNetState.setInterpolator(world->geometry().xLerpFunction()); |
| 350 | refreshEquipment(); |
| 351 | } |
| 352 | |
| 353 | void Player::uninit() { |
| 354 | m_techController->uninit(); |
nothing calls this directly
no test coverage detected