mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +00:00
Tool specific pointing and blocking pointable type (#13992)
This commit is contained in:
parent
fb461d21a5
commit
5958714309
39 changed files with 676 additions and 67 deletions
|
@ -489,7 +489,8 @@ ClientEnvEvent ClientEnvironment::getClientEnvEvent()
|
|||
|
||||
void ClientEnvironment::getSelectedActiveObjects(
|
||||
const core::line3d<f32> &shootline_on_map,
|
||||
std::vector<PointedThing> &objects)
|
||||
std::vector<PointedThing> &objects,
|
||||
const std::optional<Pointabilities> &pointabilities)
|
||||
{
|
||||
auto allObjects = m_ao_manager.getActiveSelectableObjects(shootline_on_map);
|
||||
const v3f line_vector = shootline_on_map.getVector();
|
||||
|
@ -516,9 +517,23 @@ void ClientEnvironment::getSelectedActiveObjects(
|
|||
current_raw_normal = current_normal;
|
||||
}
|
||||
if (collision) {
|
||||
current_intersection += obj->getPosition();
|
||||
objects.emplace_back(obj->getId(), current_intersection, current_normal, current_raw_normal,
|
||||
(current_intersection - shootline_on_map.start).getLengthSQ());
|
||||
PointabilityType pointable;
|
||||
if (pointabilities) {
|
||||
if (gcao->isPlayer()) {
|
||||
pointable = pointabilities->matchPlayer(gcao->getGroups()).value_or(
|
||||
gcao->getProperties().pointable);
|
||||
} else {
|
||||
pointable = pointabilities->matchObject(gcao->getName(),
|
||||
gcao->getGroups()).value_or(gcao->getProperties().pointable);
|
||||
}
|
||||
} else {
|
||||
pointable = gcao->getProperties().pointable;
|
||||
}
|
||||
if (pointable != PointabilityType::POINTABLE_NOT) {
|
||||
current_intersection += obj->getPosition();
|
||||
objects.emplace_back(obj->getId(), current_intersection, current_normal, current_raw_normal,
|
||||
(current_intersection - shootline_on_map.start).getLengthSQ(), pointable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue