Skip to content

Restore Enhanced - Named presets with building type support #263

@majormer

Description

@majormer

Feature Description

Restore Enhanced is an evolution of the original Smart! Restore feature that allows users to save and recall grid configuration presets with full CRUD operations (Create, Read, Update, Delete).

Original Restore Feature (Smart! Update 8)

The original implementation allowed users to save up to 10 numbered presets (0-9) containing:

  • Grid counters (X, Y, Z)
  • Spacing (X, Y, Z)
  • Twirl/Rotation
  • Levitation
  • Steps (Up counter)

Users could press a hotkey (R + number key) to instantly apply a saved preset to the current hologram.

Restore Enhanced Improvements

New capabilities:

  1. Named Presets - Give presets descriptive names instead of just numbers (e.g., '5x5 Storage Grid', 'Manifold Row')
  2. Building Type Storage - Save the building class along with the configuration
    • Example: Save 'Constructor 3x3' preset that remembers it's for constructors
    • When recalled, could auto-switch to that building type (if available in inventory)
  3. Smart Panel Integration - Manage presets through the Smart Panel UI instead of just hotkeys
  4. Full CRUD Operations - Complete preset management:
    • Create - Save new presets with custom names
    • Read - View all saved presets with details
    • Update - Edit existing preset names and settings
    • Delete - Remove unwanted presets
  5. Extended Settings - Save additional configuration beyond the original 9 parameters
    • Auto-connect settings (belt/pipe/power enabled states)
    • Recipe selection (if applicable)
    • Rotation mode
    • Any other per-hologram settings

UI/UX Design - Full CRUD Interface

Smart Panel Tab: 'Presets'

Preset List View:

  • Scrollable list showing all saved presets
  • Each preset row displays:
    • Preset name (editable inline)
    • Building type icon
    • Grid size preview (e.g., '3×3×1')
    • Spacing preview (e.g., 'Spacing: 10m')
    • Action buttons: Apply | Edit | Delete

CRUD Operations:

  1. CREATE - Save New Preset

    • Button: 'Save Current Configuration'
    • Opens dialog:
      • Text input: Preset name (required)
      • Checkbox: 'Save building type' (default: checked)
      • Checkbox: 'Save auto-connect settings' (default: checked)
      • Checkbox: 'Save recipe' (if applicable)
      • Preview of settings to be saved
      • Buttons: Save | Cancel
  2. READ - View Presets

    • List view with all presets
    • Click preset row to expand details:
      • Full configuration display
      • Building type
      • All saved parameters
      • Creation date
      • Last modified date
    • Search/filter bar to find presets by name or building type
  3. UPDATE - Edit Preset

    • Click 'Edit' button on preset row
    • Opens edit dialog:
      • Editable name
      • Option to update settings from current hologram
      • Option to manually adjust individual parameters
      • Preview changes before saving
      • Buttons: Save Changes | Cancel
    • Inline name editing: Double-click preset name to rename
  4. DELETE - Remove Preset

    • Click 'Delete' button on preset row
    • Confirmation dialog: 'Delete preset [name]? This cannot be undone.'
    • Buttons: Delete | Cancel
    • Optional: Bulk delete with multi-select

Additional Features:

  • Duplicate Preset - Clone existing preset with new name
  • Export/Import - Share presets with other players (JSON format)
  • Preset Categories - Organize presets into folders (e.g., 'Foundations', 'Factories', 'Logistics')
  • Quick Apply Hotkeys - Assign hotkeys to favorite presets (optional)

Workflow Examples

Creating a Preset:

  1. Configure hologram (e.g., 5×5 storage container grid with 10m spacing)
  2. Open Smart Panel → Presets tab
  3. Click 'Save Current Configuration'
  4. Enter name: 'Storage 5x5 - 10m spacing'
  5. Confirm settings → Click Save
  6. Preset appears in list

Updating a Preset:

  1. Find preset in list
  2. Click 'Edit' button
  3. Change name or click 'Update from Current Hologram'
  4. Preview changes
  5. Click 'Save Changes'

