The Loadout Manager system allows players to save, load, and manage equipment loadouts for themselves and AI units. This sophisticated system provides comprehensive equipment management with EPF persistence for cross-session loadout storage.
The Loadout Manager is production-ready with advanced functionality that exceeds the original design specifications.
- Type: Singleton Manager Component (2,097 lines)
- Location:
Scripts/Game/GameMode/Managers/OVT_LoadoutManagerComponent.c
- Purpose: Central interface for all loadout operations
Key Features:
- Equipment extraction from entities with nested container support
- Loadout application from equipment boxes and direct spawning
- EPF persistence with individual file storage per loadout
- Officer template system for faction-wide loadouts
- Weapon attachment and modification handling
- Quick slot management and assignment
- Network replication for multiplayer operations
- Complex inventory management with exact slot targeting
- Location:
Scripts/Game/Data/OVT_PlayerLoadout.c
- Type: EPF_PersistentScriptedState (individual file storage)
- Purpose: Individual loadout data structure
- Persistence: Automatic EPF file management
- Location:
Scripts/Game/Data/OVT_LoadoutItem.c
- Purpose: Equipment item representation with attachments
- Features: Weapon attachments, slot targeting, custom properties
Each loadout uses EPF's EPF_PersistentScriptedState
for optimized storage:
[
EPF_PersistentScriptedStateSettings(OVT_PlayerLoadout),
EDF_DbName.Automatic()
]
class OVT_PlayerLoadoutSaveData : EPF_ScriptedStateSaveData
{
string m_sLoadoutName;
string m_sPlayerId;
string m_sDescription;
int m_iCreatedTimestamp;
int m_iLastUsedTimestamp;
bool m_bIsTemplate;
ref array<ref OVT_LoadoutItem> m_aItems;
}
Benefits:
- Performance: Load only specific loadouts when needed
- Scalability: Handles unlimited loadouts efficiently
- File Organization: EPF automatically organizes by type
- Granular Control: Individual save/load/delete operations
Advanced Extraction System:
- Entity Scanning: Complete inventory analysis of characters
- Nested Containers: Recursive scanning of bags, backpacks, and containers
- Weapon Attachments: Full attachment preservation including magazines
- Slot Detection: Automatic identification of equipment slots
- Container Mapping: Maintains item-to-container relationships
Supported Equipment:
- Primary and secondary weapons with attachments
- Clothing and armor (helmet, vest, uniform, boots)
- Backpacks and bags with contents
- Medical supplies and consumables
- Quick slot items and assignments
Two Application Methods:
- Container Sourcing: Items taken from specified equipment containers
- Inventory Management: Automatic slot clearing and assignment
- Exact Matching: Precise item and attachment matching
- Fallback System: Alternative items when exact matches unavailable
- Item Creation: Spawn items directly when containers unavailable
- Attachment Assembly: Automatic weapon modification application
- Slot Assignment: Correct placement in character inventory slots
- Container Population: Fill bags and backpacks with contained items
Faction-Wide Loadouts:
- Officer Control: Officers can create templates for all players
- Template Sharing: Faction-wide loadout access and application
- Permission System: Role-based loadout management
- Template Categories: Organized by role or mission type
Sophisticated Slot Handling:
- Exact Slot Targeting: Precise inventory slot assignment
- Container Hierarchy: Nested bag and backpack management
- Conflict Resolution: Automatic handling of slot conflicts
- Quick Slot Management: Special handling for quick-access items
Comprehensive Attachment Support:
- Full Preservation: All weapon modifications saved and restored
- Magazine Handling: Ammunition and magazine state preservation
- Optics and Accessories: Scopes, grips, suppressors, etc.
- Attachment Matching: Intelligent fallback for unavailable attachments
class OVT_LoadoutItem : Managed
{
string m_sResourceName; // Prefab resource path
int m_iSlotType; // Equipment slot identifier
ref array<string> m_aAttachments; // Weapon attachments array
ref map<string, string> m_mProperties; // Custom item properties
string m_sContainerPath; // Parent container reference
int m_iContainerSlot; // Specific slot in container
}
class OVT_PlayerLoadout : EPF_PersistentScriptedState
{
string m_sLoadoutName; // User-defined name
string m_sPlayerId; // Owner's player ID
string m_sDescription; // Optional description
int m_iCreatedTimestamp; // Creation time
int m_iLastUsedTimestamp; // Last applied time
bool m_bIsTemplate; // Officer template flag
ref array<ref OVT_LoadoutItem> m_aItems; // Equipment items
}
void SaveLoadout(string playerId, string loadoutName, IEntity sourceEntity, string description = "")
{
// Extract all equipment from entity
// Create loadout data structure
// Persist via EPF individual file storage
// Update manager tracking
}
void LoadLoadout(string playerId, string loadoutName, IEntity targetEntity, bool fromBox = true)
{
// Query EPF database for loadout
// Async load loadout data
// Apply equipment via specified method
// Update usage timestamp
}
bool ApplyLoadout(ref OVT_PlayerLoadout loadout, IEntity targetEntity, IEntity equipmentBox = null)
{
// Clear existing equipment
// Source items from box or spawn directly
// Apply weapons with attachments
// Assign to correct inventory slots
// Populate containers and bags
}
Multiplayer Support:
- RPC Operations: Server-side loadout operations with client notification
- State Replication: Loadout application synchronized across clients
- Permission Validation: Server-side role checking for templates
- Async Operations: Non-blocking database operations
All persistence operations include console compatibility:
#ifndef PLATFORM_CONSOLE
// EPF persistence operations
loadout.Save();
#endif
Alternative Features:
- Session Storage: In-memory loadouts for console platforms
- Server Storage: Multiplayer loadout storage on dedicated servers
- Simplified System: Reduced feature set for platforms without file access
¶ With AI Commanding System
- Recruit Loadouts: Apply saved loadouts to recruited AI units
- Template Distribution: Officer templates for AI equipment standardization
- Bulk Application: Apply loadouts to multiple recruits simultaneously
- Equipment Synchronization: Coordinate loadouts with AI inventory management
- Container Integration: Seamless equipment box interaction
- Inventory Management: Full compatibility with game inventory systems
- Attachment System: Integration with weapon modification mechanics
- Quick Slots: Coordination with quick-access item assignments
- Officer Permissions: Role-based access to template creation
- Faction Loadouts: Faction-specific equipment configurations
- Template Sharing: Cross-player loadout distribution
- Permission Validation: Server-side role verification
- Creation Dialog: User-friendly loadout creation interface
- Selection Widget: Browse and select from saved loadouts
- Template Management: Officer interface for faction-wide templates
- Loadout Browser: Organized display of available loadouts
- Equipment Box Interface: Direct loadout application from containers
- Preview System: Display loadout contents before application
- Conflict Resolution: UI feedback for equipment conflicts
- Progress Indication: Visual feedback during loadout operations
- Individual Files: Each loadout stored separately for optimal loading
- Change Tracking: EPF automatic optimization of database writes
- Async Operations: Non-blocking database queries and updates
- Memory Management: Efficient loading and unloading of loadout data
- Batch Operations: Optimized multi-item inventory operations
- Slot Validation: Efficient slot conflict detection and resolution
- Container Handling: Optimized nested container management
- Attachment Processing: Streamlined weapon modification application
- Max Loadouts: Configurable per-player loadout limits
- Template Permissions: Officer role requirements for templates
- Auto-Cleanup: Automatic removal of old or unused loadouts
- Storage Optimization: Database cleanup and optimization settings
- Slot Mapping: Configurable equipment slot assignments
- Attachment Handling: Weapon modification preservation settings
- Container Support: Enable/disable specific container types
- Fallback Behavior: Alternative item selection when exact matches unavailable
// Save current equipment as loadout
OVT_LoadoutManagerComponent.GetInstance().SaveLoadout(playerId, "Assault", playerEntity, "Heavy assault configuration");
// Load saved loadout from equipment box
OVT_LoadoutManagerComponent.GetInstance().LoadLoadout(playerId, "Assault", playerEntity, true);
// Officer creates faction template
OVT_LoadoutManagerComponent.GetInstance().SaveTemplate(playerId, "Standard Infantry", playerEntity, "Basic infantry loadout");
// Apply template to recruit
OVT_LoadoutManagerComponent.GetInstance().ApplyTemplate("Standard Infantry", recruitEntity, equipmentBox);
// Apply loadout to multiple recruits
foreach (IEntity recruit : recruits)
{
OVT_LoadoutManagerComponent.GetInstance().LoadLoadout(playerId, "Squad Member", recruit, equipmentBox);
}
Scripts/Game/GameMode/Managers/
└── OVT_LoadoutManagerComponent.c // Manager component (2,097 lines)
Scripts/Game/GameMode/SaveData/
├── OVT_LoadoutManagerSaveData.c // Manager persistence
└── OVT_PlayerLoadoutSaveData.c // Individual loadout persistence
Scripts/Game/Data/
├── OVT_PlayerLoadout.c // Loadout data structure
├── OVT_LoadoutItem.c // Equipment item representation
└── OVT_LoadoutMetadata.c // Additional loadout metadata
Database Storage/
└── .db/Mission/PlayerLoadouts/
├── loadout_[timestamp]_[id].json // Individual loadout files
└── template_[name]_[faction].json // Officer template files
The Loadout Manager represents one of the most sophisticated inventory management systems in Overthrow, providing comprehensive equipment handling with enterprise-level persistence and multiplayer coordination.