Restore feature: maximum display distance for ship indicators
parent
619ed1b3e3
commit
35231eee19
|
@ -138,7 +138,7 @@ local function displayOnScreenObjects()
|
|||
local iconsize = Vector2(18 , 18)
|
||||
local label_offset = 14 -- enough so that the target rectangle fits
|
||||
local collapse = iconsize
|
||||
local bodies_grouped = ui.getProjectedBodiesGrouped(collapse)
|
||||
local bodies_grouped = ui.getProjectedBodiesGrouped(collapse, IN_SPACE_INDICATOR_SHIP_MAX_DISTANCE)
|
||||
|
||||
for _,group in ipairs(bodies_grouped) do
|
||||
local mainBody = group[2].body
|
||||
|
|
|
@ -1467,6 +1467,7 @@ static int l_pigui_get_projected_bodies_grouped(lua_State *l)
|
|||
{
|
||||
PROFILE_SCOPED()
|
||||
const vector2d gap = LuaPull<vector2d>(l, 1);
|
||||
const double ship_max_distance = LuaPull<double>(l, 2);
|
||||
|
||||
TSS_vector filtered;
|
||||
filtered.reserve(Pi::game->GetSpace()->GetNumBodies());
|
||||
|
@ -1474,6 +1475,8 @@ static int l_pigui_get_projected_bodies_grouped(lua_State *l)
|
|||
for (Body *body : Pi::game->GetSpace()->GetBodies()) {
|
||||
if (body == Pi::game->GetPlayer()) continue;
|
||||
if (body->GetType() == Object::PROJECTILE) continue;
|
||||
if (body->GetType() == Object::SHIP &&
|
||||
body->GetPositionRelTo(Pi::player).Length() > ship_max_distance) continue;
|
||||
const TScreenSpace res = lua_world_space_to_screen_space(body); // defined in LuaPiGui.cpp
|
||||
if (!res._onScreen) continue;
|
||||
filtered.emplace_back(res);
|
||||
|
|
Loading…
Reference in New Issue