Skip to content

Repository files navigation

GridBackups

Magnetar server plugin for Space Engineers dedicated servers.

GridBackups exports ship/station grid blueprints on configurable backup triggers. Standalone servers keep backups in the Quasar data folder by default.

In a cluster, the plugin automatically uses PluginStorage.GetSharedDirectory regardless of UseQuasarConfigFolder. Each node backs up the grids it sees into the same plugin directory. Writes use temporary files and atomic rename; per-grid file locks coordinate daily backups and retention across nodes. Normal backup filenames include a unique suffix to avoid collisions across Hosts. An automatic backup is counted only after its file is written successfully; failed writes can be retried on the next scan. The shared filesystem must support advisory file locks and atomic rename. Quasar sets CLUSTER_SHARED_ROOT automatically for a single Host. A cluster on several Hosts needs one shared filesystem mounted at the same path on each; Quasar does not provision that mount. Without the shared root, the plugin fails to load instead of writing separate per-Host backups.

Configuration

The server plugin uses Magnetar PluginSdk configuration. Quasar can render the config UI from the schema generated by GridBackupsConfig.

Important options:

  • Standalone storage root defaults to the Quasar data folder (QUASAR_DATA_DIR, derived from QUASAR_DS_CONFIG_PATH, or the platform default Quasar config directory). Cluster storage uses the SDK shared root.
  • Minimum and maximum minutes since last backup.
  • Backup before concealment via public plugin entrypoint.
  • Backup when steady after a configured unchanged block-count duration.
  • Backup after a configured maximum block-count change.
  • Connected-grid grouping, owner folder naming, NPC/nobody grid inclusion, and retention limits.

Commands

  • !gridbackup list <PlayerName|SteamID|IdentityID> lists backed up grids for a player.
  • !gridbackup list <PlayerName|SteamID|IdentityID> <GridName|GridID|ListNumber> lists backup files for one grid.
  • !gridbackup list faction <FactionTag> lists backed up grids for a faction.
  • !gridbackup find <GridName|GridID> searches matching backed up grids across known owners.
  • !gridbackup restore <PlayerName|SteamID|IdentityID> <GridName|GridID|ListNumber> [backupNumber] [keepOriginalPosition] [force] restores a backup.
  • !gridbackup restore faction <FactionTag> <GridName|GridID|ListNumber> [backupNumber] [keepOriginalPosition] [force] restores from a faction member backup.
  • !gridbackup run starts a full backup scan.
  • !gridbackup status shows current backup service state.

Restore defaults to the latest backup, spawning near the caller. Console restores must use keepOriginalPosition=true. Use force=true to skip the occupation check.

External API

Other plugins can call:

bool BackupBeforeConcealment(List<MyObjectBuilder_CubeGrid> grids, long ownerIdentity);
bool BackupGridsManuallyWithBuilders(List<MyObjectBuilder_CubeGrid> grids, long ownerIdentity);

Build

Requirements:

  • Space Engineers Dedicated Server
  • Magnetar
  • .NET 10 SDK
  • .NET Framework 4.8.1 Developer Pack on Windows

Build:

dotnet build GridBackups.sln --configuration Debug

Functionality is inspired by and reimplements the original Torch plugin GridBackup by LordTylus (license: Apache-2.0): https://github.com/LordTylus/SE-Torch-Plugin-ALE-GridBackup

About

A grid backup system for Magnetar

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages