Always try to nest symbol in the center. Fixes #38.

pull/43/head
Atul Varma 2021-02-28 19:49:41 -05:00
rodzic b1b0176e4a
commit 82f8972662
1 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -66,10 +66,11 @@ function getSymbol(name: string): SvgSymbolData {
*/
function getNestingChildren(
parent: SvgSymbolData,
rng: Random
rng: Random,
preferNesting?: boolean
): NestedCreatureSymbol[] {
const { meta, specs } = parent;
if (meta?.always_nest && specs?.nesting) {
if ((meta?.always_nest || preferNesting) && specs?.nesting) {
const indices = range(specs.nesting.length);
const child = rng.choice(NESTED_SYMBOLS);
return [
@ -97,7 +98,7 @@ function getSymbolWithAttachments(
const result: CreatureSymbol = {
data: root,
attachments: [],
nests: getNestingChildren(root, rng),
nests: getNestingChildren(root, rng, true),
};
if (root.specs) {
const attachmentKinds = rng.uniqueChoices(