| 1454 | } |
| 1455 | |
| 1456 | void Player::interactWithEntity(InteractiveEntityPtr entity) { |
| 1457 | bool questIntercepted = false; |
| 1458 | for (auto quest : m_questManager->listActiveQuests()) { |
| 1459 | if (quest->interactWithEntity(entity->entityId())) |
| 1460 | questIntercepted = true; |
| 1461 | } |
| 1462 | if (questIntercepted) |
| 1463 | return; |
| 1464 | |
| 1465 | bool anyTurnedIn = false; |
| 1466 | |
| 1467 | for (auto questId : entity->turnInQuests()) { |
| 1468 | if (m_questManager->canTurnIn(questId)) { |
| 1469 | auto const& quest = m_questManager->getQuest(questId); |
| 1470 | quest->setEntityParameter("questReceiver", entity); |
| 1471 | m_questManager->getQuest(questId)->complete(); |
| 1472 | anyTurnedIn = true; |
| 1473 | } |
| 1474 | } |
| 1475 | |
| 1476 | if (anyTurnedIn) |
| 1477 | return; |
| 1478 | |
| 1479 | for (auto questArc : entity->offeredQuests()) { |
| 1480 | if (m_questManager->canStart(questArc)) { |
| 1481 | auto quest = make_shared<Quest>(questArc, 0, this); |
| 1482 | quest->setWorldId(clientContext()->playerWorldId()); |
| 1483 | quest->setServerUuid(clientContext()->serverUuid()); |
| 1484 | quest->setEntityParameter("questGiver", entity); |
| 1485 | m_questManager->offer(quest); |
| 1486 | return; |
| 1487 | } |
| 1488 | } |
| 1489 | |
| 1490 | m_pendingInteractActions.append(world()->interact(InteractRequest{ |
| 1491 | entityId(), position(), entity->entityId(), aimPosition()})); |
| 1492 | } |
| 1493 | |
| 1494 | void Player::aim(Vec2F const& position) { |
| 1495 | m_techController->setAimPosition(position); |
nothing calls this directly
no test coverage detected