Scripting API

Scripting API

GamePackages

Class in Abyss.Core, from Abyss.Core.

A game's packages, removed: what uses one, and taking it out of the game.

public static class GamePackages

Methods

UsersOf

public static PackageUsers UsersOf(string home, string id)

What in the game home uses its package id: each file outside it that names one of its files, by path or by identity, or one of its components, by its full name; each other package that needs it; each script that names its namespace; and each crate whose manifest names its crate.

Parameters

  • home
  • id

Exceptions

  • InvalidOperationException: The game has no package id.

What is read is the game's assets, shaders and settings, its C#, and every other package's, as text: a scene names a package's model by acme.demo://models/rock.gltf and its identity, and its component by Acme.Demo.Spin. A script names the namespace in a using or in full, and a comment that names it is counted too, as nothing short of building the game can tell them apart.

Remove

public static void Remove(string home, string id, Action<string> putInTrash)

Takes the package id out of the game home: its folder into the platform's trash, by putInTrash, and its project's build files out of the game's obj. All of it goes, or none of it.

Parameters

  • home
  • id
  • putInTrash

Exceptions

  • InvalidOperationException: The game has no package id.
  • PackageHeldException: A file or folder of it would not be let go of; it is as it was.
  • IOException: The trash would not take it; it is as it was.

The trash moves a folder whole, and a folder another program holds anything inside open cannot be moved: a code editor with the game's solution open watches each package's scripts, so it holds that folder for as long as it is open.

Then it is copied, and the copy goes to the trash. The folder is deleted where it is, which a program watching it does not stop, and the copy put in the trash. A file that will not be deleted — open in a program that shares it with nobody — stops it: what was deleted is put back, and the package is as it was.

Its project's build files go as they can. Nothing reads them once the package is gone, and a program that still has one open keeps them until it lets go.

In

public static IReadOnlyList<InstalledPackage> In(string home, Action<string>? refused = null)

Every package in the game home, by id; a folder that is not one — no manifest, one that cannot be read, or one whose id is not the folder's name — is told to refused, saying why, and left out.

Parameters

  • home: The game's folder, the one its assets are in.
  • refused: Told of each folder left out.

PutInto

public static IReadOnlyList<InstalledPackage> PutInto(World world, string home, Action<string>? refused = null)

Puts every package in the game home into world, so a path in one is read from its folder, telling refused of each folder left out; what was put in.

Parameters

  • world
  • home
  • refused

Constants

FolderName

public const string FolderName = "packages"

The folder a game keeps its packages in, beside its assets.