Skip to content

Commit

Permalink
Change wording hairs to hair
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolway committed Feb 22, 2022
1 parent 8123aae commit e9dbe4d
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 38 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
9 changes: 5 additions & 4 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ const configPath = `${basePath}/src/config.ts`;
// Build directories
const buildDirPath = `${basePath}/build/`;
const wokasDirPath = `${buildDirPath}wokas/`;
export const dataDirPath = `${buildDirPath}data/`;
const cropsDirPath = `${buildDirPath}crops/`;
const avatarsDirPath = `${buildDirPath}avatars/`;
export const dataDirPath = `${buildDirPath}data/`;

// Assets directories
const backgroundDirPath = `${basePath}/assets/backgrounds/`;
const layersDirPath = `${basePath}/assets/layers/`;

const loadedBackgrounds: string[] = [];

const loadedLayers: LoadedLayers = {
body: [],
eyes: [],
hairs: [],
hair: [],
clothes: [],
hat: [],
accessory: [],
Expand Down Expand Up @@ -172,7 +173,7 @@ async function generateWoka(edition: number): Promise<Woka> {
const parts: WokaParts = {
body: getRandomPart(loadedLayers.body),
eyes: getRandomPart(loadedLayers.eyes),
hairs: getRandomPart(loadedLayers.hairs),
hair: getRandomPart(loadedLayers.hair),
clothes: getRandomPart(loadedLayers.clothes),
hat: getRandomPart(loadedLayers.hat),
accessory: getRandomPart(loadedLayers.accessory),
Expand Down
68 changes: 34 additions & 34 deletions src/guards/WokaGuards.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
import * as tg from "generic-type-guard";

export const isWokaPart = new tg.IsInterface()
.withProperties({
name: tg.isString,
weight: tg.isNumber,
})
.withOptionalProperties({
file: tg.isString,
})
.get();
.withProperties({
name: tg.isString,
weight: tg.isNumber,
})
.withOptionalProperties({
file: tg.isString,
})
.get();

export type WokaPart = tg.GuardedType<typeof isWokaPart>;

export type Layer = "body" | "eyes" | "hairs" | "clothes" | "hat" | "accessory";
export type Layer = "body" | "eyes" | "hair" | "clothes" | "hat" | "accessory";

export function isLayer(layer: string): layer is Layer {
return ["body", "eyes", "hairs", "clothes", "hat", "accessory"].includes(layer);
return ["body", "eyes", "hair", "clothes", "hat", "accessory"].includes(layer);
}

export const isWokaParts = new tg.IsInterface()
.withProperties({
body: isWokaPart,
eyes: isWokaPart,
hairs: isWokaPart,
clothes: isWokaPart,
hat: isWokaPart,
accessory: isWokaPart,
})
.get();
.withProperties({
body: isWokaPart,
eyes: isWokaPart,
hair: isWokaPart,
clothes: isWokaPart,
hat: isWokaPart,
accessory: isWokaPart,
})
.get();

export type WokaParts = tg.GuardedType<typeof isWokaParts>;

export const isWoka = new tg.IsInterface()
.withProperties({
edition: tg.isNumber,
dna: tg.isString,
parts: isWokaParts,
})
.get();
.withProperties({
edition: tg.isNumber,
dna: tg.isString,
parts: isWokaParts,
})
.get();

export type Woka = tg.GuardedType<typeof isWoka>;

export const isLoadedLayers = new tg.IsInterface()
.withProperties({
body: tg.isArray(isWokaPart),
eyes: tg.isArray(isWokaPart),
hairs: tg.isArray(isWokaPart),
clothes: tg.isArray(isWokaPart),
hat: tg.isArray(isWokaPart),
accessory: tg.isArray(isWokaPart),
})
.get();
.withProperties({
body: tg.isArray(isWokaPart),
eyes: tg.isArray(isWokaPart),
hair: tg.isArray(isWokaPart),
clothes: tg.isArray(isWokaPart),
hat: tg.isArray(isWokaPart),
accessory: tg.isArray(isWokaPart),
})
.get();

export type LoadedLayers = tg.GuardedType<typeof isLoadedLayers>;

0 comments on commit e9dbe4d

Please sign in to comment.