MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / interactWithEntity

Method interactWithEntity

source/game/StarPlayer.cpp:1456–1492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1454}
1455
1456void 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
1494void Player::aim(Vec2F const& position) {
1495 m_techController->setAimPosition(position);

Callers

nothing calls this directly

Calls 15

listActiveQuestsMethod · 0.80
entityIdMethod · 0.80
getQuestMethod · 0.80
setEntityParameterMethod · 0.80
completeMethod · 0.80
canStartMethod · 0.80
turnInQuestsMethod · 0.45
canTurnInMethod · 0.45
offeredQuestsMethod · 0.45
setWorldIdMethod · 0.45
playerWorldIdMethod · 0.45
setServerUuidMethod · 0.45

Tested by

no test coverage detected