mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
46 lines
2.1 KiB
Ruby
46 lines
2.1 KiB
Ruby
BreakEscape::Engine.routes.draw do
|
|
# Static files - caught by routes and served by lightweight controller
|
|
# This ensures files are served from the engine's public directory
|
|
# Constraint { path: /.*/ } ensures we capture the full path including filename with extension
|
|
get '/css/*path', to: 'static_files#serve', constraints: { path: /.*/ }
|
|
get '/js/*path', to: 'static_files#serve', constraints: { path: /.*/ }
|
|
get '/assets/*path', to: 'static_files#serve', constraints: { path: /.*/ }
|
|
get '/stylesheets/*path', to: 'static_files#serve', constraints: { path: /.*/ }
|
|
get '/:filename.html', to: 'static_files#serve', constraints: { filename: /test-.*|index/ }
|
|
|
|
# Mission selection
|
|
resources :missions, only: [:index, :show]
|
|
|
|
# Player configuration
|
|
get 'configuration', to: 'player_preferences#show', as: :configuration
|
|
patch 'configuration', to: 'player_preferences#update'
|
|
|
|
# Game management
|
|
resources :games, only: [:new, :show, :create] do
|
|
member do
|
|
# Scenario and NPC data
|
|
get 'scenario' # Returns full scenario_data JSON (for compatibility)
|
|
get 'scenario_map' # Returns minimal layout metadata for navigation
|
|
get 'ink' # Returns NPC script (JIT compiled)
|
|
get 'room/:room_id', to: 'games#room', as: 'room' # Returns room data for lazy-loading
|
|
get 'container/:container_id', to: 'games#container' # Returns locked container contents
|
|
|
|
# Game state and actions
|
|
put 'sync_state' # Periodic state sync
|
|
post 'update_room' # Update dynamic room state (items, NPCs, object states)
|
|
post 'unlock' # Validate unlock attempt
|
|
post 'inventory' # Update inventory
|
|
|
|
# Objectives system
|
|
get 'objectives' # Get current objective state
|
|
post 'objectives/tasks/:task_id', to: 'games#complete_task', as: 'complete_task'
|
|
put 'objectives/tasks/:task_id', to: 'games#update_task_progress', as: 'update_task_progress'
|
|
|
|
# VM/Flag integration
|
|
post 'flags', to: 'games#submit_flag' # Submit CTF flag for validation
|
|
end
|
|
end
|
|
|
|
root to: 'missions#index'
|
|
end
|