Skip to content

Implement Industrial Elevators#7836

Draft
HammerGS wants to merge 10 commits intomainfrom
Implement-Controllable-Elevators
Draft

Implement Industrial Elevators#7836
HammerGS wants to merge 10 commits intomainfrom
Implement-Controllable-Elevators

Conversation

@HammerGS
Copy link
Member

@HammerGS HammerGS commented Dec 27, 2025

Summary

Implements player-controlled industrial elevators per BattleTech rules, distinct from the existing Solaris 7 random "moving walls" elevator system.

Key Features

  • New terrain type: INDUSTRIAL_ELEVATOR (type 60) - separate from Solaris ELEVATOR (type 36)
  • Player-controlled movement: Units on the platform can ascend/descend at 1 MP per level
  • Platform tracking: Elevator platform position persists across turns
  • Shaft boundaries: Configurable shaft top/bottom limits from terrain data
  • Capacity system: Elevators have tonnage limits (encoded in terrain)
  • Client-server sync: Platform state synchronized via UPDATE_INDUSTRIAL_ELEVATORS packet

Terrain Encoding

industrial_elevator::

  • shaftBottom: Lowest level of shaft (can be negative for basements)
  • encoded: (shaftTop << 8) | capacityTons - top level and capacity in one value

Example: industrial_elevator:-4:50 = shaft from -4 to 0, 500 ton capacity

Files Changed

New Files:

  • megamek/src/megamek/common/IndustrialElevator.java - Elevator state model
  • megamek/src/megamek/server/IndustrialElevatorProcessor.java - End-phase processing
  • megamek/src/megamek/common/actions/CallElevatorAction.java - Future: call elevator from adjacent hex
  • megamek/src/megamek/common/moves/ElevatorAscendStep.java - Ascend movement step
  • megamek/src/megamek/common/moves/ElevatorDescendStep.java - Descend movement step

Modified Files:

  • Terrains.java - Added INDUSTRIAL_ELEVATOR constant
  • MoveStepType.java - Added ELEVATOR_ASCEND, ELEVATOR_DESCEND
  • MoveStep.java - Elevator movement validation
  • MovePath.java - Elevator step handling
  • Game.java - Industrial elevator state storage
  • TWGameManager.java - Initialization and sync methods
  • MovePathHandler.java - Server-side movement processing, fall logic
  • MovementDisplay.java - UI buttons for elevator control
  • Client.java - Receive elevator updates
  • PacketCommand.java - New packet type
  • report-messages.properties - Elevator movement reports

Board/Tileset Files:

  • 32x17 Heliport - Lift.board - Updated to use industrial_elevator terrain
  • StandardIndustrialElevator.tileinc - Tileset mappings
  • saxarba.tileset, hq_saxarba.tileset - Graphics entries

How It Works

  1. Initialization: TWGameManager scans board for INDUSTRIAL_ELEVATOR terrain, creates IndustrialElevator objects
  2. Movement Phase: When unit is on elevator platform, Up/Down buttons enabled based on shaft bounds
  3. Elevator Movement: Platform moves WITH the unit (1 MP cost per level)
  4. State Sync: After each move, server sends updated elevator state to all clients
  5. Persistence: Platform position preserved across turns (fixed reinitialization bug)

Test Plan

  • Elevator buttons enable when standing on elevator platform
  • Elevator buttons respect shaft boundaries (top/bottom limits)
  • Platform position persists across multiple turns
  • Movement costs 1 MP per level
  • Both ascend and descend work correctly
  • Client receives platform updates after server processes move

Notes

  • This system is intentionally separate from ElevatorProcessor (Solaris 7 random elevators)
  • The "Call Elevator" feature (from adjacent hexes) is stubbed but not yet implemented in UI
  • Fall-into-shaft logic exists but needs additional testing
  • Includes data and a test board

