add some content!

ui-refactor
Bronwen 2021-06-23 01:28:06 -04:00
parent f8a966956a
commit d7aca31c8c
6 changed files with 53 additions and 35 deletions

View File

@ -0,0 +1,16 @@
import { registerAction } from '@actions';
import { Game } from '@game';
registerAction('Gather Flint', (qty) => {
Game.current.board.addTask({
taskId: 'core:gather-flint',
options: {}
})
});
registerAction('Gather Slate', (qty) => {
Game.current.board.addTask({
taskId: 'core:gather-slate',
options: {}
})
});

View File

@ -1,18 +1,13 @@
import { Item } from '@items'; import { Item } from '@items';
export const LOG = new Item() export const LOG = new Item().setName("Log").setId('core:resources/log');
.setName("Log") export const STICK = new Item().setName("Stick").setId('core:resources/stick');
.setId('core:resources/log');
export const ROCK = new Item()
.setName("Rock")
.setId('core:resources/rock');
export const STICK = new Item()
.setName("Stick")
.setId('core:resources/stick');
export const FLINT_NORMAL = new Item().setName("Flint").setId('core:flint');
export const FLINT_FLAKE = new Item().setName("Flint Flake").setId('core:flint-flake');
export const SANDSTONE_NORMAL = new Item().setName("Sandstone").setId('core:sandstone');
export const SLATE_NORMAL = new Item().setName("Slate").setId('core:slate');
// slate, flint X normal, flake // slate, flint X normal, flake
// limestone: large, small // limestone, shale, sandstone: large, small
// shale // shale - igneous. metamorphasis => slate

View File

@ -1,22 +1,36 @@
import { Task, registerTask } from "@tasks"; import { Task, registerTask } from "@tasks";
import chalk from 'chalk'; import chalk from 'chalk';
import { Game } from '@game'; import { Game } from '@game';
import { ROCK } from '../items/Items.js'; import { FLINT_NORMAL, SLATE_NORMAL } from '../items/Items.js';
class GatherRocksTask extends Task { registerTask('core:gather-flint', class GatherFlintTask extends Task {
work = 100; work = 1000;
reward(): void { reward(): void {
Game.current.inv.add(ROCK, 1); Game.current.inv.add(FLINT_NORMAL, 1);
} }
get title() { get title() {
return chalk.yellow('Chop Trees'); return 'Gather Flint';
} }
get status() { get status() {
return chalk.yellow('LOGGING'); return 'SCAVENGING';
} }
} });
registerTask('core:gather-rocks', GatherRocksTask); registerTask('core:gather-slate', class GatherSlateTask extends Task {
work = 1000;
reward(): void {
Game.current.inv.add(SLATE_NORMAL, 1);
}
get title() {
return 'Gather Slate';
}
get status() {
return 'SCAVENGING';
}
});

View File

@ -16,7 +16,7 @@
"chalk": "^4.1.1", "chalk": "^4.1.1",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"faker": "^5.5.3", "faker": "^5.5.3",
"frigid": "^1.3.12", "frigid": "^1.3.13",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"get-port": "^5.1.1", "get-port": "^5.1.1",
"mocha": "^9.0.1", "mocha": "^9.0.1",

View File

@ -7,21 +7,14 @@ import { render } from './ui/UI.js';
import { Memory } from './Memory.js'; import { Memory } from './Memory.js';
import { getTheme } from './registries/Themes.js'; import { getTheme } from './registries/Themes.js';
const LABORS = {
CUT_TREE: Symbol('CUT_TREE'),
MINING: Symbol('CUT_TREE'),
}
const SKILLS = {
PICKAXE: Symbol('PICKAXE'),
HATCHET: Symbol('HATCHET')
}
// const STATUS = { // const STATUS = {
// IDLE: Symbol('IDLE') // IDLE: Symbol('IDLE')
// } // }
const energyScale = 0.1; const energyScale = 0.1;
const MAX_ENERGY = 100;
// TODO add stats getter to return % of all stats
export class Pawn extends Serializable implements Tickable { export class Pawn extends Serializable implements Tickable {
name: { name: {
@ -46,7 +39,7 @@ export class Pawn extends Serializable implements Tickable {
if(this.awake === false) { if(this.awake === false) {
this.energy += energyScale * 4; this.energy += energyScale * 4;
if(this.energy >= 100) { if(this.energy >= MAX_ENERGY) {
this.awake = true; this.awake = true;
} }
} else { } else {
@ -88,7 +81,7 @@ export class Pawn extends Serializable implements Tickable {
this.name.first = faker.name.firstName(this.sex); this.name.first = faker.name.firstName(this.sex);
} }
this.awake ??= true; this.awake ??= true;
this.energy ??= 100; this.energy ??= MAX_ENERGY;
this.memories ??= []; this.memories ??= [];
if(!this.age) { if(!this.age) {
this.age = Math.floor(525600 * (16 + Math.random() * 9)); this.age = Math.floor(525600 * (16 + Math.random() * 9));

View File

@ -316,7 +316,7 @@ flat@^5.0.2:
resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
frigid@^1.3.12: frigid@^1.3.13:
version "1.3.13" version "1.3.13"
resolved "https://registry.yarnpkg.com/frigid/-/frigid-1.3.13.tgz#27d8592ec1aeb72964fbc4014e38e6c366c5e3b7" resolved "https://registry.yarnpkg.com/frigid/-/frigid-1.3.13.tgz#27d8592ec1aeb72964fbc4014e38e6c366c5e3b7"
integrity sha512-suwEa7JuMvNqIlVpc848wIptC8o3Ztvadv8a1HojbaNcYdowOlqWi/ieSgQZkBVCpmrBOq7IeuaB6p4BvCUdHQ== integrity sha512-suwEa7JuMvNqIlVpc848wIptC8o3Ztvadv8a1HojbaNcYdowOlqWi/ieSgQZkBVCpmrBOq7IeuaB6p4BvCUdHQ==