chore: 2.0.0
This commit is contained in:
parent
db78ad27f4
commit
ea798b8af2
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -116,4 +116,5 @@ dist
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
# local
|
# local
|
||||||
/build
|
/dist
|
||||||
|
/packages/*/yarn.lock
|
||||||
|
|
109
build/flecks.yml
Normal file
109
build/flecks.yml
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
'@avocado/behavior': {}
|
||||||
|
'@avocado/color': {}
|
||||||
|
'@avocado/core': {}
|
||||||
|
'@avocado/dialog': {}
|
||||||
|
'@avocado/entity': {}
|
||||||
|
'@avocado/graphics': {}
|
||||||
|
'@avocado/input':
|
||||||
|
actions:
|
||||||
|
- 'HotbarSlot0'
|
||||||
|
- 'HotbarSlot1'
|
||||||
|
- 'HotbarSlot2'
|
||||||
|
- 'HotbarSlot3'
|
||||||
|
- 'HotbarSlot4'
|
||||||
|
- 'HotbarSlot5'
|
||||||
|
- 'HotbarSlot6'
|
||||||
|
- 'HotbarSlot7'
|
||||||
|
- 'HotbarSlot8'
|
||||||
|
- 'HotbarSlot9'
|
||||||
|
- 'HotbarSlotNext'
|
||||||
|
- 'HotbarSlotPrevious'
|
||||||
|
- 'MoveUp'
|
||||||
|
- 'MoveLeft'
|
||||||
|
- 'MoveDown'
|
||||||
|
- 'MoveRight'
|
||||||
|
- 'UseItem'
|
||||||
|
- 'Interact'
|
||||||
|
'@avocado/math': {}
|
||||||
|
'@avocado/physics': {}
|
||||||
|
'@avocado/react': {}
|
||||||
|
'@avocado/resource': {}
|
||||||
|
'@avocado/s13n': {}
|
||||||
|
'@avocado/sandbox': {}
|
||||||
|
'@avocado/sound': {}
|
||||||
|
'@avocado/timing': {}
|
||||||
|
'@avocado/topdown': {}
|
||||||
|
'@avocado/traits': {}
|
||||||
|
'@flecks/core':
|
||||||
|
id: 'humus'
|
||||||
|
'@flecks/db': {}
|
||||||
|
'@flecks/db/server':
|
||||||
|
port: 32352
|
||||||
|
'@flecks/docker': {}
|
||||||
|
'@flecks/governor': {}
|
||||||
|
'@flecks/http':
|
||||||
|
title: 'Rooted'
|
||||||
|
'@flecks/http/client':
|
||||||
|
up:
|
||||||
|
- '@flecks/socket'
|
||||||
|
- '@humus/universe'
|
||||||
|
- '@flecks/react'
|
||||||
|
- '...'
|
||||||
|
'@flecks/http/server':
|
||||||
|
devPublic: 'humus.local.cha0s.io'
|
||||||
|
port: 32350
|
||||||
|
'request.route':
|
||||||
|
- '@flecks/user/session'
|
||||||
|
- '@flecks/user'
|
||||||
|
- '...'
|
||||||
|
'request.socket':
|
||||||
|
- '@humus/universe/server'
|
||||||
|
- '...'
|
||||||
|
'stream.html':
|
||||||
|
- '@flecks/react'
|
||||||
|
- '...'
|
||||||
|
'@flecks/react':
|
||||||
|
providers:
|
||||||
|
- '@flecks/redux'
|
||||||
|
- '@flecks/react/router'
|
||||||
|
- '...'
|
||||||
|
'@flecks/react/router': {}
|
||||||
|
'@flecks/redis': {}
|
||||||
|
'@flecks/redis/server':
|
||||||
|
port: 32353
|
||||||
|
'@flecks/redis/session': {}
|
||||||
|
'@flecks/redux': {}
|
||||||
|
'@flecks/repl': {}
|
||||||
|
'@flecks/server':
|
||||||
|
up:
|
||||||
|
- '@flecks/docker'
|
||||||
|
- '@flecks/db'
|
||||||
|
- '@flecks/redis'
|
||||||
|
- '@flecks/user/session'
|
||||||
|
- '@flecks/user'
|
||||||
|
- '@flecks/user/local'
|
||||||
|
- '@flecks/governor'
|
||||||
|
- '...'
|
||||||
|
- '@humus/universe'
|
||||||
|
- '@flecks/http'
|
||||||
|
- '@flecks/repl'
|
||||||
|
'@flecks/socket': {}
|
||||||
|
'@flecks/socket/server':
|
||||||
|
authenticate:
|
||||||
|
- '@flecks/user/session/server'
|
||||||
|
- '@flecks/user/server'
|
||||||
|
connect:
|
||||||
|
- '@flecks/socket/server'
|
||||||
|
'@flecks/user': {}
|
||||||
|
'@flecks/user/local': {}
|
||||||
|
'@flecks/user/session': {}
|
||||||
|
'@humus/app:packages/app/src': {}
|
||||||
|
'@humus/combat:packages/combat/src': {}
|
||||||
|
'@humus/core:packages/core/src': {}
|
||||||
|
'@humus/farm:packages/farm/src': {}
|
||||||
|
'@humus/inventory:packages/inventory/src': {}
|
||||||
|
'@humus/universe:packages/universe/src':
|
||||||
|
root: '../persea/projects/c41ddaac-89c2-46a4-b3e5-1d634a1a7c36'
|
||||||
|
'@humus/universe/client:packages/universe/src/client': {}
|
||||||
|
'@humus/universe/server:packages/universe/src/server':
|
||||||
|
running: 'c41ddaac-89c2-46a4-b3e5-1d634a1a7c36'
|
6
config/package/.gitignore
vendored
6
config/package/.gitignore
vendored
|
@ -1,6 +0,0 @@
|
||||||
**/*.js
|
|
||||||
**/*.map
|
|
||||||
/assets
|
|
||||||
!/.*
|
|
||||||
!src/**/*.js
|
|
||||||
!/test/**/*.js
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"version": "1.0.0",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"build": "latus-build",
|
|
||||||
"clean": "latus-build clean",
|
|
||||||
"fp": "latus-build forcepublish",
|
|
||||||
"lint": "latus-build lint",
|
|
||||||
"test": "latus-build test"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"index.js",
|
|
||||||
"index.js.map",
|
|
||||||
"test.js",
|
|
||||||
"test.js.map"
|
|
||||||
],
|
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
|
||||||
"@latus/build": "1.x"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
import {expect} from 'chai';
|
|
||||||
|
|
||||||
it('exists', () => {
|
|
||||||
expect(true).to.be.true;
|
|
||||||
});
|
|
116
latus.yml
116
latus.yml
|
@ -1,116 +0,0 @@
|
||||||
'@avocado/behavior': {}
|
|
||||||
'@avocado/color': {}
|
|
||||||
'@avocado/core': {}
|
|
||||||
'@avocado/dialog': {}
|
|
||||||
'@avocado/entity': {}
|
|
||||||
'@avocado/graphics': {}
|
|
||||||
'@avocado/input': {
|
|
||||||
actions: [
|
|
||||||
'HotbarSlot0',
|
|
||||||
'HotbarSlot1',
|
|
||||||
'HotbarSlot2',
|
|
||||||
'HotbarSlot3',
|
|
||||||
'HotbarSlot4',
|
|
||||||
'HotbarSlot5',
|
|
||||||
'HotbarSlot6',
|
|
||||||
'HotbarSlot7',
|
|
||||||
'HotbarSlot8',
|
|
||||||
'HotbarSlot9',
|
|
||||||
'HotbarSlotNext',
|
|
||||||
'HotbarSlotPrevious',
|
|
||||||
'MoveUp',
|
|
||||||
'MoveLeft',
|
|
||||||
'MoveDown',
|
|
||||||
'MoveRight',
|
|
||||||
'UseItem',
|
|
||||||
'Interact',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
'@avocado/math': {}
|
|
||||||
'@avocado/physics': {}
|
|
||||||
'@avocado/resource': {}
|
|
||||||
'@avocado/s13n': {}
|
|
||||||
'@avocado/sandbox': {}
|
|
||||||
'@avocado/sound': {}
|
|
||||||
'@avocado/timing': {}
|
|
||||||
'@avocado/topdown': {}
|
|
||||||
'@avocado/traits': {}
|
|
||||||
'@humus/app': {}
|
|
||||||
'@humus/combat': {}
|
|
||||||
'@humus/core': {}
|
|
||||||
'@humus/farm': {}
|
|
||||||
'@humus/inventory': {}
|
|
||||||
'@humus/universe': {
|
|
||||||
root: '../persea/projects/c41ddaac-89c2-46a4-b3e5-1d634a1a7c36',
|
|
||||||
}
|
|
||||||
'@humus/universe/server': {
|
|
||||||
running: 'c41ddaac-89c2-46a4-b3e5-1d634a1a7c36',
|
|
||||||
}
|
|
||||||
'@latus/core': {
|
|
||||||
id: 'humus',
|
|
||||||
}
|
|
||||||
'@latus/core/server': {
|
|
||||||
up: [
|
|
||||||
'@latus/db/server',
|
|
||||||
'@latus/redis/server',
|
|
||||||
'@latus/user/session/server',
|
|
||||||
'@latus/user/server',
|
|
||||||
'@latus/user/local/server',
|
|
||||||
'@latus/http/server',
|
|
||||||
'@humus/universe/server',
|
|
||||||
'@latus/repl/server',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
'@latus/db': {}
|
|
||||||
'@latus/db/server': {
|
|
||||||
models.decorate: [
|
|
||||||
'@latus/user/local/server',
|
|
||||||
],
|
|
||||||
docker: 'cached',
|
|
||||||
}
|
|
||||||
'@latus/governor': {}
|
|
||||||
'@latus/http': {
|
|
||||||
title: 'Rooted',
|
|
||||||
}
|
|
||||||
'@latus/http/client': {
|
|
||||||
up: [
|
|
||||||
'@latus/socket/client',
|
|
||||||
'@humus/universe/client',
|
|
||||||
'@latus/react/client',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
'@latus/http/server': {
|
|
||||||
request.page: [
|
|
||||||
'@latus/user/session/server',
|
|
||||||
'@latus/user/server',
|
|
||||||
],
|
|
||||||
request.socket: [
|
|
||||||
'@humus/universe/server',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
'@latus/react': {}
|
|
||||||
'@latus/redis': {}
|
|
||||||
'@latus/redis/server': {
|
|
||||||
docker: 'cached',
|
|
||||||
}
|
|
||||||
'@latus/redis/session': {}
|
|
||||||
'@latus/redux': {}
|
|
||||||
'@latus/repl': {}
|
|
||||||
'@latus/socket': {
|
|
||||||
packets.decorate: [
|
|
||||||
'@latus/governor/server',
|
|
||||||
'@humus/universe/server',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
'@latus/socket/server': {
|
|
||||||
authenticate: [
|
|
||||||
'@latus/user/session/server',
|
|
||||||
'@latus/user/server',
|
|
||||||
],
|
|
||||||
connect: [
|
|
||||||
'@latus/socket/server',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
'@latus/user': {}
|
|
||||||
'@latus/user/local': {}
|
|
||||||
'@latus/user/session': {}
|
|
|
@ -2,5 +2,5 @@
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"version": "1.0.0"
|
"version": "2.0.0"
|
||||||
}
|
}
|
||||||
|
|
37
package.js
37
package.js
|
@ -1,37 +0,0 @@
|
||||||
const {execSync} = require('child_process');
|
|
||||||
const {join} = require('path');
|
|
||||||
const fs = require('fs-extra')
|
|
||||||
|
|
||||||
const cwd = process.cwd();
|
|
||||||
const [exe, script, package] = process.argv;
|
|
||||||
|
|
||||||
const path = join(cwd, 'packages', package);
|
|
||||||
try {
|
|
||||||
fs.accessSync(path);
|
|
||||||
console.error(`Package '${package}' already exists, aborting.`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
catch (error) {}
|
|
||||||
|
|
||||||
const [scope] = require('./package.json').name.split('/');
|
|
||||||
const name = [scope, package].join('/');
|
|
||||||
console.log(`Copying new project '${name}' to ${path}...`);
|
|
||||||
fs.copySync(
|
|
||||||
join(cwd, 'config/package'),
|
|
||||||
path,
|
|
||||||
);
|
|
||||||
const json = {
|
|
||||||
name,
|
|
||||||
...require(join(path, 'package.json')),
|
|
||||||
};
|
|
||||||
fs.writeFileSync(
|
|
||||||
join(path, 'package.json'),
|
|
||||||
JSON.stringify(json, null, 2),
|
|
||||||
);
|
|
||||||
|
|
||||||
const exec = (cmd) => execSync(cmd, {cwd: path, stdio: 'inherit'});
|
|
||||||
console.log(`Installing...`);
|
|
||||||
exec('yarn');
|
|
||||||
|
|
||||||
console.log(`Testing...`);
|
|
||||||
exec('yarn run test');
|
|
112
package.json
112
package.json
|
@ -1,63 +1,69 @@
|
||||||
{
|
{
|
||||||
"name": "humus",
|
"name": "@humus/monorepo",
|
||||||
"version": "2.0.1",
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/monorepo"
|
||||||
|
},
|
||||||
|
"version": "2.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "lerna run build",
|
"build": "FLECKS_ENV_FLECKS_SERVER_start=0 npm run build:only",
|
||||||
"build:docker": "docker build -t docker.hq.cha0s.io/cha0s6983/$(echo $(jq -r .name package.json):$(jq -r .version package.json)) .",
|
"build:only": "flecks build",
|
||||||
"build:lat": "latus-build",
|
"debug": "DEBUG=*,-babel* npm run dev",
|
||||||
"clean": "lerna run clean",
|
"dev": "npm run -- build:only -h",
|
||||||
"docker": "yarn build:lat && docker-compose up --build",
|
"link-all": "yarn link $(for i in $(ls node_modules/@flecks); do echo -n \"@flecks/$i \"; done)",
|
||||||
"electron": "NODE_ENV=production NODE_PATH=./node_modules electron build/electron.js",
|
"postinstall": "patch-package",
|
||||||
"fp": "lerna run fp",
|
"repl": "npx flecks repl --rlwrap",
|
||||||
"http": "LATUS_ONLY_BUILD=http latus-build -d --hot --watch",
|
"start": "DEBUG=@avocado*,@flecks*,@humus*,humus*,-@flecks/core/flecks* npm run dev",
|
||||||
"lint": "lerna run lint",
|
"unlink-all": "yarn unlink $(for i in $(ls node_modules/@flecks); do echo -n \"@flecks/$i \"; done) && yarn install --force",
|
||||||
"package": "node ./package.js",
|
"up": "yarn add $(for i in $(ls node_modules/@flecks); do echo -n \"@flecks/$i \"; done) $(for i in $(ls node_modules/@avocado); do echo -n \"@avocado/$i \"; done)"
|
||||||
"push": "docker push docker.hq.cha0s.io/cha0s6983/$(echo $(jq -r .name package.json):$(jq -r .version package.json))",
|
|
||||||
"refresh": "yarn run clean && npx lerna exec link-all && yarn run build && yarn run test",
|
|
||||||
"repl": "rlwrap -C qmp socat STDIO UNIX:$(ls /tmp/humus-*.sock | tail -n 1)",
|
|
||||||
"server": "LATUS_ONLY_BUILD=server latus-build -d --start-server --inspect --watch",
|
|
||||||
"start": "NODE_ENV=production NODE_PATH=./node_modules node build/index.js",
|
|
||||||
"test": "lerna run test --no-bail -- --silent",
|
|
||||||
"undocker": "unlink-all && yarn install --force"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@avocado/behavior": "^2.0.0",
|
"@avocado/behavior": "^3.0.0",
|
||||||
"@avocado/color": "^1.0.0",
|
"@avocado/color": "^3.0.0",
|
||||||
"@avocado/core": "^2.0.0",
|
"@avocado/core": "^3.0.0",
|
||||||
"@avocado/dialog": "^1.0.0",
|
"@avocado/dialog": "^3.0.0",
|
||||||
"@avocado/entity": "^2.0.0",
|
"@avocado/entity": "^3.0.0",
|
||||||
"@avocado/graphics": "^2.0.0",
|
"@avocado/graphics": "^3.0.0",
|
||||||
"@avocado/input": "^2.0.0",
|
"@avocado/input": "^3.0.0",
|
||||||
"@avocado/math": "^2.0.0",
|
"@avocado/math": "^3.0.0",
|
||||||
"@avocado/physics": "^1.0.0",
|
"@avocado/physics": "^3.0.0",
|
||||||
"@avocado/resource": "^2.0.0",
|
"@avocado/react": "^3.0.0",
|
||||||
"@avocado/s13n": "^2.0.0",
|
"@avocado/resource": "^3.0.0",
|
||||||
"@avocado/sandbox": "^1.0.0",
|
"@avocado/resource-persea": "^3.0.0",
|
||||||
"@avocado/sound": "^1.0.0",
|
"@avocado/s13n": "^3.0.0",
|
||||||
"@avocado/timing": "^2.0.0",
|
"@avocado/sound": "^3.0.0",
|
||||||
"@avocado/topdown": "^2.0.0",
|
"@avocado/timing": "^3.0.0",
|
||||||
"@humus/app": "^1.0.0",
|
"@avocado/topdown": "^3.0.0",
|
||||||
"@humus/combat": "^1.0.0",
|
"@avocado/traits": "^3.0.0",
|
||||||
"@humus/core": "^1.0.0",
|
"@flecks/core": "^1.3.0",
|
||||||
"@humus/farm": "^1.0.0",
|
"@flecks/create-app": "^1.3.0",
|
||||||
"@humus/inventory": "^1.0.0",
|
"@flecks/db": "^1.3.0",
|
||||||
"@humus/universe": "^1.0.0",
|
"@flecks/governor": "^1.3.0",
|
||||||
|
"@flecks/http": "^1.3.0",
|
||||||
|
"@flecks/react": "^1.3.0",
|
||||||
|
"@flecks/redis": "^1.3.0",
|
||||||
|
"@flecks/redux": "^1.3.0",
|
||||||
|
"@flecks/repl": "^1.3.0",
|
||||||
|
"@flecks/server": "^1.3.0",
|
||||||
|
"@flecks/socket": "^1.3.0",
|
||||||
|
"@flecks/user": "^1.3.0",
|
||||||
|
"@humus/combat": "^2.0.0",
|
||||||
|
"@humus/core": "^2.0.0",
|
||||||
|
"@humus/farm": "^2.0.0",
|
||||||
|
"@humus/inventory": "^2.0.0",
|
||||||
|
"@humus/scss": "^2.0.0",
|
||||||
|
"@humus/universe": "^2.0.0",
|
||||||
"@inlet/react-pixi": "^6.0.7",
|
"@inlet/react-pixi": "^6.0.7",
|
||||||
"@latus/core": "2.0.0",
|
"pg": "^8.7.3",
|
||||||
"@latus/db": "2.1.0",
|
"pg-hstore": "^2.3.4"
|
||||||
"@latus/governor": "2.0.0",
|
|
||||||
"@latus/http": "2.0.0",
|
|
||||||
"@latus/react": "2.0.0",
|
|
||||||
"@latus/redis": "2.0.0",
|
|
||||||
"@latus/redux": "^2.0.0",
|
|
||||||
"@latus/repl": "2.0.0",
|
|
||||||
"@latus/socket": "2.0.0",
|
|
||||||
"@latus/user": "2.0.0",
|
|
||||||
"dotenv": "^8.2.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x",
|
"@flecks/create-fleck": "^1.3.0",
|
||||||
"lerna": "^3.22.1"
|
"@flecks/docker": "^1.3.0",
|
||||||
|
"lerna": "^3.22.1",
|
||||||
|
"patch-package": "^6.4.7",
|
||||||
|
"postinstall-postinstall": "^2.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
122
packages/app/.gitignore
vendored
122
packages/app/.gitignore
vendored
|
@ -1,6 +1,116 @@
|
||||||
**/*.js
|
# Logs
|
||||||
**/*.map
|
logs
|
||||||
/assets
|
*.log
|
||||||
!/.*
|
npm-debug.log*
|
||||||
!src/**/*.js
|
yarn-debug.log*
|
||||||
!/test/**/*.js
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
BIN
packages/app/assets/Lato-Light.0d0e8094.eot
Normal file
BIN
packages/app/assets/Lato-Light.0d0e8094.eot
Normal file
Binary file not shown.
BIN
packages/app/assets/Lato-Light.7f1818d7.ttf
Normal file
BIN
packages/app/assets/Lato-Light.7f1818d7.ttf
Normal file
Binary file not shown.
BIN
packages/app/assets/Lato-Light.cd4cb10f.woff
Normal file
BIN
packages/app/assets/Lato-Light.cd4cb10f.woff
Normal file
Binary file not shown.
BIN
packages/app/assets/Lato-Regular.1a6b7f11.woff
Normal file
BIN
packages/app/assets/Lato-Regular.1a6b7f11.woff
Normal file
Binary file not shown.
BIN
packages/app/assets/Lato-Regular.1ac2a816.eot
Normal file
BIN
packages/app/assets/Lato-Regular.1ac2a816.eot
Normal file
Binary file not shown.
BIN
packages/app/assets/Lato-Regular.c19965fe.ttf
Normal file
BIN
packages/app/assets/Lato-Regular.c19965fe.ttf
Normal file
Binary file not shown.
BIN
packages/app/assets/Rooted.6f3ecd5a.ttf
Normal file
BIN
packages/app/assets/Rooted.6f3ecd5a.ttf
Normal file
Binary file not shown.
BIN
packages/app/assets/Rooted.8daea68b.eot
Normal file
BIN
packages/app/assets/Rooted.8daea68b.eot
Normal file
Binary file not shown.
BIN
packages/app/assets/Rooted.ba2af84f.woff
Normal file
BIN
packages/app/assets/Rooted.ba2af84f.woff
Normal file
Binary file not shown.
BIN
packages/app/assets/dialogue.3ed20657.ttf
Normal file
BIN
packages/app/assets/dialogue.3ed20657.ttf
Normal file
Binary file not shown.
BIN
packages/app/assets/joystix-monospace.03fd3941.ttf
Normal file
BIN
packages/app/assets/joystix-monospace.03fd3941.ttf
Normal file
Binary file not shown.
BIN
packages/app/assets/rooted.74535d3d.jpg
Normal file
BIN
packages/app/assets/rooted.74535d3d.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 581 KiB |
6
packages/app/build/flecks.yml
Normal file
6
packages/app/build/flecks.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
'@flecks/core': {}
|
||||||
|
'@flecks/fleck': {}
|
||||||
|
'@flecks/http': {}
|
||||||
|
'@flecks/http/server':
|
||||||
|
build: false
|
||||||
|
'@flecks/react': {}
|
|
@ -1,34 +1,39 @@
|
||||||
{
|
{
|
||||||
"name": "@humus/app",
|
"name": "@humus/app",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/app"
|
||||||
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "latus-build",
|
"build": "flecks build",
|
||||||
"clean": "latus-build clean",
|
"clean": "flecks clean",
|
||||||
"fp": "latus-build forcepublish",
|
"lint": "flecks lint",
|
||||||
"lint": "latus-build lint",
|
"postversion": "cp package.json dist",
|
||||||
"test": "latus-build test"
|
"test": "flecks test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"client.js",
|
"build",
|
||||||
"client.js.map",
|
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map",
|
"index.js.map",
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
"test.js",
|
"test.js",
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@humus/scss": "^1.0.0",
|
"@flecks/core": "^1.3.0",
|
||||||
"@latus/react": "^2.0.0",
|
"@flecks/react": "^1.3.0",
|
||||||
"@latus/redux": "^2.0.0",
|
"@flecks/redux": "^1.3.0",
|
||||||
"@latus/socket": "^2.0.0",
|
"@flecks/socket": "^1.3.0",
|
||||||
"@latus/user": "^2.0.0",
|
"@flecks/user": "^1.3.0",
|
||||||
"connected-react-router": "^6.9.1",
|
"@humus/scss": "^2.0.0",
|
||||||
"history": "^4.10.0",
|
"is-electron": "^2.2.0"
|
||||||
"is-electron": "^2.2.0",
|
|
||||||
"react-router-dom": "^5.2.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x"
|
"@flecks/fleck": "^1.3.0",
|
||||||
|
"@flecks/http": "^1.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
import {connectRouter, routerMiddleware} from 'connected-react-router';
|
|
||||||
|
|
||||||
import {selfEntity} from './state';
|
|
||||||
|
|
||||||
import App from './components/app';
|
|
||||||
import history from './components/app/history';
|
|
||||||
import Ui, {Context} from './components/valent-ui';
|
|
||||||
|
|
||||||
export * from './hooks';
|
|
||||||
export * from './state';
|
|
||||||
|
|
||||||
export {Ui};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
hooks: {
|
|
||||||
'@latus/react/components': () => App,
|
|
||||||
'@latus/react/providers': async (latus) => [
|
|
||||||
Context.Provider,
|
|
||||||
{value: latus.get('@humus/app.resolution')},
|
|
||||||
],
|
|
||||||
'@latus/redux/slices': () => ({
|
|
||||||
router: connectRouter(history),
|
|
||||||
selfEntity,
|
|
||||||
}),
|
|
||||||
'@latus/redux/store': (options) => {
|
|
||||||
options.middleware.push(routerMiddleware(history));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,3 +0,0 @@
|
||||||
import {createBrowserHistory} from 'history';
|
|
||||||
|
|
||||||
export default createBrowserHistory();
|
|
|
@ -2,57 +2,40 @@ import './index.scss';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
hot,
|
hot,
|
||||||
|
PropTypes,
|
||||||
React,
|
React,
|
||||||
useLatus,
|
} from '@flecks/react';
|
||||||
} from '@latus/react';
|
|
||||||
import {ConnectedRouter} from 'connected-react-router';
|
|
||||||
import {
|
import {
|
||||||
Redirect,
|
Navigate,
|
||||||
|
Outlet,
|
||||||
|
Routes,
|
||||||
Route,
|
Route,
|
||||||
Switch,
|
} from '@flecks/react/router';
|
||||||
} from 'react-router-dom';
|
|
||||||
|
|
||||||
import Ui from '../valent-ui';
|
import Ui from '../valent-ui';
|
||||||
|
|
||||||
import Login from './login';
|
|
||||||
import Title from './title';
|
import Title from './title';
|
||||||
|
|
||||||
import history from './history';
|
const UiWrapped = () => (
|
||||||
|
<Ui><Outlet /></Ui>
|
||||||
|
);
|
||||||
|
|
||||||
const isLoggedIn = true;
|
const Humus = ({Components}) => (
|
||||||
|
<div className="humus">
|
||||||
|
<Routes>
|
||||||
|
<Route path="/title" element={<UiWrapped />}>
|
||||||
|
<Route index element={<Title />} />
|
||||||
|
</Route>
|
||||||
|
<Route path="/title/*" element={<></>} />
|
||||||
|
<Route path="/universe/*" element={<></>} />
|
||||||
|
<Route path="*" element={<Navigate to="/title" />} />
|
||||||
|
</Routes>
|
||||||
|
{Components}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
const Humus = () => {
|
Humus.propTypes = {
|
||||||
const latus = useLatus();
|
Components: PropTypes.arrayOf(PropTypes.node).isRequired,
|
||||||
const Components = Object.entries(latus.invoke('@humus/app/components'))
|
|
||||||
.map(([path, Component]) => (
|
|
||||||
<Component key={path} />
|
|
||||||
));
|
|
||||||
return (
|
|
||||||
<div className="humus">
|
|
||||||
<ConnectedRouter history={history}>
|
|
||||||
<Switch>
|
|
||||||
<Route path="/login">
|
|
||||||
{isLoggedIn ? <Redirect to="/title" /> : Login}
|
|
||||||
</Route>
|
|
||||||
<Ui>
|
|
||||||
<Route exact path="/title">
|
|
||||||
<Title />
|
|
||||||
</Route>
|
|
||||||
</Ui>
|
|
||||||
</Switch>
|
|
||||||
{Components}
|
|
||||||
<Route exact path="/">
|
|
||||||
<Redirect to="/title" />
|
|
||||||
</Route>
|
|
||||||
<Route path="/title">
|
|
||||||
<Redirect to="/title" />
|
|
||||||
</Route>
|
|
||||||
{!isLoggedIn && <Redirect to="/login" />}
|
|
||||||
</ConnectedRouter>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Humus.propTypes = {};
|
|
||||||
|
|
||||||
export default hot(module)(Humus);
|
export default hot(module)(Humus);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {React} from '@latus/react';
|
import {React} from '@flecks/react';
|
||||||
|
|
||||||
import LatusLogin from '@latus/user/client/components/login';
|
import {UserLocalLogin} from '@flecks/user/local/client';
|
||||||
|
|
||||||
const Login = () => (
|
const Login = () => (
|
||||||
<LatusLogin />
|
<UserLocalLogin />
|
||||||
);
|
);
|
||||||
|
|
||||||
export default Login;
|
export default Login;
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
gatherComponents,
|
||||||
React,
|
React,
|
||||||
useLatus,
|
useFlecks,
|
||||||
} from '@latus/react';
|
} from '@flecks/react';
|
||||||
|
|
||||||
const Title = () => {
|
const Title = () => {
|
||||||
const latus = useLatus();
|
const flecks = useFlecks();
|
||||||
const Items = Object.entries(latus.invoke('@humus/app/title'))
|
const Items = gatherComponents(flecks.invoke('@humus/app.title'));
|
||||||
.map(([path, Component]) => (
|
|
||||||
<Component key={path} />
|
|
||||||
));
|
|
||||||
return (
|
return (
|
||||||
<div className="title">
|
<div className="title">
|
||||||
<div className="title__muted">
|
<div className="title__muted">
|
||||||
<h1 className="title__title">{latus.get('@latus/http.title')}</h1>
|
<h1 className="title__title">Humus</h1>
|
||||||
<ul className="title__actions">
|
<ul className="title__actions">
|
||||||
{Items}
|
{Items}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
0
packages/app/src/components/app/title/rooted.jpg
Executable file → Normal file
0
packages/app/src/components/app/title/rooted.jpg
Executable file → Normal file
Before Width: | Height: | Size: 581 KiB After Width: | Height: | Size: 581 KiB |
0
packages/app/src/components/valent-ui/arrow-inout.png
Executable file → Normal file
0
packages/app/src/components/valent-ui/arrow-inout.png
Executable file → Normal file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -1,3 +1,3 @@
|
||||||
import {createContext} from '@latus/react';
|
import {createContext} from '@flecks/react';
|
||||||
|
|
||||||
export default createContext(undefined);
|
export default createContext(undefined);
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
} from '@latus/react';
|
} from '@flecks/react';
|
||||||
|
|
||||||
import Context from './context';
|
import Context from './context';
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
left: 50%;
|
left: 50%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
--scale: 0;
|
--scale: 1;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: scale(var(--scale)) translate(-50%, -50%);
|
transform: scale(var(--scale)) translate(-50%, -50%);
|
||||||
transform-origin: 0 0;
|
transform-origin: 0 0;
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
import {
|
import {
|
||||||
useEffect,
|
useEffect,
|
||||||
useLatus,
|
useFlecks,
|
||||||
useState,
|
useState,
|
||||||
} from '@latus/react';
|
} from '@flecks/react';
|
||||||
import {useSocket} from '@latus/socket';
|
import {useSocket} from '@flecks/socket';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const latus = useLatus();
|
const flecks = useFlecks();
|
||||||
const [room, setRoom] = useState(latus.get('%room'));
|
const [room, setRoom] = useState(flecks.get('$humus/app.room'));
|
||||||
const socket = useSocket();
|
const socket = useSocket();
|
||||||
const synchronizer = latus.get('%synchronizer');
|
const synchronizer = flecks.get('$humus/universe.synchronizer');
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!room) {
|
if (!room) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const onDisconnect = () => {
|
const onDisconnect = () => {
|
||||||
synchronizer.destroySynchronized(room.constructor.resourceId, room.s13nId);
|
synchronizer.destroySynchronized(room.constructor.resourceId, room.s13nId);
|
||||||
latus.set('%room', undefined);
|
flecks.set('$humus/app.room', undefined);
|
||||||
setRoom(undefined);
|
setRoom(undefined);
|
||||||
};
|
};
|
||||||
socket.on('disconnect', onDisconnect);
|
socket.on('disconnect', onDisconnect);
|
||||||
return () => {
|
return () => {
|
||||||
socket.off('disconnect', onDisconnect);
|
socket.off('disconnect', onDisconnect);
|
||||||
};
|
};
|
||||||
}, [latus, room, socket, synchronizer]);
|
}, [flecks, room, socket, synchronizer]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!synchronizer) {
|
if (!synchronizer) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const onCreated = (created) => {
|
const onCreated = (created) => {
|
||||||
const {Room} = latus.get('%resources');
|
const {Room} = flecks.get('$avocado/resource.resources');
|
||||||
switch (created.constructor.resourceId) {
|
switch (created.constructor.resourceId) {
|
||||||
// Track room.
|
// Track room.
|
||||||
case Room.resourceId: {
|
case Room.resourceId: {
|
||||||
latus.set('%room', created);
|
flecks.set('$humus/app.room', created);
|
||||||
setRoom(created);
|
setRoom(created);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,6 @@ export default () => {
|
||||||
return () => {
|
return () => {
|
||||||
synchronizer.off('created', onCreated);
|
synchronizer.off('created', onCreated);
|
||||||
};
|
};
|
||||||
}, [latus, room, synchronizer]);
|
}, [flecks, room, synchronizer]);
|
||||||
return room;
|
return room;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import {
|
import {
|
||||||
useEffect,
|
useEffect,
|
||||||
useLatus,
|
useFlecks,
|
||||||
useState,
|
useState,
|
||||||
} from '@latus/react';
|
} from '@flecks/react';
|
||||||
import {useSelector} from '@latus/redux';
|
import {useSelector} from '@flecks/redux';
|
||||||
|
|
||||||
import {selfEntitySelector} from '../state';
|
import {selfEntitySelector} from '../state';
|
||||||
import useRoom from './use-room';
|
import useRoom from './use-room';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const latus = useLatus();
|
const flecks = useFlecks();
|
||||||
const room = useRoom();
|
const room = useRoom();
|
||||||
const selfEntity = useSelector(selfEntitySelector);
|
const selfEntity = useSelector(selfEntitySelector);
|
||||||
const [entity, setEntity] = useState(latus.get('%selfEntity'));
|
const [entity, setEntity] = useState(flecks.get('$humus/app.selfEntity'));
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!room) {
|
if (!room) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const onDestroying = () => {
|
const onDestroying = () => {
|
||||||
latus.set('%selfEntity', undefined);
|
flecks.set('$humus/app.selfEntity', undefined);
|
||||||
setEntity(undefined);
|
setEntity(undefined);
|
||||||
};
|
};
|
||||||
const augmentSelfEntity = async (entity) => {
|
const augmentSelfEntity = async (entity) => {
|
||||||
|
@ -28,10 +28,10 @@ export default () => {
|
||||||
});
|
});
|
||||||
entity.on('destroying', onDestroying);
|
entity.on('destroying', onDestroying);
|
||||||
}
|
}
|
||||||
latus.set('%selfEntity', entity);
|
flecks.set('$humus/app.selfEntity', entity);
|
||||||
setEntity(entity);
|
setEntity(entity);
|
||||||
};
|
};
|
||||||
augmentSelfEntity(room.findEntity(selfEntity));
|
augmentSelfEntity(room.findEntity(selfEntity));
|
||||||
}, [latus, room, selfEntity]);
|
}, [flecks, room, selfEntity]);
|
||||||
return entity;
|
return entity;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,29 @@
|
||||||
|
import {Hooks} from '@flecks/core';
|
||||||
|
import {gatherComponents} from '@flecks/react';
|
||||||
|
|
||||||
|
import App from './components/app';
|
||||||
|
import {selfEntity} from './state';
|
||||||
|
import Ui, {Context} from './components/valent-ui';
|
||||||
|
|
||||||
|
export * from './hooks';
|
||||||
|
export * from './state';
|
||||||
|
|
||||||
|
export {Ui};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
[Hooks]: {
|
||||||
'@latus/core/config': () => ({
|
'@flecks/core.config': () => ({
|
||||||
resolution: [1600, 900],
|
resolution: [1600, 900],
|
||||||
}),
|
}),
|
||||||
|
'@flecks/react.roots': (req, flecks) => (
|
||||||
|
[App, {Components: gatherComponents(flecks.invoke('@humus/app.components'))}]
|
||||||
|
),
|
||||||
|
'@flecks/react.providers': async (req, flecks) => [
|
||||||
|
Context.Provider,
|
||||||
|
{value: flecks.get('@humus/app.resolution')},
|
||||||
|
],
|
||||||
|
'@flecks/redux.slices': () => ({
|
||||||
|
selfEntity,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import {
|
import {createSlice} from '@flecks/redux';
|
||||||
createSlice,
|
|
||||||
} from '@latus/redux';
|
|
||||||
|
|
||||||
export const selfEntitySelector = ({selfEntity}) => selfEntity;
|
export const selfEntitySelector = ({selfEntity}) => selfEntity;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
122
packages/combat/.gitignore
vendored
122
packages/combat/.gitignore
vendored
|
@ -1,6 +1,116 @@
|
||||||
**/*.js
|
# Logs
|
||||||
**/*.map
|
logs
|
||||||
/assets
|
*.log
|
||||||
!/.*
|
npm-debug.log*
|
||||||
!src/**/*.js
|
yarn-debug.log*
|
||||||
!/test/**/*.js
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
6
packages/combat/build/flecks.yml
Normal file
6
packages/combat/build/flecks.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
'@flecks/core': {}
|
||||||
|
'@flecks/fleck': {}
|
||||||
|
'@flecks/http': {}
|
||||||
|
'@flecks/http/server':
|
||||||
|
build: false
|
||||||
|
'@flecks/react': {}
|
|
@ -1,40 +1,48 @@
|
||||||
{
|
{
|
||||||
"name": "@humus/combat",
|
"name": "@humus/combat",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/combat"
|
||||||
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "cha0s",
|
"author": "cha0s",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "latus-build",
|
"build": "flecks build",
|
||||||
"clean": "latus-build clean",
|
"clean": "flecks clean",
|
||||||
"fp": "latus-build forcepublish",
|
"lint": "flecks lint",
|
||||||
"lint": "latus-build lint",
|
"postversion": "cp package.json dist",
|
||||||
"test": "latus-build test"
|
"test": "flecks test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"build",
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map",
|
"index.js.map",
|
||||||
"persea.js",
|
"persea.js",
|
||||||
"persea.js.map",
|
"persea.js.map",
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
"test.js",
|
"test.js",
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@avocado/behavior": "^2.0.0",
|
"@avocado/behavior": "^3.0.0",
|
||||||
"@avocado/entity": "^2.0.0",
|
"@avocado/entity": "^3.0.0",
|
||||||
"@avocado/math": "^2.0.0",
|
"@avocado/math": "^3.0.0",
|
||||||
"@avocado/persea": "^1.0.0",
|
"@avocado/react": "^3.0.0",
|
||||||
"@avocado/resource": "^2.0.0",
|
"@avocado/resource": "^3.0.0",
|
||||||
"@avocado/traits": "^2.0.0",
|
"@avocado/resource-persea": "^3.0.0",
|
||||||
"@latus/core": "^2.0.0",
|
"@avocado/traits": "^3.0.0",
|
||||||
"@latus/react": "^2.0.0",
|
"@flecks/core": "^1.3.0",
|
||||||
"@latus/socket": "^2.0.0",
|
"@flecks/react": "^1.3.0",
|
||||||
"autoprefixer": "^9.8.6",
|
"@flecks/socket": "^1.3.0",
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
"lodash.flatten": "^4.4.0"
|
"lodash.flatten": "^4.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x",
|
"@flecks/fleck": "^1.3.0",
|
||||||
"source-map-support": "0.5.19"
|
"@flecks/http": "^1.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import {Class, gather, gatherWithLatus} from '@latus/core';
|
import {Class, Flecks, Hooks} from '@flecks/core';
|
||||||
import flatten from 'lodash.flatten';
|
import flatten from 'lodash.flatten';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
[Hooks]: {
|
||||||
'@avocado/traits/traits': gatherWithLatus(
|
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
|
||||||
require.context('./traits', false, /\.js$/),
|
'@humus/combat.affinities': () => ({
|
||||||
),
|
|
||||||
'@humus/combat/affinities': () => ({
|
|
||||||
Void: Class,
|
Void: Class,
|
||||||
Bio: Class,
|
Bio: Class,
|
||||||
Stone: Class,
|
Stone: Class,
|
||||||
|
@ -17,18 +15,13 @@ export default {
|
||||||
Fire: Class,
|
Fire: Class,
|
||||||
Water: Class,
|
Water: Class,
|
||||||
}),
|
}),
|
||||||
'@humus/combat/interactions': () => {
|
'@humus/combat.interactions': () => {
|
||||||
const context = require.context('./interactions', false, /from-.*-to.*\.js$/);
|
const context = require.context('./interactions', false, /from-.*-to.*\.js$/);
|
||||||
return context.keys().map((path) => context(path).default);
|
return context.keys().map((path) => context(path).default);
|
||||||
},
|
},
|
||||||
'@latus/core/starting': (latus) => {
|
'@flecks/core.starting': (flecks) => {
|
||||||
latus.set('%affinities', gather(
|
flecks.set('$humus/combat.affinities', flecks.gather('@humus/combat.affinities'));
|
||||||
latus,
|
const interactions = flatten(flecks.invokeFlat('@humus/combat.interactions'))
|
||||||
{
|
|
||||||
type: '@humus/combat/affinities',
|
|
||||||
},
|
|
||||||
));
|
|
||||||
const interactions = flatten(latus.invokeFlat('@humus/combat/interactions'))
|
|
||||||
.reduce(
|
.reduce(
|
||||||
(r, interaction) => {
|
(r, interaction) => {
|
||||||
const {harming, harmed} = interaction;
|
const {harming, harmed} = interaction;
|
||||||
|
@ -45,13 +38,11 @@ export default {
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
latus.set(
|
flecks.set(
|
||||||
'%interactions',
|
'$humus/combat.interactions',
|
||||||
(harmingAffinity, harmedAffinity) => interactions[harmingAffinity]?.[harmedAffinity] || [],
|
(harmingAffinity, harmedAffinity) => interactions[harmingAffinity]?.[harmedAffinity] || [],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'@latus/socket/packets': gatherWithLatus(
|
'@flecks/socket.packets': Flecks.provide(require.context('./packets', false, /\.js$/)),
|
||||||
require.context('./packets', false, /\.js$/),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import {Vector} from '@avocado/math';
|
import {Vector} from '@avocado/math';
|
||||||
import {Packet} from '@latus/socket';
|
import {Packet} from '@flecks/socket';
|
||||||
|
|
||||||
export default (latus) => class HarmPacket extends Packet {
|
export default (flecks) => class HarmPacket extends Packet {
|
||||||
|
|
||||||
static pack(harms) {
|
static pack(harms) {
|
||||||
const Affinities = latus.get('%affinities');
|
const Affinities = flecks.get('$humus/combat.affinities');
|
||||||
return harms.map((harm) => {
|
return harms.map((harm) => {
|
||||||
const {[harm.affinity]: Affinity} = Affinities;
|
const {[harm.affinity]: Affinity} = Affinities;
|
||||||
harm.affinity = Affinity.id;
|
harm.affinity = Affinity.id;
|
||||||
|
@ -27,7 +27,7 @@ export default (latus) => class HarmPacket extends Packet {
|
||||||
}
|
}
|
||||||
|
|
||||||
static unpack(harms) {
|
static unpack(harms) {
|
||||||
const Affinities = latus.get('%affinities');
|
const Affinities = flecks.get('$humus/combat.affinities');
|
||||||
return harms.map((harm) => {
|
return harms.map((harm) => {
|
||||||
const {[harm.affinity]: Affinity} = Affinities;
|
const {[harm.affinity]: Affinity} = Affinities;
|
||||||
harm.affinity = Affinity.type;
|
harm.affinity = Affinity.type;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import {gatherComponents} from '@latus/react';
|
import {Hooks, Flecks} from '@flecks/react';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
[Hooks]: {
|
||||||
'@avocado/traits/components': gatherComponents(
|
'@avocado/traits-persea.components': (
|
||||||
require.context('./traits', false, /\.jsx$/),
|
Flecks.provide(require.context('./traits', false, /\.jsx$/))
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {Code} from '@avocado/persea';
|
import {Code} from '@avocado/react';
|
||||||
import {useJsonPatcher} from '@avocado/resource/persea';
|
import {useJsonPatcher} from '@avocado/resource-persea';
|
||||||
import {
|
import {
|
||||||
hot,
|
hot,
|
||||||
PropTypes,
|
PropTypes,
|
||||||
React,
|
React,
|
||||||
} from '@latus/react';
|
} from '@flecks/react';
|
||||||
|
|
||||||
const Harmful = ({json, path}) => {
|
const Harmful = ({json, path}) => {
|
||||||
const patch = useJsonPatcher();
|
const patch = useJsonPatcher();
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {Vector} from '@avocado/math';
|
import {Vector} from '@avocado/math';
|
||||||
import {StateProperty, Trait} from '@avocado/traits';
|
import {StateProperty, Trait} from '@avocado/traits';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
StateProperty('isHarmful'),
|
StateProperty('isHarmful'),
|
||||||
);
|
);
|
||||||
|
|
||||||
export default (latus) => class Harmful extends decorate(Trait) {
|
export default (flecks) => class Harmful extends decorate(Trait) {
|
||||||
|
|
||||||
#harmSpecs = [];
|
#harmSpecs = [];
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ export default (latus) => class Harmful extends decorate(Trait) {
|
||||||
listeners() {
|
listeners() {
|
||||||
const listeners = {
|
const listeners = {
|
||||||
harming: async (harm, harmed) => {
|
harming: async (harm, harmed) => {
|
||||||
const {Script} = latus.get('%resources');
|
const {Script} = flecks.get('$avocado/resource.resources');
|
||||||
this.entity.addTickingPromise(Script.loadTickingPromise(this.params.harmingScript, {
|
this.entity.addTickingPromise(Script.loadTickingPromise(this.params.harmingScript, {
|
||||||
...this.entity.contextOrDefault,
|
...this.entity.contextOrDefault,
|
||||||
harm,
|
harm,
|
||||||
|
@ -147,7 +147,7 @@ export default (latus) => class Harmful extends decorate(Trait) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tick() {
|
tick() {
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
if (this.entity.is('Collider')) {
|
if (this.entity.is('Collider')) {
|
||||||
const {isCollidingWith} = this.entity;
|
const {isCollidingWith} = this.entity;
|
||||||
for (let i = 0; i < isCollidingWith.length; i++) {
|
for (let i = 0; i < isCollidingWith.length; i++) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Trait} from '@avocado/traits';
|
import {Trait} from '@avocado/traits';
|
||||||
import flatten from 'lodash.flatten';
|
import flatten from 'lodash.flatten';
|
||||||
|
|
||||||
export default (latus) => class Vulnerable extends Trait {
|
export default (flecks) => class Vulnerable extends Trait {
|
||||||
|
|
||||||
#harms = [];
|
#harms = [];
|
||||||
|
|
||||||
|
@ -204,9 +204,9 @@ export default (latus) => class Vulnerable extends Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
interactions(harmed, harm) {
|
interactions(harmed, harm) {
|
||||||
const {Script} = latus.get('%resources');
|
const {Script} = flecks.get('$avocado/resource.resources');
|
||||||
const {affinity, from} = harm;
|
const {affinity, from} = harm;
|
||||||
const interactions = latus.get('%interactions');
|
const interactions = flecks.get('$humus/combat.interactions');
|
||||||
flatten(
|
flatten(
|
||||||
harmed.affinities()
|
harmed.affinities()
|
||||||
.map((harmedAffinity) => interactions(affinity, harmedAffinity)),
|
.map((harmedAffinity) => interactions(affinity, harmedAffinity)),
|
||||||
|
@ -284,7 +284,7 @@ export default (latus) => class Vulnerable extends Trait {
|
||||||
},
|
},
|
||||||
|
|
||||||
harmed: async (harm, from) => {
|
harmed: async (harm, from) => {
|
||||||
const {Script} = latus.get('%resources');
|
const {Script} = flecks.get('$avocado/resource.resources');
|
||||||
const script = await Script.load(this.params.harmedScript, {
|
const script = await Script.load(this.params.harmedScript, {
|
||||||
entity: this.entity,
|
entity: this.entity,
|
||||||
from,
|
from,
|
||||||
|
@ -298,7 +298,7 @@ export default (latus) => class Vulnerable extends Trait {
|
||||||
},
|
},
|
||||||
|
|
||||||
tookHarm: (harm) => {
|
tookHarm: (harm) => {
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
this.#harms.push(harm);
|
this.#harms.push(harm);
|
||||||
this.interactions(this.entity, harm);
|
this.interactions(this.entity, harm);
|
||||||
this.markAsDirty();
|
this.markAsDirty();
|
||||||
|
@ -375,7 +375,7 @@ export default (latus) => class Vulnerable extends Trait {
|
||||||
this.#interactionTickers[i].tick(elapsed);
|
this.#interactionTickers[i].tick(elapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
const it = this.#locks.keys();
|
const it = this.#locks.keys();
|
||||||
for (let current = it.next(); current.done !== true; current = it.next()) {
|
for (let current = it.next(); current.done !== true; current = it.next()) {
|
||||||
const {value: key} = current;
|
const {value: key} = current;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
import {expect} from 'chai';
|
|
||||||
|
|
||||||
const {name} = require('../package.json');
|
|
||||||
|
|
||||||
describe(name, () => {
|
|
||||||
it('exists', () => {
|
|
||||||
expect(true).to.be.true;
|
|
||||||
})
|
|
||||||
});
|
|
File diff suppressed because it is too large
Load Diff
122
packages/core/.gitignore
vendored
122
packages/core/.gitignore
vendored
|
@ -1,6 +1,116 @@
|
||||||
**/*.js
|
# Logs
|
||||||
**/*.map
|
logs
|
||||||
/assets
|
*.log
|
||||||
!/.*
|
npm-debug.log*
|
||||||
!src/**/*.js
|
yarn-debug.log*
|
||||||
!/test/**/*.js
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
6
packages/core/build/flecks.yml
Normal file
6
packages/core/build/flecks.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
'@flecks/core': {}
|
||||||
|
'@flecks/fleck': {}
|
||||||
|
'@flecks/http': {}
|
||||||
|
'@flecks/http/server':
|
||||||
|
build: false
|
||||||
|
'@flecks/react': {}
|
|
@ -1,44 +1,53 @@
|
||||||
{
|
{
|
||||||
"name": "@humus/core",
|
"name": "@humus/core",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/core"
|
||||||
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "cha0s",
|
"author": "cha0s",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "latus-build",
|
"build": "flecks build",
|
||||||
"clean": "latus-build clean",
|
"clean": "flecks clean",
|
||||||
"fp": "latus-build forcepublish",
|
"lint": "flecks lint",
|
||||||
"lint": "latus-build lint",
|
"postversion": "cp package.json dist",
|
||||||
"test": "latus-build test"
|
"test": "flecks test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"build",
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map",
|
"index.js.map",
|
||||||
"persea.js",
|
"persea.js",
|
||||||
"persea.js.map",
|
"persea.js.map",
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
"test.js",
|
"test.js",
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@avocado/behavior": "^2.0.0",
|
"@avocado/behavior": "^3.0.0",
|
||||||
"@avocado/core": "^2.0.0",
|
"@avocado/core": "^3.0.0",
|
||||||
"@avocado/entity": "^2.0.0",
|
"@avocado/entity": "^3.0.0",
|
||||||
"@avocado/graphics": "^2.0.0",
|
"@avocado/graphics": "^3.0.0",
|
||||||
"@avocado/math": "^2.0.0",
|
"@avocado/math": "^3.0.0",
|
||||||
"@avocado/persea": "^1.0.0",
|
"@avocado/react": "^3.0.0",
|
||||||
"@avocado/resource": "^2.0.0",
|
"@avocado/resource": "^3.0.0",
|
||||||
"@avocado/s13n": "^2.0.0",
|
"@avocado/resource-persea": "^3.0.0",
|
||||||
"@avocado/traits": "^2.0.0",
|
"@avocado/s13n": "^3.0.0",
|
||||||
"@humus/scss": "^1.0.0",
|
"@avocado/traits": "^3.0.0",
|
||||||
"@latus/core": "^2.0.0",
|
"@flecks/core": "^1.3.0",
|
||||||
"@latus/react": "^2.0.0",
|
"@flecks/react": "^1.3.0",
|
||||||
"@latus/redux": "^2.0.0",
|
"@flecks/redux": "^1.3.0",
|
||||||
"@latus/socket": "^2.0.0",
|
"@flecks/socket": "^1.3.0",
|
||||||
"@latus/user": "^2.0.0",
|
"@flecks/user": "^1.3.0",
|
||||||
"debug": "4.3.1",
|
"@humus/scss": "^2.0.0",
|
||||||
"msgpack-lite": "^0.1.26"
|
"debug": "4.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x"
|
"@flecks/fleck": "^1.3.0",
|
||||||
|
"@flecks/http": "^1.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import {gatherWithLatus} from '@latus/core';
|
import {Flecks, Hooks} from '@flecks/core';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
[Hooks]: {
|
||||||
'@avocado/traits/traits': gatherWithLatus(
|
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
|
||||||
require.context('./traits', false, /\.js$/),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {gatherComponents} from '@latus/react';
|
import {gatherComponents} from '@flecks/react';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
hooks: {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {join} from 'path';
|
import {join} from 'path';
|
||||||
|
|
||||||
import {Code, Number} from '@avocado/persea';
|
import {Code, Number} from '@avocado/react';
|
||||||
import {useJsonPatcher} from '@avocado/resource/persea';
|
import {useJsonPatcher} from '@avocado/resource-persea';
|
||||||
import {
|
import {
|
||||||
hot,
|
hot,
|
||||||
PropTypes,
|
PropTypes,
|
||||||
React,
|
React,
|
||||||
} from '@latus/react';
|
} from '@flecks/react';
|
||||||
|
|
||||||
const Item = ({json, path}) => {
|
const Item = ({json, path}) => {
|
||||||
const patch = useJsonPatcher();
|
const patch = useJsonPatcher();
|
||||||
|
|
|
@ -10,11 +10,11 @@ export default () => class Darkened extends Trait {
|
||||||
|
|
||||||
async load(json) {
|
async load(json) {
|
||||||
await super.load(json);
|
await super.load(json);
|
||||||
this._isDarkened = this.params.isDarkened;
|
this.$$isDarkened = this.params.isDarkened;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isDarkened() {
|
get isDarkened() {
|
||||||
return this._isDarkened;
|
return this.$$isDarkened;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,11 +4,11 @@ import {Rectangle, Vector} from '@avocado/math';
|
||||||
import {Resource} from '@avocado/resource';
|
import {Resource} from '@avocado/resource';
|
||||||
import {Synchronized} from '@avocado/s13n';
|
import {Synchronized} from '@avocado/s13n';
|
||||||
import {Trait} from '@avocado/traits';
|
import {Trait} from '@avocado/traits';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
export default (latus) => {
|
export default (flecks) => {
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
Synchronized(latus),
|
Synchronized(flecks),
|
||||||
);
|
);
|
||||||
class Synchronizer extends decorate(Resource) {}
|
class Synchronizer extends decorate(Resource) {}
|
||||||
return class Informed extends Trait {
|
return class Informed extends Trait {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Property, TickingPromise} from '@avocado/core';
|
import {Property, TickingPromise} from '@avocado/core';
|
||||||
import {StateProperty, Trait} from '@avocado/traits';
|
import {StateProperty, Trait} from '@avocado/traits';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
Property('wielder', {
|
Property('wielder', {
|
||||||
|
@ -14,7 +14,7 @@ const decorate = compose(
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export default (latus) => class Item extends decorate(Trait) {
|
export default (flecks) => class Item extends decorate(Trait) {
|
||||||
|
|
||||||
static defaultParams() {
|
static defaultParams() {
|
||||||
return {
|
return {
|
||||||
|
@ -74,7 +74,7 @@ export default (latus) => class Item extends decorate(Trait) {
|
||||||
|
|
||||||
use: () => {
|
use: () => {
|
||||||
const {cooldown} = this.params;
|
const {cooldown} = this.params;
|
||||||
const {Script} = latus.get('%resources');
|
const {Script} = flecks.get('$avocado/resource.resources');
|
||||||
const promises = [Script.loadTickingPromise(this.params.useScript, this.entity.context)];
|
const promises = [Script.loadTickingPromise(this.params.useScript, this.entity.context)];
|
||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
promises.push(new Promise((resolve) => {
|
promises.push(new Promise((resolve) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {StateProperty, Trait} from '@avocado/traits';
|
import {StateProperty, Trait} from '@avocado/traits';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
StateProperty('lootable', {
|
StateProperty('lootable', {
|
||||||
|
@ -98,7 +98,7 @@ export default () => class Lootable extends decorate(Trait) {
|
||||||
|
|
||||||
hooks() {
|
hooks() {
|
||||||
const hooks = {};
|
const hooks = {};
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
let isDying = false;
|
let isDying = false;
|
||||||
hooks.destroy = () => () => {
|
hooks.destroy = () => () => {
|
||||||
if (isDying) {
|
if (isDying) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {StateProperty, Trait} from '@avocado/traits';
|
import {StateProperty, Trait} from '@avocado/traits';
|
||||||
import {Rectangle, Vector} from '@avocado/math';
|
import {Rectangle, Vector} from '@avocado/math';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
StateProperty('attraction', {
|
StateProperty('attraction', {
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
import {expect} from 'chai';
|
|
||||||
|
|
||||||
const {name} = require('../package.json');
|
|
||||||
|
|
||||||
describe(name, () => {
|
|
||||||
it('exists', () => {
|
|
||||||
expect(true).to.be.true;
|
|
||||||
})
|
|
||||||
});
|
|
File diff suppressed because it is too large
Load Diff
122
packages/farm/.gitignore
vendored
122
packages/farm/.gitignore
vendored
|
@ -1,6 +1,116 @@
|
||||||
**/*.js
|
# Logs
|
||||||
**/*.map
|
logs
|
||||||
/assets
|
*.log
|
||||||
!/.*
|
npm-debug.log*
|
||||||
!src/**/*.js
|
yarn-debug.log*
|
||||||
!/test/**/*.js
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
|
@ -1,35 +1,42 @@
|
||||||
{
|
{
|
||||||
"name": "@humus/farm",
|
"name": "@humus/farm",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/farm"
|
||||||
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "cha0s",
|
"author": "cha0s",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "latus-build",
|
"build": "flecks build",
|
||||||
"clean": "latus-build clean",
|
"clean": "flecks clean",
|
||||||
"fp": "latus-build forcepublish",
|
"lint": "flecks lint",
|
||||||
"lint": "latus-build lint",
|
"postversion": "cp package.json dist",
|
||||||
"test": "latus-build test"
|
"test": "flecks test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"build",
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map",
|
"index.js.map",
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
"test.js",
|
"test.js",
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@avocado/behavior": "^2.0.0",
|
"@avocado/behavior": "^3.0.0",
|
||||||
"@avocado/core": "^2.0.0",
|
"@avocado/core": "^3.0.0",
|
||||||
"@avocado/graphics": "^2.0.0",
|
"@avocado/graphics": "^3.0.0",
|
||||||
"@avocado/math": "^2.0.0",
|
"@avocado/math": "^3.0.0",
|
||||||
"@avocado/timing": "^2.0.0",
|
"@avocado/timing": "^3.0.0",
|
||||||
"@avocado/traits": "^2.0.0",
|
"@avocado/traits": "^3.0.0",
|
||||||
"@latus/core": "^2.0.0",
|
"@flecks/core": "^1.3.0",
|
||||||
"@latus/socket": "^2.0.0",
|
"@flecks/socket": "^1.3.0",
|
||||||
"debug": "4.3.1"
|
"debug": "4.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x",
|
"@flecks/fleck": "^1.3.0"
|
||||||
"source-map-support": "0.5.19"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
import {decorateWithLatus, gatherWithLatus} from '@latus/core';
|
import {Flecks, Hooks} from '@flecks/core';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
[Hooks]: {
|
||||||
'@avocado/resource/resources.decorate': decorateWithLatus(
|
'@avocado/resource.resources.decorate': (
|
||||||
require.context('./resources/decorators', false, /\.js$/),
|
Flecks.decorate(require.context('./resources/decorators', false, /\.js$/))
|
||||||
),
|
|
||||||
'@avocado/traits/traits': gatherWithLatus(
|
|
||||||
require.context('./traits', false, /\.js$/),
|
|
||||||
),
|
|
||||||
'@latus/socket/packets': gatherWithLatus(
|
|
||||||
require.context('./packets', false, /\.js$/),
|
|
||||||
),
|
),
|
||||||
|
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
|
||||||
|
'@flecks/socket.packets': Flecks.provide(require.context('./packets', false, /\.js$/)),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Packet} from '@latus/socket';
|
import {Packet} from '@flecks/socket';
|
||||||
|
|
||||||
export default () => class RoomWaterPacket extends Packet {
|
export default () => class RoomWaterPacket extends Packet {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Packet} from '@latus/socket';
|
import {Packet} from '@flecks/socket';
|
||||||
|
|
||||||
export default () => class TraitUpdatePlantPacket extends Packet {
|
export default () => class TraitUpdatePlantPacket extends Packet {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default (Room) => class FarmableRoom extends Room {
|
||||||
adjustWaterAt(target, increase) {
|
adjustWaterAt(target, increase) {
|
||||||
const tiles = this.tiles[1];
|
const tiles = this.tiles[1];
|
||||||
if (
|
if (
|
||||||
'client' === process.env.SIDE
|
'http' === process.env.FLECKS_CORE_BUILD_TARGET
|
||||||
|| TILLED !== tiles.tileAt(target)
|
|| TILLED !== tiles.tileAt(target)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
|
@ -98,7 +98,7 @@ export default (Room) => class FarmableRoom extends Room {
|
||||||
const {tileSize} = tiles;
|
const {tileSize} = tiles;
|
||||||
const target = Vector.floor(Vector.div(center, tileSize));
|
const target = Vector.floor(Vector.div(center, tileSize));
|
||||||
return (
|
return (
|
||||||
'client' !== process.env.SIDE
|
'http' !== process.env.FLECKS_CORE_BUILD_TARGET
|
||||||
&& TILLED === tiles.tileAt(target)
|
&& TILLED === tiles.tileAt(target)
|
||||||
&& !this.isPlantAt(center)
|
&& !this.isPlantAt(center)
|
||||||
);
|
);
|
||||||
|
@ -113,7 +113,7 @@ export default (Room) => class FarmableRoom extends Room {
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareSoilAt(target) {
|
prepareSoilAt(target) {
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
const tiles = this.tiles[1];
|
const tiles = this.tiles[1];
|
||||||
tiles.setTileAt(target, TILLED);
|
tiles.setTileAt(target, TILLED);
|
||||||
this.adjustWaterAt(target, 0);
|
this.adjustWaterAt(target, 0);
|
||||||
|
@ -130,7 +130,7 @@ export default (Room) => class FarmableRoom extends Room {
|
||||||
}
|
}
|
||||||
|
|
||||||
tickWater(elapsed) {
|
tickWater(elapsed) {
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const water = Object.entries(this.water);
|
const water = Object.entries(this.water);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {spontaneous, Vector} from '@avocado/math';
|
import {spontaneous, Vector} from '@avocado/math';
|
||||||
import {StateProperty, Trait} from '@avocado/traits';
|
import {StateProperty, Trait} from '@avocado/traits';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
StateProperty('growthStage', {
|
StateProperty('growthStage', {
|
||||||
|
@ -8,7 +8,7 @@ const decorate = compose(
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export default (latus) => class Plant extends decorate(Trait) {
|
export default (flecks) => class Plant extends decorate(Trait) {
|
||||||
|
|
||||||
#growthElapsed = 0;
|
#growthElapsed = 0;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ export default (latus) => class Plant extends decorate(Trait) {
|
||||||
|
|
||||||
async load(json) {
|
async load(json) {
|
||||||
await super.load(json);
|
await super.load(json);
|
||||||
const {Script} = latus.get('%resources');
|
const {Script} = flecks.get('$avocado/resource.resources');
|
||||||
const {growthCheck, growthScript} = this.params;
|
const {growthCheck, growthScript} = this.params;
|
||||||
if (growthCheck) {
|
if (growthCheck) {
|
||||||
this.growthCheck = await Script.load(growthCheck, {
|
this.growthCheck = await Script.load(growthCheck, {
|
||||||
|
@ -108,7 +108,7 @@ export default (latus) => class Plant extends decorate(Trait) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tick(elapsed) {
|
tick(elapsed) {
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const {room} = this.entity;
|
const {room} = this.entity;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {Rectangle, Vector} from '@avocado/math';
|
||||||
import {LfoResult} from '@avocado/timing';
|
import {LfoResult} from '@avocado/timing';
|
||||||
|
|
||||||
// Tools.
|
// Tools.
|
||||||
export default (latus) => class Tool extends Trait {
|
export default (flecks) => class Tool extends Trait {
|
||||||
|
|
||||||
#primitives;
|
#primitives;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ export default (latus) => class Tool extends Trait {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
this.#throbber = {color: 0};
|
this.#throbber = {color: 0};
|
||||||
this.#throbber.lfo = new LfoResult(
|
this.#throbber.lfo = new LfoResult(
|
||||||
this.#throbber,
|
this.#throbber,
|
||||||
|
@ -66,7 +66,7 @@ export default (latus) => class Tool extends Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateTargetTotal() {
|
calculateTargetTotal() {
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
const {wielder} = this.entity;
|
const {wielder} = this.entity;
|
||||||
if (!wielder || !wielder.room) {
|
if (!wielder || !wielder.room) {
|
||||||
return;
|
return;
|
||||||
|
@ -118,7 +118,7 @@ export default (latus) => class Tool extends Trait {
|
||||||
destroy() {
|
destroy() {
|
||||||
const {wielder} = this.entity;
|
const {wielder} = this.entity;
|
||||||
this.onWielderChanged(wielder);
|
this.onWielderChanged(wielder);
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
this.#primitives.destroy();
|
this.#primitives.destroy();
|
||||||
this.#throbber = {};
|
this.#throbber = {};
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ export default (latus) => class Tool extends Trait {
|
||||||
useTool: () => {
|
useTool: () => {
|
||||||
this.calculateTargets();
|
this.calculateTargets();
|
||||||
const promises = this.#targets.map((target) => {
|
const promises = this.#targets.map((target) => {
|
||||||
const {Script} = latus.get('%resources');
|
const {Script} = flecks.get('$avocado/resource.resources');
|
||||||
const context = this.createTargetContext(target);
|
const context = this.createTargetContext(target);
|
||||||
return Script.loadTickingPromise(this.params.toolScript, context);
|
return Script.loadTickingPromise(this.params.toolScript, context);
|
||||||
});
|
});
|
||||||
|
@ -179,7 +179,7 @@ export default (latus) => class Tool extends Trait {
|
||||||
|
|
||||||
onWielderActiveSlotIndexChanged() {
|
onWielderActiveSlotIndexChanged() {
|
||||||
this.calculateTargets();
|
this.calculateTargets();
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
this.#primitives.visible = false;
|
this.#primitives.visible = false;
|
||||||
const {wielder} = this.entity;
|
const {wielder} = this.entity;
|
||||||
if (!wielder || !wielder.container || !wielder.is('Receptacle')) {
|
if (!wielder || !wielder.container || !wielder.is('Receptacle')) {
|
||||||
|
@ -191,13 +191,13 @@ export default (latus) => class Tool extends Trait {
|
||||||
|
|
||||||
onWielderChanged(oldWielder, newWielder) {
|
onWielderChanged(oldWielder, newWielder) {
|
||||||
if (oldWielder && oldWielder.is('Visible')) {
|
if (oldWielder && oldWielder.is('Visible')) {
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
oldWielder.removeRasterSibling(this.#primitives);
|
oldWielder.removeRasterSibling(this.#primitives);
|
||||||
}
|
}
|
||||||
oldWielder.off('activeSlotIndexChanged', this.onWielderActiveSlotIndexChanged);
|
oldWielder.off('activeSlotIndexChanged', this.onWielderActiveSlotIndexChanged);
|
||||||
}
|
}
|
||||||
if (newWielder && newWielder.is('Visible')) {
|
if (newWielder && newWielder.is('Visible')) {
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
newWielder.addRasterSibling(this.#primitives);
|
newWielder.addRasterSibling(this.#primitives);
|
||||||
}
|
}
|
||||||
newWielder.on('activeSlotIndexChanged', this.onWielderActiveSlotIndexChanged, this);
|
newWielder.on('activeSlotIndexChanged', this.onWielderActiveSlotIndexChanged, this);
|
||||||
|
@ -264,7 +264,7 @@ export default (latus) => class Tool extends Trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
repositionPrimitives() {
|
repositionPrimitives() {
|
||||||
if ('client' === process.env.SIDE) {
|
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
const {wielder} = this.entity;
|
const {wielder} = this.entity;
|
||||||
if (!wielder || !wielder.room) {
|
if (!wielder || !wielder.room) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
import {expect} from 'chai';
|
|
||||||
|
|
||||||
const {name} = require('../package.json');
|
|
||||||
|
|
||||||
describe(name, () => {
|
|
||||||
it('exists', () => {
|
|
||||||
expect(true).to.be.true;
|
|
||||||
})
|
|
||||||
});
|
|
File diff suppressed because it is too large
Load Diff
122
packages/inventory/.gitignore
vendored
122
packages/inventory/.gitignore
vendored
|
@ -1,6 +1,116 @@
|
||||||
**/*.js
|
# Logs
|
||||||
**/*.map
|
logs
|
||||||
/assets
|
*.log
|
||||||
!/.*
|
npm-debug.log*
|
||||||
!src/**/*.js
|
yarn-debug.log*
|
||||||
!/test/**/*.js
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
|
@ -1,33 +1,39 @@
|
||||||
{
|
{
|
||||||
"name": "@humus/inventory",
|
"name": "@humus/inventory",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/inventory"
|
||||||
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "cha0s",
|
"author": "cha0s",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "latus-build",
|
"build": "flecks build",
|
||||||
"clean": "latus-build clean",
|
"clean": "flecks clean",
|
||||||
"fp": "latus-build forcepublish",
|
"lint": "flecks lint",
|
||||||
"lint": "latus-build lint",
|
"postversion": "cp package.json dist",
|
||||||
"test": "latus-build test"
|
"test": "flecks test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"build",
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map",
|
"index.js.map",
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
"test.js",
|
"test.js",
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@avocado/behavior": "^2.0.0",
|
"@avocado/behavior": "^3.0.0",
|
||||||
"@avocado/traits": "^2.0.0",
|
"@avocado/traits": "^3.0.0",
|
||||||
"@latus/core": "^2.0.0",
|
"@flecks/core": "^1.3.0",
|
||||||
"@latus/react": "^2.0.0",
|
"@flecks/react": "^1.3.0",
|
||||||
"@latus/socket": "^2.0.0",
|
"@flecks/socket": "^1.3.0",
|
||||||
"autoprefixer": "^9.8.6",
|
|
||||||
"debug": "4.3.1"
|
"debug": "4.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x",
|
"@flecks/fleck": "^1.3.0"
|
||||||
"source-map-support": "0.5.19"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {
|
||||||
useCallback,
|
useCallback,
|
||||||
useEvent,
|
useEvent,
|
||||||
useState,
|
useState,
|
||||||
} from '@latus/react';
|
} from '@flecks/react';
|
||||||
|
|
||||||
export default function useInventorySlice(selfEntity, start, end) {
|
export default function useInventorySlice(selfEntity, start, end) {
|
||||||
const [slice, setSlice] = useState([]);
|
const [slice, setSlice] = useState([]);
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
import {gatherWithLatus} from '@latus/core';
|
import {Hooks, Flecks} from '@flecks/core';
|
||||||
|
|
||||||
export * from './hooks';
|
export * from './hooks';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
[Hooks]: {
|
||||||
'@avocado/traits/traits': gatherWithLatus(
|
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
|
||||||
require.context('./traits', false, /\.js$/),
|
'@flecks/socket.packets': Flecks.provide(require.context('./packets', false, /\.js$/)),
|
||||||
),
|
|
||||||
'@latus/socket/packets': gatherWithLatus(
|
|
||||||
require.context('./packets', false, /\.js$/),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
import {Packer, Packet} from '@latus/socket';
|
import {Packer, Packet} from '@flecks/socket';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
Packer('json'),
|
Packer('json'),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Packet} from '@latus/socket';
|
import {Packet} from '@flecks/socket';
|
||||||
|
|
||||||
export default () => class TraitUpdateReceptacleItemQtyPacket extends Packet {
|
export default () => class TraitUpdateReceptacleItemQtyPacket extends Packet {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Packet} from '@latus/socket';
|
import {Packet} from '@flecks/socket';
|
||||||
|
|
||||||
export default () => class TraitUpdateReceptacleItemSwapPacket extends Packet {
|
export default () => class TraitUpdateReceptacleItemSwapPacket extends Packet {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {StateProperty, Trait} from '@avocado/traits';
|
import {StateProperty, Trait} from '@avocado/traits';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
StateProperty('slotCount', {
|
StateProperty('slotCount', {
|
||||||
|
@ -11,7 +11,7 @@ const NULL_SLOT = 65535;
|
||||||
const AUTO_SLOT = 65535;
|
const AUTO_SLOT = 65535;
|
||||||
|
|
||||||
// TODO more localized events; inventoryChanged is too noisy
|
// TODO more localized events; inventoryChanged is too noisy
|
||||||
export default (latus) => class Receptacle extends decorate(Trait) {
|
export default (flecks) => class Receptacle extends decorate(Trait) {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -66,7 +66,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'TraitUpdateReceptacleItemFull': {
|
case 'TraitUpdateReceptacleItemFull': {
|
||||||
const {Entity} = latus.get('%resources');
|
const {Entity} = flecks.get('$avocado/resource.resources');
|
||||||
this.entity.addItemToSlot(await Entity.load(packet.data.json), packet.data.slotIndex);
|
this.entity.addItemToSlot(await Entity.load(packet.data.json), packet.data.slotIndex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
|
||||||
this.addListenersForItem(item);
|
this.addListenersForItem(item);
|
||||||
this.slotItems[slotNumber] = item;
|
this.slotItems[slotNumber] = item;
|
||||||
this.entity.emit('itemAdded', item, slotNumber);
|
this.entity.emit('itemAdded', item, slotNumber);
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
this.packetUpdates.push([
|
this.packetUpdates.push([
|
||||||
'TraitUpdateReceptacleItemFull',
|
'TraitUpdateReceptacleItemFull',
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
|
||||||
|
|
||||||
addListenersForItem(item) {
|
addListenersForItem(item) {
|
||||||
const listener = (oldQty, newQty) => {
|
const listener = (oldQty, newQty) => {
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
const slotIndex = this.itemSlotIndex(item);
|
const slotIndex = this.itemSlotIndex(item);
|
||||||
// Valid quantity; update client.
|
// Valid quantity; update client.
|
||||||
if (newQty > 0) {
|
if (newQty > 0) {
|
||||||
|
@ -193,7 +193,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
|
||||||
|
|
||||||
listeners() {
|
listeners() {
|
||||||
const listeners = {};
|
const listeners = {};
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
listeners.collisionStart = (other) => {
|
listeners.collisionStart = (other) => {
|
||||||
if (other.is('Item')) {
|
if (other.is('Item')) {
|
||||||
other.list?.removeEntity(other);
|
other.list?.removeEntity(other);
|
||||||
|
@ -206,7 +206,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async load(json) {
|
async load(json) {
|
||||||
const {Entity} = latus.get('%resources');
|
const {Entity} = flecks.get('$avocado/resource.resources');
|
||||||
await super.load(json);
|
await super.load(json);
|
||||||
await Promise.all(Object.entries(this.params.slots).map(async ([slotIndex, slotSpec]) => {
|
await Promise.all(Object.entries(this.params.slots).map(async ([slotIndex, slotSpec]) => {
|
||||||
const item = await Entity.load({extends: slotSpec.extends});
|
const item = await Entity.load({extends: slotSpec.extends});
|
||||||
|
@ -245,7 +245,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
|
||||||
this.removeListenersForItem(item);
|
this.removeListenersForItem(item);
|
||||||
delete this.slotItems[slotIndex];
|
delete this.slotItems[slotIndex];
|
||||||
this.entity.emit('itemRemoved', item, slotIndex);
|
this.entity.emit('itemRemoved', item, slotIndex);
|
||||||
if ('client' !== process.env.SIDE) {
|
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
|
||||||
this.packetUpdates.push([
|
this.packetUpdates.push([
|
||||||
'TraitUpdateReceptacleItemSwap',
|
'TraitUpdateReceptacleItemSwap',
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {StateProperty, Trait} from '@avocado/traits';
|
import {StateProperty, Trait} from '@avocado/traits';
|
||||||
import {compose} from '@latus/core';
|
import {compose} from '@flecks/core';
|
||||||
|
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
StateProperty('activeSlotIndex', {
|
StateProperty('activeSlotIndex', {
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
import {expect} from 'chai';
|
|
||||||
|
|
||||||
const {name} = require('../package.json');
|
|
||||||
|
|
||||||
describe(name, () => {
|
|
||||||
it('exists', () => {
|
|
||||||
expect(true).to.be.true;
|
|
||||||
})
|
|
||||||
});
|
|
File diff suppressed because it is too large
Load Diff
125
packages/scss/.gitignore
vendored
125
packages/scss/.gitignore
vendored
|
@ -1,9 +1,116 @@
|
||||||
**/*.js
|
# Logs
|
||||||
**/*.map
|
logs
|
||||||
/assets
|
*.log
|
||||||
!/.*
|
npm-debug.log*
|
||||||
!/postcss.config.js
|
yarn-debug.log*
|
||||||
!/webpack.config.js
|
yarn-error.log*
|
||||||
!src/**/*.js
|
lerna-debug.log*
|
||||||
!/test/**/*.js
|
|
||||||
/*.scss
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
const copy = require('@neutrinojs/copy');
|
|
||||||
|
|
||||||
module.exports = require('@latus/build/build/.neutrinorc.js');
|
|
||||||
|
|
||||||
module.exports.use.push(
|
|
||||||
copy({
|
|
||||||
patterns: [{
|
|
||||||
from: 'scss',
|
|
||||||
to: '.',
|
|
||||||
}],
|
|
||||||
}),
|
|
||||||
);
|
|
32
packages/scss/build/fleck.neutrinorc.js
Normal file
32
packages/scss/build/fleck.neutrinorc.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
|
const copy = require('@neutrinojs/copy');
|
||||||
|
|
||||||
|
module.exports = (async () => {
|
||||||
|
// eslint-disable-next-line import/no-extraneous-dependencies, global-require
|
||||||
|
const config = await require('@flecks/fleck/server/build/fleck.neutrinorc');
|
||||||
|
config.use.push(({config}) => {
|
||||||
|
config.entryPoints.delete('colors');
|
||||||
|
config.entryPoints.delete('graphics');
|
||||||
|
config.entryPoints.delete('reset');
|
||||||
|
});
|
||||||
|
config.use.push(
|
||||||
|
copy({
|
||||||
|
copyUnmodified: true,
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: 'src/colors.scss',
|
||||||
|
to: 'colors.scss',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'src/graphics.scss',
|
||||||
|
to: 'graphics.scss',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'src/reset.scss',
|
||||||
|
to: 'reset.scss',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return config;
|
||||||
|
})();
|
|
@ -1,26 +1,36 @@
|
||||||
{
|
{
|
||||||
"name": "@humus/scss",
|
"name": "@humus/scss",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/scss"
|
||||||
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "latus-build",
|
"build": "flecks build",
|
||||||
"clean": "latus-build clean",
|
"clean": "flecks clean",
|
||||||
"fp": "latus-build forcepublish",
|
"lint": "flecks lint",
|
||||||
"lint": "latus-build lint",
|
"postversion": "cp package.json dist",
|
||||||
"test": "latus-build test"
|
"test": "flecks test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"build",
|
||||||
"colors.scss",
|
"colors.scss",
|
||||||
"graphics.scss",
|
"graphics.scss",
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map",
|
"index.js.map",
|
||||||
"reset.scss",
|
"reset.scss",
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
"test.js",
|
"test.js",
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {},
|
"dependencies": {
|
||||||
|
"@flecks/core": "^1.3.0"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x",
|
"@flecks/fleck": "^1.3.0",
|
||||||
"@neutrinojs/copy": "^9.5.0"
|
"@neutrinojs/copy": "^9.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
// ...
|
|
@ -1,5 +0,0 @@
|
||||||
import {expect} from 'chai';
|
|
||||||
|
|
||||||
it('exists', () => {
|
|
||||||
expect(true).to.be.true;
|
|
||||||
});
|
|
File diff suppressed because it is too large
Load Diff
122
packages/universe/.gitignore
vendored
122
packages/universe/.gitignore
vendored
|
@ -1,6 +1,116 @@
|
||||||
**/*.js
|
# Logs
|
||||||
**/*.map
|
logs
|
||||||
/assets
|
*.log
|
||||||
!/.*
|
npm-debug.log*
|
||||||
!src/**/*.js
|
yarn-debug.log*
|
||||||
!/test/**/*.js
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
|
|
6
packages/universe/build/flecks.yml
Normal file
6
packages/universe/build/flecks.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
'@flecks/core': {}
|
||||||
|
'@flecks/fleck': {}
|
||||||
|
'@flecks/http': {}
|
||||||
|
'@flecks/http/server':
|
||||||
|
build: false
|
||||||
|
'@flecks/react': {}
|
|
@ -1,51 +1,57 @@
|
||||||
{
|
{
|
||||||
"name": "@humus/universe",
|
"name": "@humus/universe",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
|
||||||
|
"directory": "packages/universe"
|
||||||
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "cha0s",
|
"author": "cha0s",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "latus-build",
|
"build": "flecks build",
|
||||||
"clean": "latus-build clean",
|
"clean": "flecks clean",
|
||||||
"fp": "latus-build forcepublish",
|
"lint": "flecks lint",
|
||||||
"lint": "latus-build lint",
|
"postversion": "cp package.json dist",
|
||||||
"test": "latus-build test"
|
"test": "flecks test"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"build",
|
||||||
"client.js",
|
"client.js",
|
||||||
"client.js.map",
|
"client.js.map",
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map",
|
"index.js.map",
|
||||||
"server.js",
|
"server.js",
|
||||||
"server.js.map",
|
"server.js.map",
|
||||||
|
"src",
|
||||||
|
"test",
|
||||||
"test.js",
|
"test.js",
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@avocado/graphics": "^2.0.0",
|
"@avocado/graphics": "^3.0.0",
|
||||||
"@avocado/input": "^2.0.0",
|
"@avocado/input": "^3.0.0",
|
||||||
"@avocado/math": "^2.0.0",
|
"@avocado/math": "^3.0.0",
|
||||||
"@avocado/react": "^1.0.0",
|
"@avocado/react": "^3.0.0",
|
||||||
"@avocado/resource": "^2.0.0",
|
"@avocado/resource": "^3.0.0",
|
||||||
"@avocado/s13n": "^2.0.0",
|
"@avocado/s13n": "^3.0.0",
|
||||||
"@avocado/timing": "^2.0.0",
|
"@avocado/timing": "^3.0.0",
|
||||||
"@avocado/topdown": "^2.0.0",
|
"@avocado/topdown": "^3.0.0",
|
||||||
"@avocado/traits": "^2.0.0",
|
"@avocado/traits": "^3.0.0",
|
||||||
"@humus/app": "^1.0.0",
|
"@flecks/core": "^1.3.0",
|
||||||
"@humus/inventory": "^1.0.0",
|
"@flecks/react": "^1.3.0",
|
||||||
"@humus/scss": "^1.0.0",
|
"@flecks/redux": "^1.3.0",
|
||||||
"@latus/core": "^2.0.0",
|
"@flecks/socket": "^1.3.0",
|
||||||
"@latus/react": "^2.0.0",
|
"@humus/app": "^2.0.0",
|
||||||
"@latus/redux": "^2.0.0",
|
"@humus/inventory": "^2.0.0",
|
||||||
"@latus/socket": "^2.0.0",
|
"@humus/scss": "^2.0.0",
|
||||||
"classnames": "^2.2.6",
|
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6"
|
||||||
"react-router": "^5.2.0",
|
|
||||||
"react-router-dom": "^5.2.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@latus/build": "1.x"
|
"@flecks/fleck": "^1.3.0",
|
||||||
|
"@flecks/http": "^1.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,19 @@
|
||||||
import {gatherWithLatus} from '@latus/core';
|
import {Hooks} from '@flecks/core';
|
||||||
|
|
||||||
import Receiver from './receiver';
|
import Receiver from './receiver';
|
||||||
import Universe from '../components';
|
import Universe from '../components';
|
||||||
import Title from '../components/title';
|
import Title from '../components/title';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
[Hooks]: {
|
||||||
'@humus/app/components': () => Universe,
|
'@humus/app.components': () => Universe,
|
||||||
'@humus/app/title': () => Title,
|
'@humus/app.title': () => Title,
|
||||||
'@latus/http/client/up': (latus) => {
|
'@flecks/http/client.up': (flecks) => {
|
||||||
window.latus = latus;
|
window.flecks = flecks;
|
||||||
const Synchronizer = Receiver(latus);
|
const Synchronizer = Receiver(flecks);
|
||||||
const synchronizer = new Synchronizer();
|
const synchronizer = new Synchronizer();
|
||||||
latus.set('%synchronizer', synchronizer);
|
flecks.set('$humus/universe.synchronizer', synchronizer);
|
||||||
latus.get('%socket').on('packet', synchronizer.acceptPacket, synchronizer);
|
flecks.get('$flecks/socket.socket').on('packet', synchronizer.acceptPacket, synchronizer);
|
||||||
},
|
},
|
||||||
'@latus/socket/packets': gatherWithLatus(
|
|
||||||
require.context('./packets', false, /\.js$/),
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {Resource} from '@avocado/resource';
|
import {Resource} from '@avocado/resource';
|
||||||
import {Synchronized} from '@avocado/s13n';
|
import {Synchronized} from '@avocado/s13n';
|
||||||
import {compose, EventEmitter} from '@latus/core';
|
import {compose, EventEmitter} from '@flecks/core';
|
||||||
|
|
||||||
export default (latus) => {
|
export default (flecks) => {
|
||||||
const decorate = compose(
|
const decorate = compose(
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Synchronized(latus),
|
Synchronized(flecks),
|
||||||
);
|
);
|
||||||
return class Receiver extends decorate(Resource) {
|
return class Receiver extends decorate(Resource) {
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export default (latus) => {
|
||||||
await super.acceptPacket(packet);
|
await super.acceptPacket(packet);
|
||||||
const {s13nType} = packet;
|
const {s13nType} = packet;
|
||||||
if ('create' === s13nType) {
|
if ('create' === s13nType) {
|
||||||
const {Room} = latus.get('%resources');
|
const {Room} = flecks.get('$avocado/resource.resources');
|
||||||
const {id} = packet.data.synchronized;
|
const {id} = packet.data.synchronized;
|
||||||
this.emit('created', this.synchronized(Room.resourceId, id));
|
this.emit('created', this.synchronized(Room.resourceId, id));
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user