pipeworks_mud_mapper.callbacks.room_callbacks
Room editing callbacks.
This module handles:
Adding new rooms to the zone
Clearing the form for new room entry
Populating the form when a room is selected
Updating existing room properties
Component Dependencies
Inputs:
- add-room-btn: Add new room button
- new-room-btn: Clear form for new room
- selected-room: Room selection trigger
- update-room-btn: Update existing room
States:
- current-zone-data: Current zone data
- room-id, room-name, room-description: Form fields
- room-coord-x, room-coord-y, room-coord-z: Coordinates
Outputs:
- current-zone-data: Updated zone data
- room-form-feedback: Validation messages
- Form fields: Populated or cleared values
- has-unsaved-changes: Unsaved flag
- exit-checkboxes: Exit state
- exit-feedback: Exit display
See also
-
Functions
|
Add a new room to the current zone. |
|
Clear the form and deselect room when New Room button is clicked. |
|
Populate the room form when a room is selected. |
|
Update an existing room's properties. |
|
Enable/disable delete button based on selection. |
|
Open delete confirmation dialog with details. |
|
Close delete confirmation modal on cancel. |
|
Delete the room and store undo data. |
|
Restore a deleted room from undo data. |
|
Render the latest room feedback payload from any source. |
Module Contents
- pipeworks_mud_mapper.callbacks.room_callbacks.add_room_to_zone(n_clicks, zone_data, room_id, room_name, room_description, coord_x, coord_y, coord_z)[source]
Add a new room to the current zone.
Validates input, creates the room data structure, and adds it to the zone. Clears the form on success.
- Parameters:
n_clicks (
int) – Click count for the Add Room button.zone_data (
dict | None) – Current zone data.room_id (
str) – Room ID input value.room_name (
str) – Room name input value.room_description (
str) – Room description input value.coord_x (
int) – Coordinate input values.coord_y (
int) – Coordinate input values.coord_z (
int) – Coordinate input values.
- Returns:
Updated zone data, feedback, cleared form values, unsaved flag.
- Return type:
Notes
Room ID must be unique within the zone
Room ID format: start with letter, alphanumeric + underscore
Coordinates must be valid integers
Name defaults to room_id if not provided
- pipeworks_mud_mapper.callbacks.room_callbacks.clear_form_for_new_room(n_clicks)[source]
Clear the form and deselect room when New Room button is clicked.
Resets the properties panel to create a new room:
Clears all form fields
Deselects any selected room
Disables Update button
Enables Room ID field
Clears exit checkboxes
- pipeworks_mud_mapper.callbacks.room_callbacks.populate_room_form(selected_room, zone_data)[source]
Populate the room form when a room is selected.
Fills all form fields with the selected room’s data:
Room ID, name, description
Coordinates
Exit checkboxes reflecting current exits
Exit feedback showing exit targets
- Parameters:
selected_room (
str | None) – Selected room ID, or None.zone_data (
dict | None) – Current zone data.
- Returns:
Form field values, checkbox values, button states.
- Return type:
Notes
When a room is selected, Room ID is disabled (can’t change ID)
Update button is enabled when a room is selected
Exit checkboxes show which directions have exits
Exit feedback shows “direction→target” for each exit
- pipeworks_mud_mapper.callbacks.room_callbacks.update_room_properties(n_clicks, selected_room, zone_data, room_name, room_description, coord_x, coord_y, coord_z)[source]
Update an existing room’s properties.
Modifies the selected room’s name, description, and coordinates. Room ID cannot be changed.
- Parameters:
n_clicks (
int) – Click count for the Update button.selected_room (
str | None) – Selected room ID.zone_data (
dict | None) – Current zone data.room_name (
str) – New room name value.room_description (
str) – New room description value.coord_x (
int) – New coordinate values.coord_y (
int) – New coordinate values.coord_z (
int) – New coordinate values.
- Returns:
Updated zone data, feedback alert, unsaved flag.
- Return type:
- pipeworks_mud_mapper.callbacks.room_callbacks.update_delete_button_state(selected_room, zone_data)[source]
Enable/disable delete button based on selection.
Delete is disabled when: - No room is selected - Selected room is the spawn room
- Parameters:
selected_room (
str | None) – Currently selected room ID.zone_data (
dict | None) – Current zone data.
- Returns:
True if delete should be disabled.
- Return type:
- pipeworks_mud_mapper.callbacks.room_callbacks.open_delete_confirmation(n_clicks, selected_room, zone_data)[source]
Open delete confirmation dialog with details.
Shows the room name and how many exits from other rooms will be removed.
- pipeworks_mud_mapper.callbacks.room_callbacks.close_delete_confirmation(n_clicks)[source]
Close delete confirmation modal on cancel.
- pipeworks_mud_mapper.callbacks.room_callbacks.confirm_delete_room(n_clicks, selected_room, zone_data)[source]
Delete the room and store undo data.