Deleting a Preset:

  1. Find preset in list
  2. Click 'Delete' button
  3. Confirm deletion
  4. Preset removed from list

Applying a Preset:

  1. Browse preset list
  2. Click 'Apply' button on desired preset
  3. Current hologram instantly configured with saved settings
  4. If building type was saved, optionally switch to that building

Technical Implementation Notes

Data Structure:

struct FSFRestoreEnhancedStruct
{
    FGuid PresetID;                        // NEW: Unique identifier for CRUD operations
    FString PresetName;                    // NEW: User-defined name
    FDateTime CreatedAt;                   // NEW: Creation timestamp
    FDateTime ModifiedAt;                  // NEW: Last modified timestamp
    TSubclassOf<AFGBuildable> BuildingClass; // NEW: Building type (optional)
    
    // Original settings
    int ItemCounterX;
    int ItemCounterY;
    int ItemCounterZ;
    int SpacingCounterX;
    int SpacingCounterY;
    int SpacingCounterZ;
    int TwirlCounter;
    int LevitationCounter;
    int UpCounter;
    
    // NEW: Extended settings
    bool bSaveBuildingType;
    bool bSaveAutoConnectSettings;
    bool bSaveRecipe;
    bool bBeltAutoConnectEnabled;
    bool bPipeAutoConnectEnabled;
    bool bPowerAutoConnectEnabled;
    FString SavedRecipeName;
    // ... other settings as needed
};

CRUD Service Class:

class USFPresetManagementService
{
public:
    // CREATE
    FGuid CreatePreset(const FSFRestoreEnhancedStruct& PresetData);
    
    // READ
    TArray<FSFRestoreEnhancedStruct> GetAllPresets();
    FSFRestoreEnhancedStruct GetPresetByID(const FGuid& PresetID);
    TArray<FSFRestoreEnhancedStruct> SearchPresets(const FString& SearchQuery);
    
    // UPDATE
    bool UpdatePreset(const FGuid& PresetID, const FSFRestoreEnhancedStruct& UpdatedData);
    bool RenamePreset(const FGuid& PresetID, const FString& NewName);
    
    // DELETE
    bool DeletePreset(const FGuid& PresetID);
    bool DeleteMultiplePresets(const TArray<FGuid>& PresetIDs);
    
    // UTILITY
    bool DuplicatePreset(const FGuid& SourceID, const FString& NewName);
    FString ExportPreset(const FGuid& PresetID);
    FGuid ImportPreset(const FString& PresetJSON);
};

Storage:

  • Save to mod configuration file (persistent across sessions)
  • Array of presets with unique GUIDs
  • Automatic backup before modifications
  • Validation on load (handle corrupted/missing data gracefully)

Original Implementation Reference:

  • SFSystem+Restore.cpp - Save/restore logic
  • FSFRestoreStruct - Original data structure
  • SFConfig.Restore - Array of 10 presets

Priority

Medium-High - Quality of life feature that significantly improves workflow for users who frequently switch between different building patterns.

Related Issues

  • Original Restore feature was a beloved part of Smart! Update 8
  • Complements existing Smart Panel functionality
  • Could integrate with future 'Quick Build' or 'Template' systems

Success Criteria

CRUD Operations:

  • Create - Users can save new named presets with building types and extended settings
  • Read - Users can view all presets in a list with search/filter capabilities
  • Update - Users can edit preset names and update settings from current hologram
  • Delete - Users can remove presets with confirmation dialog

UI/UX:

  • Presets managed through Smart Panel UI with dedicated tab
  • Inline editing for preset names (double-click to rename)
  • Confirmation dialogs for destructive operations (delete)
  • Preview of settings before saving/updating

Functionality:

  • Applying a preset instantly configures the hologram
  • Presets persist across game sessions
  • No hard limit on number of presets
  • Duplicate preset feature for quick variations
  • Export/Import presets as JSON for sharing

Quality:

  • Backward compatible with existing Smart! configurations
  • Graceful handling of corrupted/missing preset data
  • Automatic backup before modifications
  • Validation on preset load

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions