pipeworks_mud_mapper.callbacks.exit_callbacks

Exit management callbacks.

This module handles both:

  • Local exit checkbox changes (bidirectional exits within a zone)

  • Cross-zone exit edits via the Workspace table/editor (zone_id:room_id)

Design Decisions

Bidirectional by default: When an exit checkbox is checked and a target room is found, both the forward and reverse exits are created. This matches player expectations in MUDs.

No room = rejected: If no room exists in the checked direction, the checkbox is automatically unchecked and a warning is shown.

Removal is one-way: When unchecking an exit, only the exit from the current room is removed. The reverse exit on the target room remains (can be manually removed if needed).

Component Dependencies

Inputs: - exit-checkboxes: Checklist of direction abbreviations - workspace-zone-exit-direction: Selected direction for zone exits - workspace-zone-exit-zone: Selected zone for cross-zone exit - workspace-zone-exit-room: Selected room for cross-zone exit - workspace-zone-exit-save: Persist the zone exit selection - workspace-zone-exit-clear: Remove a zone exit from a direction

States: - selected-room: Currently selected room - current-zone-data: Zone data for room lookup + mutation

Outputs: - current-zone-data: Updated with new exits - exit-checkboxes: Corrected values (rejected unchecked) - exit-feedback: Status display - workspace-zone-exit-table: Zone exit summary table - workspace-zone-exit-feedback: Status display for cross-zone exits - has-unsaved-changes: Unsaved flag

See also

-, -

Functions

handle_exit_changes(checked_values, selected_room, ...)

Handle exit checkbox changes - add or remove exits.

load_workspace_zone_exit_zone_options(_)

Load zone options from world metadata for the workspace editor.

update_workspace_zone_exit_room_options(zone_id, ...)

Update room options when the selected zone changes.

update_workspace_zone_exit_table(selected_room, zone_data)

Render the zone exit table for the selected room.

populate_workspace_zone_exit_editor(selected_room, ...)

Populate the zone exit editor from table clicks.

clear_workspace_zone_exit_feedback(_)

Clear action feedback when the selected room changes.

handle_workspace_zone_exit_action(save_clicks, ...)

Apply workspace zone exit changes to the active map.

Module Contents

pipeworks_mud_mapper.callbacks.exit_callbacks.handle_exit_changes(checked_values, selected_room, zone_data)[source]

Handle exit checkbox changes - add or remove exits.

When an exit checkbox is checked:

  1. Find the nearest room in that direction

  2. If found, create exit and reverse exit (bidirectional)

  3. If not found, reject and show warning

When an exit checkbox is unchecked:

  1. Remove the exit from current room only

  2. Reverse exit on target room is NOT removed (can be done manually)

Parameters:
  • checked_values (list[str]) – List of checked direction abbreviations (e.g., [“N”, “E”]).

  • selected_room (str | None) – Currently selected room ID.

  • zone_data (dict | None) – Current zone data.

Returns:

Updated zone data, corrected checkbox values, feedback, unsaved flag.

Return type:

tuple

Notes

  • Uses find_room_in_direction to locate nearest room

  • OPPOSITE_DIRECTION maps direction to its reverse

  • Rejected directions (no room found) are unchecked automatically

  • Feedback shows current exits and any warnings

pipeworks_mud_mapper.callbacks.exit_callbacks.load_workspace_zone_exit_zone_options(_)[source]

Load zone options from world metadata for the workspace editor.

pipeworks_mud_mapper.callbacks.exit_callbacks.update_workspace_zone_exit_room_options(zone_id, current_room)[source]

Update room options when the selected zone changes.

pipeworks_mud_mapper.callbacks.exit_callbacks.update_workspace_zone_exit_table(selected_room, zone_data)[source]

Render the zone exit table for the selected room.

pipeworks_mud_mapper.callbacks.exit_callbacks.populate_workspace_zone_exit_editor(selected_room, row_clicks, zone_data)[source]

Populate the zone exit editor from table clicks.

pipeworks_mud_mapper.callbacks.exit_callbacks.clear_workspace_zone_exit_feedback(_)[source]

Clear action feedback when the selected room changes.

pipeworks_mud_mapper.callbacks.exit_callbacks.handle_workspace_zone_exit_action(save_clicks, clear_clicks, direction_short, zone_id, room_id, selected_room, zone_data)[source]

Apply workspace zone exit changes to the active map.