Methods
callCreate(functionName, argsopt) → {*}
- Description:
Dynamically imports the module for a create* function and invokes it with args. Runs identically on the main thread or inside a worker.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
functionName |
String | e.g. "createLocation" |
|
args |
Object |
<optional> |
the single named-parameters object the function expects |
Returns:
whatever the create* function returns
- Type
- *
callExpand(location) → {Object}
- Description:
Expands a shimmed location (see createLocation's
shimoption) in place. Must run in the same worker that originally created the location in order to find a LocationTemplate by the location’s GUID (this may change).
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
location |
Object | a Location, possibly with descendants, produced by createLocation |
Returns:
the same location, fully expanded
- Type
- Object
(static) createAppearance(character) → {String}
- Description:
Describe a character's appearance and behavior. This description will be different each time the character is passed to this function.
- Source:
Example
createAppearance({ character })
=> "Long brown hair, short stature"
Parameters:
| Name | Type | Description |
|---|---|---|
character |
Character | The character to describe. |
Returns:
A description of the appearance and behavior of the character
- Type
- String
createBag(paramsopt) → {Bag}
- Description:
Creates a collection of objects, held in a collection type known as a Bag.
- Source:
Example
createBag({ count: 3, tags: "house"}).toString()
=> "A television (5/20), a winter jacket (worn; 0.5/10), and a ceramic bowl (3/1)."
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
<optional> |
Properties
|
Returns:
a bag containing items that meet the specified criteria
- Type
- Bag
createBookTitle(optionsopt) → {string}
- Description:
Generates a random fictional book title, optionally filtered by genre.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Book title creation options Properties
|
Returns:
A generated book title
- Type
- string
createCharacter(options) → {Character}
- Description:
Creates a new character with customizable attributes and generated characteristics.
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Character creation options Properties
|
Returns:
A new Character instance with generated or specified attributes
- Type
- Character
createCharacterName(params) → {CharacterName}
- Description:
Generate a random name for a mid-century American, of the kind that would be wandering around an atomic era apocalypse. Does not add a nickname.
- Source:
Example
createCharacterName({gender: 'female', heritage: 'latino'})
=> {"given": "Elena", "family": "Silva", "gender": "female", "heritage": "latino"}
let girl = createCharacterName({gender: 'female'})
girl.toString()
=> "Ada King"
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
Returns:
- Type
- CharacterName
createContainer(optionsopt) → {Bag}
- Description:
Creates a container (e.g., a first aid kit, cabinet, or ammunition box) of a given type, potentially pre-filled with items. Containers may be empty or show signs of prior use.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Container creation options Properties
|
Returns:
A new Bag instance (extends Bag) with a name, optional description, and items
- Type
- Bag
createEventLayer(options) → {void}
- Description:
Enriches a location map with event-driven narrative content. Currently populates farm locations with family occupants, adding a family tree and roster to each farm's description.
- Source:
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
Object | Event layer options Properties
|
Returns:
- Type
- void
createFamily(optionsopt) → {Family}
- Description:
Creates a multi-generational family with characters, relationships, and a shared family name. The family tree simulates births, deaths, and partnerships over time. A generation is counted when a child is born into the tree.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Family creation options Properties
|
Returns:
A Family instance rooted at the founding mother, containing the full family tree
- Type
- Family
createGang(optionsopt) → {Gang}
- Description:
Creates a gang of characters with a shared type, name, and profession-appropriate traits. Each member is a generated Character. Members may be assigned nicknames depending on gang type.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Gang creation options Properties
|
Returns:
A new Gang instance containing the generated member characters
- Type
- Gang
createHistoricalLayer(options) → {void}
- Description:
Enriches a location map with pre-collapse historical narrative content. Selects locations and modifies them according to history rules: adding descriptions, renaming locations, placing items or containers, and optionally clearing their existing contents.
- Source:
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
Object | Historical layer options Properties
|
Returns:
- Type
- void
createHorse(optionsopt) → {string}
- Description:
Generates a descriptive string for a horse, including its type, optional behavior, coat pattern, and name.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Horse description options Properties
|
Returns:
A descriptive phrase for the horse (e.g. "a nervous spotted mare named Clover")
- Type
- string
createItem(optionsopt) → {Item}
- Description:
Creates a random item from the item database, optionally filtered by name, tags, value range, or encumbrance range. Automatically generates titles for books, magazines, and horses.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Item creation options Properties
|
Returns:
An Item instance matching the given criteria, or null if no match is found
- Type
- Item
createKit(params) → {Object}
- Description:
Generate the possessions that would be on the person of an active NPC (e.g. out on patrol, out for a night on the town, out on a raid or in the middle of criminal activity).
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
Returns:
An object of two bags, one under the property "clothing" and another under the bag of "possessions".
- Type
- Object
createLocation()
- Description:
Create a location. You must supply the type of a location template and an instance tree will be created from that point in the template hierarchy, working downward throw all child nodes templates, returning the resulting instance tree. Tags are not currently used in selection of templates, but may be in the future.
- Source:
createLocationName(optionsopt) → {string}
- Description:
Generates a name for a location node based on its type and its position in the location hierarchy. Supports sequence-based naming (e.g. "Room 1", "Room 2") and type-specific name generation (e.g. street names, building names, geographic features).
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Location name options Properties
|
Returns:
A generated name for the location node
- Type
- string
createMagazineTitle() → {String}
- Description:
Magazines will be produced as generic items in bags, loot, etc. This method returns a magazine with an auto-generated title, usually pretty silly. The titles are random so these magazines are not considered collectible.
- Source:
Returns:
magazine with a title
- Type
- String
createMemorabilia(optionsopt) → {Item}
- Description:
Creates a random piece of pre-collapse memorabilia, such as a comic book, trading card, magazine, or movie poster.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Memorabilia creation options Properties
|
Returns:
An Item instance representing a piece of memorabilia
- Type
- Item
createProfession(optionsopt) → {Profession}
- Description:
Looks up a profession from the profession database by name or tags.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Profession lookup options Properties
|
Returns:
A Profession instance matching the given criteria, or null if not found
- Type
- Profession
createRelationship(optionsopt) → {Relationship}
- Description:
Creates a pair of related characters (e.g. mother and son, aunt and nephew) with appropriate age differences, shared or independent heritage, and related professions.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Relationship creation options Properties
|
Returns:
A Relationship instance containing both characters and their relationship label
- Type
- Relationship
createTimeSeries(options) → {Array.<string>}
- Description:
Generates a series of publication dates for a periodical, within a historical date range. Useful for assigning realistic issue dates to magazines and newspapers.
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Time series options Properties
|
Returns:
An array of formatted date strings within the given range
- Type
- Array.<string>
createWeather(optionsopt) → {Weather}
- Description:
Creates a weather report for a given date and location, including temperature, wind, precipitation, sun/moon times, and game-relevant effects (cold/heat warnings, travel impacts).
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{}
|
Weather creation options Properties
|
Returns:
A Weather instance with temperature, wind, precipitation, sky conditions, sun times, moon phase, and gameplay effect warnings.
- Type
- Weather
createWorkerClient() → {Promise.<{call: function(), expand: function(), terminate: function()}>}
- Description:
Returns the shared client that runs create* functions (and other worker-side operations) in a separate thread — a Web Worker in the browser, or a worker_threads Worker in Node — via Comlink. Environment is detected automatically so the same call site works in both.
The underlying worker is created once and reused by every caller: worker-side module state (e.g. the location template registry used to expand shimmed locations) must stay consistent across calls, so different parts of the app can't each get their own worker.
- Source:
Example
const client = await createWorkerClient();
const location = await client.call("createLocation", { type: "Farm", history: true });
await client.terminate();
Returns:
- Type
- Promise.<{call: function(), expand: function(), terminate: function()}>
newLocation(template, parent) → {Location}
- Description:
Create a location based on a location template. The location constructor follows model conventions and takes a params object, so the copy operation must happen outside of it, and this is the method to do that.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
template |
LocationTemplate | to use |
parent |
Location | location of this current location |
Returns:
the new location.
- Type
- Location
toLastNameString() → {String}
- Source:
Returns:
the family name, with the born (maiden) name if present
- Type
- String
toString() → {String}
- Source:
Returns:
the full name, preferring nickname if present
- Type
- String