docs: construct CLI & API documentation
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# Data Models
|
||||
|
||||
The following data models are used to represent the format of the data passed by the API endpoints. More information about the API endpoints can be found in the [Endpoints](./Endpoints.md) page.
|
||||
|
||||
You'll need to include Construct's Data Model definitions in your project to work with the API effectively. These data models define the structure of the data passed to and from the API endpoints. They can be found at [`packs/BP/scripts/API/ConstructAPIModel.js`](https://github.com/ForestOfLight/Construct/blob/main/packs/BP/scripts/API/ConstructAPIModel.js). Copy the file into your project and import the models as needed.
|
||||
|
||||
## Instance
|
||||
|
||||
An `Instance` represents a single structure instance in the world, along with its properties and state.
|
||||
|
||||
```typescript
|
||||
interface Instance {
|
||||
name: PROTO.String,
|
||||
structureId: PROTO.String,
|
||||
isEnabled: PROTO.Boolean,
|
||||
dimensionId: PROTO.Optional(PROTO.String),
|
||||
location: PROTO.Optional({
|
||||
x: PROTO.Float64,
|
||||
y: PROTO.Float64,
|
||||
z: PROTO.Float64
|
||||
}),
|
||||
bounds: PROTO.Optional(PROTO.Object({
|
||||
min: {
|
||||
x: PROTO.Float64,
|
||||
y: PROTO.Float64,
|
||||
z: PROTO.Float64
|
||||
},
|
||||
max: {
|
||||
x: PROTO.Float64,
|
||||
y: PROTO.Float64,
|
||||
z: PROTO.Float64
|
||||
}
|
||||
})),
|
||||
currentLayer: PROTO.Int16,
|
||||
maxLayer: PROTO.Int16,
|
||||
verifier: PROTO.Object({
|
||||
isEnabled: PROTO.Boolean,
|
||||
trackPlayerDistance: PROTO.Int8,
|
||||
particleLifetime: PROTO.Int32
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## Builder
|
||||
|
||||
A `Builder` represents a single builder (Construct's name for Players) in the world, along with its settings and properties.
|
||||
|
||||
```typescript
|
||||
interface Builder {
|
||||
playerId: PROTO.String,
|
||||
easyPlace: PROTO.Boolean,
|
||||
fastEasyPlace: PROTO.Boolean,
|
||||
materialGrabber: PROTO.Boolean,
|
||||
materialInstanceName: PROTO.String
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,75 @@
|
||||
# Endpoints
|
||||
|
||||
This page documents all the available API endpoints that can be accessed by other addons or scripts. The API is designed so that entire objects are passed at once, rather than making multiple calls to edit or query individual properties. This allows for fewer API calls and easier access to data.
|
||||
|
||||
## Instances
|
||||
|
||||
### `construct:instances`
|
||||
|
||||
Get a list of all registered instance names.
|
||||
|
||||
- **Parameters**: `void`
|
||||
- **Returns**: `string[]`
|
||||
|
||||
---
|
||||
|
||||
### `construct:instance:get`
|
||||
|
||||
Get the full data object for a specific instance.
|
||||
|
||||
- **Parameters**: `instanceName: string`
|
||||
- **Returns**: `Instance` (see [Data Model](./DataModels.md#instance))
|
||||
|
||||
---
|
||||
|
||||
### `construct:instance:add`
|
||||
|
||||
Create a new instance with a given name and structure ID.
|
||||
|
||||
- **Parameters**: `instanceName: string`, `structureId: string`
|
||||
- **Returns**: `Instance` (see [Data Model](./DataModels.md#instance))
|
||||
|
||||
---
|
||||
|
||||
### `construct:instance:edit`
|
||||
|
||||
Edit properties of an existing instance (e.g. enabled state, position).
|
||||
|
||||
- **Parameters**: `instanceName: string`, `properties: Instance`
|
||||
- **Returns**: `Instance` (see [Data Model](./DataModels.md#instance))
|
||||
|
||||
---
|
||||
|
||||
### `construct:instance:delete`
|
||||
|
||||
Permanently delete an instance.
|
||||
|
||||
- **Parameters**: `instanceName: string`
|
||||
- **Returns**: `void`
|
||||
|
||||
---
|
||||
|
||||
### `construct:instance:materials`
|
||||
|
||||
Get a list of materials required to build the active section of an instance. Respects the active layer.
|
||||
|
||||
- **Parameters**: `instanceName: string`
|
||||
- **Returns**: `Map<string, number>` (material name to quantity)
|
||||
|
||||
## Builders
|
||||
|
||||
### `construct:builder:get`
|
||||
|
||||
Get the full data object for a specific builder (player).
|
||||
|
||||
- **Parameters**: `playerId: string`
|
||||
- **Returns**: `Builder` (see [Data Model](./DataModels.md#builder))
|
||||
|
||||
---
|
||||
|
||||
### `construct:builder:edit`
|
||||
|
||||
Edit properties of an existing builder.
|
||||
|
||||
- **Parameters**: `playerId: string`, `properties: Builder`
|
||||
- **Returns**: `Builder` (see [Data Model](./DataModels.md#builder))
|
||||
Reference in New Issue
Block a user