Enhance standalone mode with VM IP handling and UI updates

- Updated `GamesController` to parse and store VM IPs from JSON input, improving player state management.
- Modified `Game` model to include VM IPs in the context for better integration with gameplay.
- Enhanced `Mission` model's `vm_object` method to override IPs from the context when available.
- Revamped `new.html.erb` to provide a clearer interface for entering VM IP addresses and flag hints.
- Improved `vm-launcher-minigame.js` to display VM IPs and provide connection instructions in standalone mode.
This commit is contained in:
Z. Cliffe Schreuders
2025-11-30 00:02:08 +00:00
parent bca619aeac
commit a8c4f6576f
5 changed files with 86 additions and 15 deletions

View File

@@ -42,6 +42,16 @@ module BreakEscape
end
end
# Standalone mode with VM IPs JSON
if params[:vm_ips_json].present?
begin
vm_ips = JSON.parse(params[:vm_ips_json])
initial_player_state['vm_ips'] = vm_ips if vm_ips.is_a?(Hash)
rescue JSON::ParserError => e
Rails.logger.warn "[BreakEscape] Invalid vm_ips_json: #{e.message}"
end
end
# Standalone mode with XML flag hints
if params[:flag_hints_xml].present?
flags_by_vm = Mission.parse_flag_hints_xml(params[:flag_hints_xml])