Chapter

Chapter

new Chapter(dataopt, sidesopt)

Source:
Example
// Create a chapter with an empty A, B, and C side
const { Chapter, Side } = require('lucid-dream');
const chapter = new Chapter({
  name: 'Chapter 1'
  sides: {
    A: new Side(),
    B: new Side(),
    C: new Side()
  }
});
Parameters:
Name Type Attributes Default Description
data Object <optional>
{}

An object containing the attributes of the chapter to be created

Properties
Name Type Attributes Default Description
name String <optional>
'Lucid Dream Chapter'

The name of the chaper

sides Object <optional>
{ A: new Side() }

An object containing key/value pairs. The key indicates the name of the side (i.e., A, B, or C). The value is an instance of type Side.

Methods

(async) package(mapDir) → {null}

Source:

Encode the chapter. This is usually done as part of Mod#package, but can also be directly to encode the .bin file(s) of the sides for an individual chapter.

Example
// Encode a chapter and its sides to the `outputDir` directory
const { Chapter } = require('lucid-dream');
const chapter = new Chapter({ name: 'My Chapter' });
// make an additions to your chapter and sides
await chapter.encode('outputDir');
Parameters:
Name Type Description
mapDir String

The directory in which to encode the chapter and its sides

Returns:
Type
null