mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +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
|
@ -1830,7 +1830,8 @@ bool ServerEnvironment::getActiveObjectMessage(ActiveObjectMessage *dest)
|
|||
|
||||
void ServerEnvironment::getSelectedActiveObjects(
|
||||
const core::line3d<f32> &shootline_on_map,
|
||||
std::vector<PointedThing> &objects)
|
||||
std::vector<PointedThing> &objects,
|
||||
const std::optional<Pointabilities> &pointabilities)
|
||||
{
|
||||
std::vector<ServerActiveObject *> objs;
|
||||
getObjectsInsideRadius(objs, shootline_on_map.start,
|
||||
|
@ -1863,10 +1864,26 @@ void ServerEnvironment::getSelectedActiveObjects(
|
|||
current_raw_normal = current_normal;
|
||||
}
|
||||
if (collision) {
|
||||
current_intersection += pos;
|
||||
objects.emplace_back(
|
||||
(s16) obj->getId(), current_intersection, current_normal, current_raw_normal,
|
||||
(current_intersection - shootline_on_map.start).getLengthSQ());
|
||||
PointabilityType pointable;
|
||||
if (pointabilities) {
|
||||
if (LuaEntitySAO* lsao = dynamic_cast<LuaEntitySAO*>(obj)) {
|
||||
pointable = pointabilities->matchObject(lsao->getName(),
|
||||
usao->getArmorGroups()).value_or(props->pointable);
|
||||
} else if (PlayerSAO* psao = dynamic_cast<PlayerSAO*>(obj)) {
|
||||
pointable = pointabilities->matchPlayer(psao->getArmorGroups()).value_or(
|
||||
props->pointable);
|
||||
} else {
|
||||
pointable = props->pointable;
|
||||
}
|
||||
} else {
|
||||
pointable = props->pointable;
|
||||
}
|
||||
if (pointable != PointabilityType::POINTABLE_NOT) {
|
||||
current_intersection += pos;
|
||||
objects.emplace_back(
|
||||
(s16) 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