mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user