feat: dynamically manage floors/rooms/tags

This commit is contained in:
2026-04-16 16:57:45 +02:00
parent 34ddbe669e
commit c3fd8b950c
11 changed files with 238 additions and 22 deletions
+15
View File
@@ -27,6 +27,8 @@ defmodule Localiser.Localisation.Room.Server do
@impl true
def init(room) do
Phoenix.PubSub.subscribe(@pubsub, "rooms")
state = %__MODULE__{
id: room.id,
name: room.name,
@@ -65,6 +67,19 @@ defmodule Localiser.Localisation.Room.Server do
{:reply, state.occupants, state}
end
@impl true
def handle_info({:room_updated, %{id: id} = room}, %{id: id} = state) do
{:noreply, %{state |
name: room.name,
offset_x: room.offset_x || 0.0,
offset_y: room.offset_y || 0.0,
width: room.width || 0.0,
height: room.height || 0.0
}}
end
def handle_info(_msg, state), do: {:noreply, state}
defp broadcast(room_id, occupants) do
Phoenix.PubSub.broadcast(
@pubsub,