Import

3 min readUpdated Today

Overview

Outpost imports bases from HRS Base Building 2.7.3. The defaults are already set for it. On a standard install, run a preview, then commit. The Import tab of the admin panel reads the HRS tables, checks the conversion and writes it as one batch, with owners, crews, storages, fuel and locks. The HRS tables are not changed or removed.

shared/config.lua
1Config.Import = {
2    sourceResource = 'hrs_base_building',
3    sourceVersion = '2.7.3',
4    sourceTable = 'props',
5    sourceCrewTable = 'crews',
6    sourceInstance = 'default',
7    sourceInventory = 'ox',
8    usingOldInventoryMethod = false,
9    healthMode = 'ratio',
10    maxRows = 10000,
11}
  • sourceResource: the running resource name, including any rename
  • sourceInstance: keep it stable for that installation
  • sourceInventory: the inventory on the source server
  • usingOldInventoryMethod: whether the source used the old stash naming
  • healthMode: ratio keeps the damage percentage, exact requires the original value
  • stockRemap: maps source upkeep items to yours. Use it only for deliberate conversions

The other source* keys are in Config.Import in shared/config.lua.

Supported Inventories

Storages can only move when source and destination use the same inventory. Changing inventory during an import is not supported.

  • ox_inventory, or ML Inventory with the same storage schema and item definitions
  • qb-inventory 2.2.3 with the inventories table on InnoDB

Legacy stashitems tables, LJ, QS, Core, Origen and Codem are not supported, and changing Config.Import does not add them.

Before Importing

  1. Back up the source tables, source inventory data and ml_bb_ tables together
  2. Register the items in the destination inventory
  3. Set Config.Import for the source server
  4. Compare the HRS model, access, decay, upkeep and electricity settings with sourceModels, sourceAccess, sourceDecay, sourceClaimPolicy and sourceElectricity
  5. Enable Config.UseRoutingBuckets if the source uses buckets

Preview and Commit

  1. Open /bb_admin, go to Import and generate a preview
  2. Fix every blocking issue: missing models, unknown storage contents, wrong inventory, owner conflicts or source settings the config does not describe block the whole batch
  3. Stop the source resource and keep it stopped
  4. Commit. The plan is checked again before writing, and a changed source makes the preview invalid
  5. Restart ml_base_building when asked, then check owners, crews, doors, storages, power and upkeep

If the preview reports a database limit, raise group_concat_max_len or max_allowed_packet and generate a new preview. Import does not change database settings.

Uncertain Commit

If a commit outcome is unclear, building stays locked. Keep the batch id returned by the commit, and do not clear ml_bb_mutation_journal or repeat the import by hand.

Undo

Undo works after a commit and before the restart that loads the bases, as long as nothing has changed. It is not a general restore for bases already in use.

Beds, Fires and Stations

These exist only in imported bases and cannot be built from the menu.

  • Beds and sofas keep their rest duration, animation and heading through sourceRest
  • Campfires and stoves keep fuel, switch state, capacity and burn rate. Lighting, fuel and effects are built in. A campfire has no recipes
  • Workbenches, chemistry and repair benches, recyclers and stoves keep a station id. They need MLBB.StationBindings to do anything, see Developer

Recipes, crafting queues and inventories held by another resource are not imported.

Tables

  • ml_bb_import_batches, ml_bb_import_records, ml_bb_import_guard: batches, per-record results and the check that stops a write when the data has changed