diff --git a/lib/wanderer_app/map/server/map_server_connections_impl.ex b/lib/wanderer_app/map/server/map_server_connections_impl.ex index fe77b68e..5993c850 100644 --- a/lib/wanderer_app/map/server/map_server_connections_impl.ex +++ b/lib/wanderer_app/map/server/map_server_connections_impl.ex @@ -363,22 +363,26 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do case scope do :wormholes -> - not (@prohibited_system_classes |> Enum.member?(system_static_info.system_class)) and + not is_prohibited_system_class?(system_static_info.system_class) and not (@prohibited_systems |> Enum.member?(solar_system_id)) and @wh_space |> Enum.member?(system_static_info.system_class) :stargates -> - not (@prohibited_system_classes |> Enum.member?(system_static_info.system_class)) and + not is_prohibited_system_class?(system_static_info.system_class) and @known_space |> Enum.member?(system_static_info.system_class) :all -> - not (@prohibited_system_classes |> Enum.member?(system_static_info.system_class)) + not is_prohibited_system_class?(system_static_info.system_class) _ -> false end end + def is_prohibited_system_class?(system_class) do + @prohibited_system_classes |> Enum.member?(system_class) + end + def is_connection_exist(map_id, from_solar_system_id, to_solar_system_id), do: not is_nil( @@ -412,16 +416,16 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do case scope do :wormholes -> - not (@prohibited_system_classes |> Enum.member?(from_system_static_info.system_class)) and - not (@prohibited_system_classes |> Enum.member?(to_system_static_info.system_class)) and + not is_prohibited_system_class?(from_system_static_info.system_class) and + not is_prohibited_system_class?(to_system_static_info.system_class) and not (@prohibited_systems |> Enum.member?(from_solar_system_id)) and not (@prohibited_systems |> Enum.member?(to_solar_system_id)) and known_jumps |> Enum.empty?() and to_solar_system_id != @jita and from_solar_system_id != @jita :stargates -> - not (@prohibited_system_classes |> Enum.member?(from_system_static_info.system_class)) and - not (@prohibited_system_classes |> Enum.member?(to_system_static_info.system_class)) and + not is_prohibited_system_class?(from_system_static_info.system_class) and + not is_prohibited_system_class?(to_system_static_info.system_class) and not (known_jumps |> Enum.empty?()) end end diff --git a/lib/wanderer_app_web/live/maps/event_handlers/map_systems_event_handler.ex b/lib/wanderer_app_web/live/maps/event_handlers/map_systems_event_handler.ex index 931d44f0..a29c2c8e 100644 --- a/lib/wanderer_app_web/live/maps/event_handlers/map_systems_event_handler.ex +++ b/lib/wanderer_app_web/live/maps/event_handlers/map_systems_event_handler.ex @@ -317,6 +317,12 @@ defmodule WandererAppWeb.MapSystemsEventHandler do WandererApp.Api.MapSolarSystem.find_by_name!(%{name: text}) |> Enum.take(100) |> Enum.map(&map_system/1) + |> Enum.filter(fn system -> + not is_nil(system) && not is_nil(system.system_static_info) && + not WandererApp.Map.Server.ConnectionsImpl.is_prohibited_system_class?( + system.system_static_info.system_class + ) + end) {:reply, %{systems: systems}, socket} end