TODO

  • Map Editor
  • Need to figure out how to use the Saxarba Elevators
  • Need to have Player Specific Controls

  Summary

  Implements player-controlled industrial elevators per BattleTech rules, distinct from the existing Solaris 7 random "moving walls" elevator system.

  Key Features

  - New terrain type: INDUSTRIAL_ELEVATOR (type 60) - separate from Solaris ELEVATOR (type 36)
  - Player-controlled movement: Units on the platform can ascend/descend at 1 MP per level
  - Platform tracking: Elevator platform position persists across turns
  - Shaft boundaries: Configurable shaft top/bottom limits from terrain data
  - Capacity system: Elevators have tonnage limits (encoded in terrain)
  - Client-server sync: Platform state synchronized via UPDATE_INDUSTRIAL_ELEVATORS packet

  Terrain Encoding

  industrial_elevator:<shaftBottom>:<encoded>
  - shaftBottom: Lowest level of shaft (can be negative for basements)
  - encoded: (shaftTop << 8) | capacityTons - top level and capacity in one value

  Example: industrial_elevator:-4:50 = shaft from -4 to 0, 500 ton capacity

  Files Changed

  New Files:
  - megamek/src/megamek/common/IndustrialElevator.java - Elevator state model
  - megamek/src/megamek/server/IndustrialElevatorProcessor.java - End-phase processing
  - megamek/src/megamek/common/actions/CallElevatorAction.java - Future: call elevator from adjacent hex
  - megamek/src/megamek/common/moves/ElevatorAscendStep.java - Ascend movement step
  - megamek/src/megamek/common/moves/ElevatorDescendStep.java - Descend movement step

  Modified Files:
  - Terrains.java - Added INDUSTRIAL_ELEVATOR constant
  - MoveStepType.java - Added ELEVATOR_ASCEND, ELEVATOR_DESCEND
  - MoveStep.java - Elevator movement validation
  - MovePath.java - Elevator step handling
  - Game.java - Industrial elevator state storage
  - TWGameManager.java - Initialization and sync methods
  - MovePathHandler.java - Server-side movement processing, fall logic
  - MovementDisplay.java - UI buttons for elevator control
  - Client.java - Receive elevator updates
  - PacketCommand.java - New packet type
  - report-messages.properties - Elevator movement reports

  Board/Tileset Files:
  - 32x17 Heliport - Lift.board - Updated to use industrial_elevator terrain
  - StandardIndustrialElevator.tileinc - Tileset mappings
  - saxarba.tileset, hq_saxarba.tileset - Graphics entries

  How It Works

  1. Initialization: TWGameManager scans board for INDUSTRIAL_ELEVATOR terrain, creates IndustrialElevator objects
  2. Movement Phase: When unit is on elevator platform, Up/Down buttons enabled based on shaft bounds
  3. Elevator Movement: Platform moves WITH the unit (1 MP cost per level)
  4. State Sync: After each move, server sends updated elevator state to all clients
  5. Persistence: Platform position preserved across turns (fixed reinitialization bug)

  Test Plan

  - Elevator buttons enable when standing on elevator platform
  - Elevator buttons respect shaft boundaries (top/bottom limits)
  - Platform position persists across multiple turns
  - Movement costs 1 MP per level
  - Both ascend and descend work correctly
  - Client receives platform updates after server processes move

  Notes

  - This system is intentionally separate from ElevatorProcessor (Solaris 7 random elevators)
  - The "Call Elevator" feature (from adjacent hexes) is stubbed but not yet implemented in UI
  - Fall-into-shaft logic exists but needs additional testing
  - Includes data and a test board
@HammerGS HammerGS added the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Dec 27, 2025
Copilot AI review requested due to automatic review settings December 27, 2025 22:20
@HammerGS HammerGS requested a review from a team as a code owner December 27, 2025 22:20
@HammerGS HammerGS added In Development (Draft) An additional way to mark something as a draft. Make it stand out more. Draft Work in Progress AI Generated Fix AI-generated fix. Requires human testing and review before merging. Needs Player Testing PR lacks actual play testing. labels Dec 27, 2025
@HammerGS HammerGS requested a review from psikomonkie December 27, 2025 22:20
@HammerGS HammerGS marked this pull request as draft December 27, 2025 22:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements player-controlled industrial elevators as distinct from the existing Solaris 7 random elevator system. The implementation adds a new terrain type (INDUSTRIAL_ELEVATOR) with platform state tracking, movement validation, and client-server synchronization.

Key Changes:

  • New industrial elevator system with player-controlled movement costing 1 MP per level
  • Elevator state management including platform position, shaft bounds, and tonnage capacity
  • Movement phase integration with UI buttons and server-side validation
  • End-phase automatic elevator movement toward queued calls

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
IndustrialElevator.java Core elevator model with platform tracking, capacity checking, and call queue management
IndustrialElevatorProcessor.java End-phase processor for initializing elevators and handling automatic platform movement
CallElevatorAction.java Action for calling elevators from adjacent hexes (stubbed for future use)
ElevatorAscendStep.java, ElevatorDescendStep.java Movement step handlers for elevator ascent/descent
MoveStep.java Validation logic for elevator movement steps
MovePathHandler.java Server-side movement processing with platform updates and fall detection
Game.java Storage and retrieval methods for industrial elevators
TWGameManager.java Initialization and client synchronization for elevators
MovementDisplay.java UI button enablement logic for elevator controls
Client.java Packet handling for elevator state updates
Terrains.java, MoveStepType.java, PacketCommand.java New constants for elevator terrain, move types, and packets
IndustrialElevatorTest.java, IndustrialElevatorMovementTest.java Comprehensive unit tests for elevator functionality
report-messages.properties, messages.properties Localized strings for elevator reports and UI

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

