Enhance game setup for VM and standalone modes

- Updated `GamesController` to use `current_player` for VM set retrieval.
- Improved `MissionsController` to handle redirection for both Hacktivity and standalone modes.
- Modified `new.html.erb` to include UI for standalone flag input alongside VM set selection.
- Added new CSS styles for standalone mode instructions and flags input form.
- Introduced new mission configuration for the SecGen VM Lab, integrating VM and flag capture elements.
This commit is contained in:
Z. Cliffe Schreuders
2025-11-28 17:41:17 +00:00
parent 0d250d71f0
commit ca44cef068
10 changed files with 2827 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ module BreakEscape
authorize @mission, :create_game? if defined?(Pundit)
if @mission.requires_vms?
@available_vm_sets = @mission.valid_vm_sets_for_user(current_user)
@available_vm_sets = @mission.valid_vm_sets_for_user(current_player)
@existing_games = Game.where(player: current_player, mission: @mission)
end
end

View File

@@ -20,10 +20,11 @@ module BreakEscape
@mission = Mission.find(params[:id])
authorize @mission if defined?(Pundit)
if @mission.requires_vms? && BreakEscape::Mission.hacktivity_mode?
# VM missions need explicit game creation with VM set selection
# Redirect to games#new which shows VM set selection UI
# Use explicit path instead of route helper to ensure it works in engine context
if @mission.requires_vms?
# VM missions (Hacktivity or standalone) need explicit setup
# Redirect to games#new which shows appropriate UI:
# - Hacktivity mode: VM set selection
# - Standalone mode: Flag input form
redirect_to "/break_escape/games/new?mission_id=#{@mission.id}"
else
# Legacy behavior for non-VM missions - auto-create game