few things idk

master
Bronwen 2021-07-10 23:20:51 -04:00
parent d4c008a5e1
commit b728e085a6
6 changed files with 31 additions and 12 deletions

View File

@ -18,9 +18,11 @@ registerAction('Gather Flint', () => {
Game.current.board.addTask(taskState);
});
registerAction('Create Arrowhead', () => {
registerAction('Create Arrowhead', async () => {
// const rock = new ItemState(FLINT_NORMAL, 1, null);
const item = SelectItem.show()
const item = await SelectItem.show((itemState) => {
return true;
});
const task = new TaskState(MAKE_ARROWHEAD, {
baseMaterial: rock
});

View File

@ -12,7 +12,7 @@
"@types/fs-extra": "^9.0.11",
"@types/mocha": "^8.2.2",
"@types/uuid": "^8.3.0",
"@types/ws": "^7.4.5",
"@types/ws": "^7.4.6",
"bonjour": "^3.5.0",
"chai": "^4.3.4",
"chalk": "^4.1.1",

View File

@ -1,5 +1,14 @@
import { ItemState } from "@items";
import { Serializable } from "frigid";
export class World extends Serializable {
}
class WorldItemState {
itemState: ItemState<any>
constructor() {
}
}

View File

@ -14,8 +14,8 @@ export class SelectItem {
items: ItemState<any>[];
selectedIdx: number;
static show(filter: ItemFilterFunction): Promise<ItemState<any>> {
const si = new SelectItem(filter, 1);
static show(filter: ItemFilterFunction, qty: number = 1): Promise<ItemState<any>> {
const si = new SelectItem(filter, qty);
return new Promise(res => {
si.emitter.on('selected', (itemState: ItemState<any>) => {
res(itemState);
@ -60,10 +60,18 @@ export class SelectItem {
this.emitter.emit('selected', this.selectedItem.take(this.qty));
this.close();
} else if(key.full === 'down') {
}
});
this.items = Game.current.inv.items.filter(filter);
this.update();
this.open();
}
update() {
this.box.setContent('test');
panels.screen.render();
}
}

View File

@ -1,4 +1,3 @@
import chalk from 'chalk';
import blessed from 'neo-blessed';
import ansi from 'sisteransi';
@ -99,6 +98,7 @@ export function start() {
process.stdout.write(ansi.cursor.hide);
// todo make a real menu
screen.key(['C-c'], function() {
process.stdout.write(ansi.cursor.show);
setTimeout(_ => {

View File

@ -60,10 +60,10 @@
version "8.3.0"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.0.tgz#215c231dff736d5ba92410e6d602050cce7e273f"
"@types/ws@^7.4.5":
version "7.4.5"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.5.tgz#8ff0f7efcd8fea19f51f9dd66cb8b498d172a752"
integrity sha512-8mbDgtc8xpxDDem5Gwj76stBDJX35KQ3YBoayxlqUQcL5BZUthiqP/VQ4PQnLHqM4PmlbyO74t98eJpURO+gPA==
"@types/ws@^7.4.6":
version "7.4.6"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.6.tgz#c4320845e43d45a7129bb32905e28781c71c1fff"
integrity sha512-ijZ1vzRawI7QoWnTNL8KpHixd2b2XVb9I9HAqI3triPsh1EC0xH0Eg6w2O3TKbDCgiNNlJqfrof6j4T2I+l9vw==
dependencies:
"@types/node" "*"