| 26 | } |
| 27 | |
| 28 | InteractAction LoungeableObject::interact(InteractRequest const& request) { |
| 29 | auto res = Object::interact(request); |
| 30 | if (res.type == InteractActionType::None && !m_sitPositions.empty()) { |
| 31 | Maybe<size_t> index; |
| 32 | Vec2F interactOffset = |
| 33 | direction() == Direction::Right ? position() - request.interactPosition : request.interactPosition - position(); |
| 34 | for (size_t i = 0; i < m_sitPositions.size(); ++i) { |
| 35 | if (!index || vmag(m_sitPositions[i] + interactOffset) < vmag(m_sitPositions[*index] + interactOffset)) |
| 36 | index = i; |
| 37 | } |
| 38 | return InteractAction(InteractActionType::SitDown, entityId(), *index); |
| 39 | } else { |
| 40 | return res; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | size_t LoungeableObject::anchorCount() const { |
| 45 | return m_sitPositions.size(); |
nothing calls this directly
no test coverage detected