HammerGS and others added 9 commits December 27, 2025 15:35
  Changes Made

  Code Changes

  | File                   | Change                                                                    |
  |------------------------|---------------------------------------------------------------------------|
  | Terrains.java          | ELEVATOR → SOLARIS_ELEVATOR, terrain name "elevator" → "solaris_elevator" |
  | ElevatorProcessor.java | Updated all Terrains.ELEVATOR → Terrains.SOLARIS_ELEVATOR                 |
  | BoardsTagger.java      | Updated static import reference                                           |

  Tileset Changes

  | File                            | Change                                                           |
  |---------------------------------|------------------------------------------------------------------|
  | StandardElevator.tileinc        | Renamed to StandardSolarisElevator.tileinc, updated terrain refs |
  | StandardFluff.tileinc (2 files) | "elevator:" → "solaris_elevator:"                                |
  | saxarba.tileset                 | Updated terrain refs                                             |
  | hq_saxarba.tileset              | Updated terrain refs                                             |
  | defaulthexset.txt               | Updated terrain refs                                             |
  | 7 other tilesets                | Updated include path to StandardSolarisElevator.tileinc          |

  Board Files Updated (11 files)

  - Steiner Stadium, Coliseum, various Solaris arenas
  - All "elevator:" → "solaris_elevator:"

  Clear Distinction Now

  | Terrain             | Type ID | Processor                   | Behavior                    |
  |---------------------|---------|-----------------------------|-----------------------------|
  | solaris_elevator    | 36      | ElevatorProcessor           | Random d6-based (Solaris 7) |
  | industrial_elevator | 60      | IndustrialElevatorProcessor | Player-controlled           |
  Logging:
  - Change all [ELEVATOR] logs from INFO to DEBUG level in:
    - IndustrialElevatorProcessor.java
    - TWGameManager.java
    - MovePathHandler.java
    - Client.java
    - MovementDisplay.java
    - MoveStep.java
    - ElevatorAscendStep.java
    - ElevatorDescendStep.java

  Thread safety:
  - Use ConcurrentHashMap for industrialElevators in Game.java
  - Use CopyOnWriteArrayList for callQueue in IndustrialElevator.java

  Validation:
  - Add shaftBottom <= shaftTop check in IndustrialElevator constructor

  ---
  Summary of changes:
  - 7 files - Changed LOGGER.info("[ELEVATOR]... to LOGGER.debug("[ELEVATOR]...
  - Game.java - HashMap → ConcurrentHashMap for thread safety
  - IndustrialElevator.java - ArrayList → CopyOnWriteArrayList for thread safety, added constructor validation
ElevatorCall implements Comparable but was missing equals() and hashCode(),
which could cause inconsistency between natural ordering and equality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create IndustrialElevatorDialog with user-friendly spinners for shaft top
  and capacity configuration (instead of manually encoding exits value)
- Integrate dialog into BoardEditorPanel for INDUSTRIAL_ELEVATOR terrain
- Add i18n strings for dialog labels

The dialog automatically encodes/decodes the exits field:
  exits = (shaftTop << 8) | (capacityTons / 10)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
  Create IndustrialElevatorDialog with user-friendly spinners for configuring
  shaft top level and cargo capacity, replacing manual exits value encoding.

  Changes:
  - Add IndustrialElevatorDialog.java with spinners for shaft top (-100 to 100)
    and capacity (0-2550 tons in 10-ton increments)
  - Integrate dialog into BoardEditorPanel for INDUSTRIAL_ELEVATOR terrain
  - Add EditorTextField.setMinValue() to allow negative terrain levels for
    basement elevator shafts
  - Auto-enable elevator properties when terrain type selected
  - Set sensible defaults (shaft top 0, capacity 100 tons)
  - Add i18n strings for dialog labels and Solaris elevator display name

  The dialog automatically encodes/decodes the exits field:
    exits = (shaftTop << 8) | (capacityTons / 10)

  Files changed:
  - NEW: megamek/src/megamek/client/ui/dialogs/IndustrialElevatorDialog.java
  - megamek/src/megamek/client/ui/boardeditor/BoardEditorPanel.java
  - megamek/src/megamek/client/ui/boardeditor/EditorTextField.java
  - megamek/resources/megamek/client/messages.properties
  - megamek/resources/megamek/common/messages.properties

  ---
  Summary of changes by file:

  | File                          | Changes                                                                                                                   |
  |-------------------------------|---------------------------------------------------------------------------------------------------------------------------|
  | IndustrialElevatorDialog.java | New dialog with shaft top and capacity spinners                                                                           |
  | BoardEditorPanel.java         | Integrated dialog, added CMD_EDIT_INDUSTRIAL_ELEVATOR, auto-enable elevator checkbox, dynamic min value for terrain level |
  | EditorTextField.java          | Added setMinValue()/getMinValue() methods                                                                                 |
  | client/messages.properties    | Added dialog title, labels, and help text                                                                                 |
  | common/messages.properties    | Added Terrains.editorName.solaris_elevator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Fix AI-generated fix. Requires human testing and review before merging. Draft Work in Progress For New Dev Cycle This PR should be merged at the beginning of a dev cycle In Development (Draft) An additional way to mark something as a draft. Make it stand out more. Needs Player Testing PR lacks actual play testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant