chore: 2.0.0

This commit is contained in:
cha0s 2022-03-13 08:18:14 -05:00
parent db78ad27f4
commit ea798b8af2
127 changed files with 23509 additions and 35881 deletions

3
.gitignore vendored
View File

@ -116,4 +116,5 @@ dist
.pnp.*
# local
/build
/dist
/packages/*/yarn.lock

109
build/flecks.yml Normal file
View 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'

View File

@ -1,6 +0,0 @@
**/*.js
**/*.map
/assets
!/.*
!src/**/*.js
!/test/**/*.js

View File

@ -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"
}
}

View File

@ -1,5 +0,0 @@
import {expect} from 'chai';
it('exists', () => {
expect(true).to.be.true;
});

116
latus.yml
View File

@ -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': {}

View File

@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "1.0.0"
"version": "2.0.0"
}

View File

@ -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');

View File

@ -1,63 +1,69 @@
{
"name": "humus",
"version": "2.0.1",
"name": "@humus/monorepo",
"repository": {
"type": "git",
"url": "https://git.hq.cha0s.io/cha0s/humus.git",
"directory": "packages/monorepo"
},
"version": "2.0.0",
"private": true,
"scripts": {
"build": "lerna run build",
"build:docker": "docker build -t docker.hq.cha0s.io/cha0s6983/$(echo $(jq -r .name package.json):$(jq -r .version package.json)) .",
"build:lat": "latus-build",
"clean": "lerna run clean",
"docker": "yarn build:lat && docker-compose up --build",
"electron": "NODE_ENV=production NODE_PATH=./node_modules electron build/electron.js",
"fp": "lerna run fp",
"http": "LATUS_ONLY_BUILD=http latus-build -d --hot --watch",
"lint": "lerna run lint",
"package": "node ./package.js",
"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"
"build": "FLECKS_ENV_FLECKS_SERVER_start=0 npm run build:only",
"build:only": "flecks build",
"debug": "DEBUG=*,-babel* npm run dev",
"dev": "npm run -- build:only -h",
"link-all": "yarn link $(for i in $(ls node_modules/@flecks); do echo -n \"@flecks/$i \"; done)",
"postinstall": "patch-package",
"repl": "npx flecks repl --rlwrap",
"start": "DEBUG=@avocado*,@flecks*,@humus*,humus*,-@flecks/core/flecks* npm run dev",
"unlink-all": "yarn unlink $(for i in $(ls node_modules/@flecks); do echo -n \"@flecks/$i \"; done) && yarn install --force",
"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)"
},
"dependencies": {
"@avocado/behavior": "^2.0.0",
"@avocado/color": "^1.0.0",
"@avocado/core": "^2.0.0",
"@avocado/dialog": "^1.0.0",
"@avocado/entity": "^2.0.0",
"@avocado/graphics": "^2.0.0",
"@avocado/input": "^2.0.0",
"@avocado/math": "^2.0.0",
"@avocado/physics": "^1.0.0",
"@avocado/resource": "^2.0.0",
"@avocado/s13n": "^2.0.0",
"@avocado/sandbox": "^1.0.0",
"@avocado/sound": "^1.0.0",
"@avocado/timing": "^2.0.0",
"@avocado/topdown": "^2.0.0",
"@humus/app": "^1.0.0",
"@humus/combat": "^1.0.0",
"@humus/core": "^1.0.0",
"@humus/farm": "^1.0.0",
"@humus/inventory": "^1.0.0",
"@humus/universe": "^1.0.0",
"@avocado/behavior": "^3.0.0",
"@avocado/color": "^3.0.0",
"@avocado/core": "^3.0.0",
"@avocado/dialog": "^3.0.0",
"@avocado/entity": "^3.0.0",
"@avocado/graphics": "^3.0.0",
"@avocado/input": "^3.0.0",
"@avocado/math": "^3.0.0",
"@avocado/physics": "^3.0.0",
"@avocado/react": "^3.0.0",
"@avocado/resource": "^3.0.0",
"@avocado/resource-persea": "^3.0.0",
"@avocado/s13n": "^3.0.0",
"@avocado/sound": "^3.0.0",
"@avocado/timing": "^3.0.0",
"@avocado/topdown": "^3.0.0",
"@avocado/traits": "^3.0.0",
"@flecks/core": "^1.3.0",
"@flecks/create-app": "^1.3.0",
"@flecks/db": "^1.3.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",
"@latus/core": "2.0.0",
"@latus/db": "2.1.0",
"@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"
"pg": "^8.7.3",
"pg-hstore": "^2.3.4"
},
"devDependencies": {
"@latus/build": "1.x",
"lerna": "^3.22.1"
"@flecks/create-fleck": "^1.3.0",
"@flecks/docker": "^1.3.0",
"lerna": "^3.22.1",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0"
}
}

View File

@ -1,6 +1,116 @@
**/*.js
**/*.map
/assets
!/.*
!src/**/*.js
!/test/**/*.js
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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.*

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 KiB

View File

@ -0,0 +1,6 @@
'@flecks/core': {}
'@flecks/fleck': {}
'@flecks/http': {}
'@flecks/http/server':
build: false
'@flecks/react': {}

View File

@ -1,34 +1,39 @@
{
"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",
"scripts": {
"build": "latus-build",
"clean": "latus-build clean",
"fp": "latus-build forcepublish",
"lint": "latus-build lint",
"test": "latus-build test"
"build": "flecks build",
"clean": "flecks clean",
"lint": "flecks lint",
"postversion": "cp package.json dist",
"test": "flecks test"
},
"files": [
"client.js",
"client.js.map",
"build",
"index.js",
"index.js.map",
"src",
"test",
"test.js",
"test.js.map"
],
"dependencies": {
"@humus/scss": "^1.0.0",
"@latus/react": "^2.0.0",
"@latus/redux": "^2.0.0",
"@latus/socket": "^2.0.0",
"@latus/user": "^2.0.0",
"connected-react-router": "^6.9.1",
"history": "^4.10.0",
"is-electron": "^2.2.0",
"react-router-dom": "^5.2.0"
"@flecks/core": "^1.3.0",
"@flecks/react": "^1.3.0",
"@flecks/redux": "^1.3.0",
"@flecks/socket": "^1.3.0",
"@flecks/user": "^1.3.0",
"@humus/scss": "^2.0.0",
"is-electron": "^2.2.0"
},
"devDependencies": {
"@latus/build": "1.x"
"@flecks/fleck": "^1.3.0",
"@flecks/http": "^1.3.0"
}
}

View File

@ -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));
},
},
};

View File

@ -1,3 +0,0 @@
import {createBrowserHistory} from 'history';
export default createBrowserHistory();

View File

@ -2,57 +2,40 @@ import './index.scss';
import {
hot,
PropTypes,
React,
useLatus,
} from '@latus/react';
import {ConnectedRouter} from 'connected-react-router';
} from '@flecks/react';
import {
Redirect,
Navigate,
Outlet,
Routes,
Route,
Switch,
} from 'react-router-dom';
} from '@flecks/react/router';
import Ui from '../valent-ui';
import Login from './login';
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 = () => {
const latus = useLatus();
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 = {
Components: PropTypes.arrayOf(PropTypes.node).isRequired,
};
Humus.propTypes = {};
export default hot(module)(Humus);

View File

@ -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 = () => (
<LatusLogin />
<UserLocalLogin />
);
export default Login;

View File

@ -1,20 +1,18 @@
import './index.scss';
import {
gatherComponents,
React,
useLatus,
} from '@latus/react';
useFlecks,
} from '@flecks/react';
const Title = () => {
const latus = useLatus();
const Items = Object.entries(latus.invoke('@humus/app/title'))
.map(([path, Component]) => (
<Component key={path} />
));
const flecks = useFlecks();
const Items = gatherComponents(flecks.invoke('@humus/app.title'));
return (
<div className="title">
<div className="title__muted">
<h1 className="title__title">{latus.get('@latus/http.title')}</h1>
<h1 className="title__title">Humus</h1>
<ul className="title__actions">
{Items}
</ul>

0
packages/app/src/components/app/title/rooted.jpg Executable file → Normal file
View 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
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,3 +1,3 @@
import {createContext} from '@latus/react';
import {createContext} from '@flecks/react';
export default createContext(undefined);

View File

@ -6,7 +6,7 @@ import {
useContext,
useEffect,
useRef,
} from '@latus/react';
} from '@flecks/react';
import Context from './context';

View File

@ -3,7 +3,7 @@
left: 50%;
overflow: hidden;
position: absolute;
--scale: 0;
--scale: 1;
top: 50%;
transform: scale(var(--scale)) translate(-50%, -50%);
transform-origin: 0 0;

View File

@ -1,39 +1,39 @@
import {
useEffect,
useLatus,
useFlecks,
useState,
} from '@latus/react';
import {useSocket} from '@latus/socket';
} from '@flecks/react';
import {useSocket} from '@flecks/socket';
export default () => {
const latus = useLatus();
const [room, setRoom] = useState(latus.get('%room'));
const flecks = useFlecks();
const [room, setRoom] = useState(flecks.get('$humus/app.room'));
const socket = useSocket();
const synchronizer = latus.get('%synchronizer');
const synchronizer = flecks.get('$humus/universe.synchronizer');
useEffect(() => {
if (!room) {
return undefined;
}
const onDisconnect = () => {
synchronizer.destroySynchronized(room.constructor.resourceId, room.s13nId);
latus.set('%room', undefined);
flecks.set('$humus/app.room', undefined);
setRoom(undefined);
};
socket.on('disconnect', onDisconnect);
return () => {
socket.off('disconnect', onDisconnect);
};
}, [latus, room, socket, synchronizer]);
}, [flecks, room, socket, synchronizer]);
useEffect(() => {
if (!synchronizer) {
return undefined;
}
const onCreated = (created) => {
const {Room} = latus.get('%resources');
const {Room} = flecks.get('$avocado/resource.resources');
switch (created.constructor.resourceId) {
// Track room.
case Room.resourceId: {
latus.set('%room', created);
flecks.set('$humus/app.room', created);
setRoom(created);
break;
}
@ -44,6 +44,6 @@ export default () => {
return () => {
synchronizer.off('created', onCreated);
};
}, [latus, room, synchronizer]);
}, [flecks, room, synchronizer]);
return room;
};

View File

@ -1,24 +1,24 @@
import {
useEffect,
useLatus,
useFlecks,
useState,
} from '@latus/react';
import {useSelector} from '@latus/redux';
} from '@flecks/react';
import {useSelector} from '@flecks/redux';
import {selfEntitySelector} from '../state';
import useRoom from './use-room';
export default () => {
const latus = useLatus();
const flecks = useFlecks();
const room = useRoom();
const selfEntity = useSelector(selfEntitySelector);
const [entity, setEntity] = useState(latus.get('%selfEntity'));
const [entity, setEntity] = useState(flecks.get('$humus/app.selfEntity'));
useEffect(() => {
if (!room) {
return;
}
const onDestroying = () => {
latus.set('%selfEntity', undefined);
flecks.set('$humus/app.selfEntity', undefined);
setEntity(undefined);
};
const augmentSelfEntity = async (entity) => {
@ -28,10 +28,10 @@ export default () => {
});
entity.on('destroying', onDestroying);
}
latus.set('%selfEntity', entity);
flecks.set('$humus/app.selfEntity', entity);
setEntity(entity);
};
augmentSelfEntity(room.findEntity(selfEntity));
}, [latus, room, selfEntity]);
}, [flecks, room, selfEntity]);
return entity;
};

View File

@ -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 {
hooks: {
'@latus/core/config': () => ({
[Hooks]: {
'@flecks/core.config': () => ({
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,
}),
},
};

View File

@ -1,6 +1,4 @@
import {
createSlice,
} from '@latus/redux';
import {createSlice} from '@flecks/redux';
export const selfEntitySelector = ({selfEntity}) => selfEntity;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,116 @@
**/*.js
**/*.map
/assets
!/.*
!src/**/*.js
!/test/**/*.js
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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.*

View File

@ -0,0 +1,6 @@
'@flecks/core': {}
'@flecks/fleck': {}
'@flecks/http': {}
'@flecks/http/server':
build: false
'@flecks/react': {}

View File

@ -1,40 +1,48 @@
{
"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",
"author": "cha0s",
"license": "MIT",
"scripts": {
"build": "latus-build",
"clean": "latus-build clean",
"fp": "latus-build forcepublish",
"lint": "latus-build lint",
"test": "latus-build test"
"build": "flecks build",
"clean": "flecks clean",
"lint": "flecks lint",
"postversion": "cp package.json dist",
"test": "flecks test"
},
"files": [
"build",
"index.js",
"index.js.map",
"persea.js",
"persea.js.map",
"src",
"test",
"test.js",
"test.js.map"
],
"dependencies": {
"@avocado/behavior": "^2.0.0",
"@avocado/entity": "^2.0.0",
"@avocado/math": "^2.0.0",
"@avocado/persea": "^1.0.0",
"@avocado/resource": "^2.0.0",
"@avocado/traits": "^2.0.0",
"@latus/core": "^2.0.0",
"@latus/react": "^2.0.0",
"@latus/socket": "^2.0.0",
"autoprefixer": "^9.8.6",
"@avocado/behavior": "^3.0.0",
"@avocado/entity": "^3.0.0",
"@avocado/math": "^3.0.0",
"@avocado/react": "^3.0.0",
"@avocado/resource": "^3.0.0",
"@avocado/resource-persea": "^3.0.0",
"@avocado/traits": "^3.0.0",
"@flecks/core": "^1.3.0",
"@flecks/react": "^1.3.0",
"@flecks/socket": "^1.3.0",
"debug": "4.3.1",
"lodash.flatten": "^4.4.0"
},
"devDependencies": {
"@latus/build": "1.x",
"source-map-support": "0.5.19"
"@flecks/fleck": "^1.3.0",
"@flecks/http": "^1.3.0"
}
}

View File

@ -1,12 +1,10 @@
import {Class, gather, gatherWithLatus} from '@latus/core';
import {Class, Flecks, Hooks} from '@flecks/core';
import flatten from 'lodash.flatten';
export default {
hooks: {
'@avocado/traits/traits': gatherWithLatus(
require.context('./traits', false, /\.js$/),
),
'@humus/combat/affinities': () => ({
[Hooks]: {
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
'@humus/combat.affinities': () => ({
Void: Class,
Bio: Class,
Stone: Class,
@ -17,18 +15,13 @@ export default {
Fire: Class,
Water: Class,
}),
'@humus/combat/interactions': () => {
'@humus/combat.interactions': () => {
const context = require.context('./interactions', false, /from-.*-to.*\.js$/);
return context.keys().map((path) => context(path).default);
},
'@latus/core/starting': (latus) => {
latus.set('%affinities', gather(
latus,
{
type: '@humus/combat/affinities',
},
));
const interactions = flatten(latus.invokeFlat('@humus/combat/interactions'))
'@flecks/core.starting': (flecks) => {
flecks.set('$humus/combat.affinities', flecks.gather('@humus/combat.affinities'));
const interactions = flatten(flecks.invokeFlat('@humus/combat.interactions'))
.reduce(
(r, interaction) => {
const {harming, harmed} = interaction;
@ -45,13 +38,11 @@ export default {
},
{},
);
latus.set(
'%interactions',
flecks.set(
'$humus/combat.interactions',
(harmingAffinity, harmedAffinity) => interactions[harmingAffinity]?.[harmedAffinity] || [],
);
},
'@latus/socket/packets': gatherWithLatus(
require.context('./packets', false, /\.js$/),
),
'@flecks/socket.packets': Flecks.provide(require.context('./packets', false, /\.js$/)),
},
};

View File

@ -1,11 +1,11 @@
/* eslint-disable no-param-reassign */
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) {
const Affinities = latus.get('%affinities');
const Affinities = flecks.get('$humus/combat.affinities');
return harms.map((harm) => {
const {[harm.affinity]: Affinity} = Affinities;
harm.affinity = Affinity.id;
@ -27,7 +27,7 @@ export default (latus) => class HarmPacket extends Packet {
}
static unpack(harms) {
const Affinities = latus.get('%affinities');
const Affinities = flecks.get('$humus/combat.affinities');
return harms.map((harm) => {
const {[harm.affinity]: Affinity} = Affinities;
harm.affinity = Affinity.type;

View File

@ -1,9 +1,9 @@
import {gatherComponents} from '@latus/react';
import {Hooks, Flecks} from '@flecks/react';
export default {
hooks: {
'@avocado/traits/components': gatherComponents(
require.context('./traits', false, /\.jsx$/),
[Hooks]: {
'@avocado/traits-persea.components': (
Flecks.provide(require.context('./traits', false, /\.jsx$/))
),
},
};

View File

@ -1,12 +1,12 @@
import {join} from 'path';
import {Code} from '@avocado/persea';
import {useJsonPatcher} from '@avocado/resource/persea';
import {Code} from '@avocado/react';
import {useJsonPatcher} from '@avocado/resource-persea';
import {
hot,
PropTypes,
React,
} from '@latus/react';
} from '@flecks/react';
const Harmful = ({json, path}) => {
const patch = useJsonPatcher();

View File

@ -1,12 +1,12 @@
import {Vector} from '@avocado/math';
import {StateProperty, Trait} from '@avocado/traits';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
const decorate = compose(
StateProperty('isHarmful'),
);
export default (latus) => class Harmful extends decorate(Trait) {
export default (flecks) => class Harmful extends decorate(Trait) {
#harmSpecs = [];
@ -70,7 +70,7 @@ export default (latus) => class Harmful extends decorate(Trait) {
listeners() {
const listeners = {
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.contextOrDefault,
harm,
@ -147,7 +147,7 @@ export default (latus) => class Harmful extends decorate(Trait) {
}
tick() {
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
if (this.entity.is('Collider')) {
const {isCollidingWith} = this.entity;
for (let i = 0; i < isCollidingWith.length; i++) {

View File

@ -1,7 +1,7 @@
import {Trait} from '@avocado/traits';
import flatten from 'lodash.flatten';
export default (latus) => class Vulnerable extends Trait {
export default (flecks) => class Vulnerable extends Trait {
#harms = [];
@ -204,9 +204,9 @@ export default (latus) => class Vulnerable extends Trait {
}
interactions(harmed, harm) {
const {Script} = latus.get('%resources');
const {Script} = flecks.get('$avocado/resource.resources');
const {affinity, from} = harm;
const interactions = latus.get('%interactions');
const interactions = flecks.get('$humus/combat.interactions');
flatten(
harmed.affinities()
.map((harmedAffinity) => interactions(affinity, harmedAffinity)),
@ -284,7 +284,7 @@ export default (latus) => class Vulnerable extends Trait {
},
harmed: async (harm, from) => {
const {Script} = latus.get('%resources');
const {Script} = flecks.get('$avocado/resource.resources');
const script = await Script.load(this.params.harmedScript, {
entity: this.entity,
from,
@ -298,7 +298,7 @@ export default (latus) => class Vulnerable extends Trait {
},
tookHarm: (harm) => {
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
this.#harms.push(harm);
this.interactions(this.entity, harm);
this.markAsDirty();
@ -375,7 +375,7 @@ export default (latus) => class Vulnerable extends Trait {
this.#interactionTickers[i].tick(elapsed);
}
}
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
const it = this.#locks.keys();
for (let current = it.next(); current.done !== true; current = it.next()) {
const {value: key} = current;

View File

@ -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

View File

@ -1,6 +1,116 @@
**/*.js
**/*.map
/assets
!/.*
!src/**/*.js
!/test/**/*.js
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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.*

View File

@ -0,0 +1,6 @@
'@flecks/core': {}
'@flecks/fleck': {}
'@flecks/http': {}
'@flecks/http/server':
build: false
'@flecks/react': {}

View File

@ -1,44 +1,53 @@
{
"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",
"author": "cha0s",
"license": "MIT",
"scripts": {
"build": "latus-build",
"clean": "latus-build clean",
"fp": "latus-build forcepublish",
"lint": "latus-build lint",
"test": "latus-build test"
"build": "flecks build",
"clean": "flecks clean",
"lint": "flecks lint",
"postversion": "cp package.json dist",
"test": "flecks test"
},
"files": [
"build",
"index.js",
"index.js.map",
"persea.js",
"persea.js.map",
"src",
"test",
"test.js",
"test.js.map"
],
"dependencies": {
"@avocado/behavior": "^2.0.0",
"@avocado/core": "^2.0.0",
"@avocado/entity": "^2.0.0",
"@avocado/graphics": "^2.0.0",
"@avocado/math": "^2.0.0",
"@avocado/persea": "^1.0.0",
"@avocado/resource": "^2.0.0",
"@avocado/s13n": "^2.0.0",
"@avocado/traits": "^2.0.0",
"@humus/scss": "^1.0.0",
"@latus/core": "^2.0.0",
"@latus/react": "^2.0.0",
"@latus/redux": "^2.0.0",
"@latus/socket": "^2.0.0",
"@latus/user": "^2.0.0",
"debug": "4.3.1",
"msgpack-lite": "^0.1.26"
"@avocado/behavior": "^3.0.0",
"@avocado/core": "^3.0.0",
"@avocado/entity": "^3.0.0",
"@avocado/graphics": "^3.0.0",
"@avocado/math": "^3.0.0",
"@avocado/react": "^3.0.0",
"@avocado/resource": "^3.0.0",
"@avocado/resource-persea": "^3.0.0",
"@avocado/s13n": "^3.0.0",
"@avocado/traits": "^3.0.0",
"@flecks/core": "^1.3.0",
"@flecks/react": "^1.3.0",
"@flecks/redux": "^1.3.0",
"@flecks/socket": "^1.3.0",
"@flecks/user": "^1.3.0",
"@humus/scss": "^2.0.0",
"debug": "4.3.1"
},
"devDependencies": {
"@latus/build": "1.x"
"@flecks/fleck": "^1.3.0",
"@flecks/http": "^1.3.0"
}
}

View File

@ -1,9 +1,7 @@
import {gatherWithLatus} from '@latus/core';
import {Flecks, Hooks} from '@flecks/core';
export default {
hooks: {
'@avocado/traits/traits': gatherWithLatus(
require.context('./traits', false, /\.js$/),
),
[Hooks]: {
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
},
};

View File

@ -1,4 +1,4 @@
import {gatherComponents} from '@latus/react';
import {gatherComponents} from '@flecks/react';
export default {
hooks: {

View File

@ -1,12 +1,12 @@
import {join} from 'path';
import {Code, Number} from '@avocado/persea';
import {useJsonPatcher} from '@avocado/resource/persea';
import {Code, Number} from '@avocado/react';
import {useJsonPatcher} from '@avocado/resource-persea';
import {
hot,
PropTypes,
React,
} from '@latus/react';
} from '@flecks/react';
const Item = ({json, path}) => {
const patch = useJsonPatcher();

View File

@ -10,11 +10,11 @@ export default () => class Darkened extends Trait {
async load(json) {
await super.load(json);
this._isDarkened = this.params.isDarkened;
this.$$isDarkened = this.params.isDarkened;
}
get isDarkened() {
return this._isDarkened;
return this.$$isDarkened;
}
};

View File

@ -4,11 +4,11 @@ import {Rectangle, Vector} from '@avocado/math';
import {Resource} from '@avocado/resource';
import {Synchronized} from '@avocado/s13n';
import {Trait} from '@avocado/traits';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
export default (latus) => {
export default (flecks) => {
const decorate = compose(
Synchronized(latus),
Synchronized(flecks),
);
class Synchronizer extends decorate(Resource) {}
return class Informed extends Trait {

View File

@ -1,6 +1,6 @@
import {Property, TickingPromise} from '@avocado/core';
import {StateProperty, Trait} from '@avocado/traits';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
const decorate = compose(
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() {
return {
@ -74,7 +74,7 @@ export default (latus) => class Item extends decorate(Trait) {
use: () => {
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)];
if (cooldown > 0) {
promises.push(new Promise((resolve) => {

View File

@ -1,5 +1,5 @@
import {StateProperty, Trait} from '@avocado/traits';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
const decorate = compose(
StateProperty('lootable', {
@ -98,7 +98,7 @@ export default () => class Lootable extends decorate(Trait) {
hooks() {
const hooks = {};
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
let isDying = false;
hooks.destroy = () => () => {
if (isDying) {

View File

@ -1,6 +1,6 @@
import {StateProperty, Trait} from '@avocado/traits';
import {Rectangle, Vector} from '@avocado/math';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
const decorate = compose(
StateProperty('attraction', {

View File

@ -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

View File

@ -1,6 +1,116 @@
**/*.js
**/*.map
/assets
!/.*
!src/**/*.js
!/test/**/*.js
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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.*

View File

@ -1,35 +1,42 @@
{
"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",
"author": "cha0s",
"license": "MIT",
"scripts": {
"build": "latus-build",
"clean": "latus-build clean",
"fp": "latus-build forcepublish",
"lint": "latus-build lint",
"test": "latus-build test"
"build": "flecks build",
"clean": "flecks clean",
"lint": "flecks lint",
"postversion": "cp package.json dist",
"test": "flecks test"
},
"files": [
"build",
"index.js",
"index.js.map",
"src",
"test",
"test.js",
"test.js.map"
],
"dependencies": {
"@avocado/behavior": "^2.0.0",
"@avocado/core": "^2.0.0",
"@avocado/graphics": "^2.0.0",
"@avocado/math": "^2.0.0",
"@avocado/timing": "^2.0.0",
"@avocado/traits": "^2.0.0",
"@latus/core": "^2.0.0",
"@latus/socket": "^2.0.0",
"@avocado/behavior": "^3.0.0",
"@avocado/core": "^3.0.0",
"@avocado/graphics": "^3.0.0",
"@avocado/math": "^3.0.0",
"@avocado/timing": "^3.0.0",
"@avocado/traits": "^3.0.0",
"@flecks/core": "^1.3.0",
"@flecks/socket": "^1.3.0",
"debug": "4.3.1"
},
"devDependencies": {
"@latus/build": "1.x",
"source-map-support": "0.5.19"
"@flecks/fleck": "^1.3.0"
}
}

View File

@ -1,15 +1,11 @@
import {decorateWithLatus, gatherWithLatus} from '@latus/core';
import {Flecks, Hooks} from '@flecks/core';
export default {
hooks: {
'@avocado/resource/resources.decorate': decorateWithLatus(
require.context('./resources/decorators', false, /\.js$/),
),
'@avocado/traits/traits': gatherWithLatus(
require.context('./traits', false, /\.js$/),
),
'@latus/socket/packets': gatherWithLatus(
require.context('./packets', false, /\.js$/),
[Hooks]: {
'@avocado/resource.resources.decorate': (
Flecks.decorate(require.context('./resources/decorators', false, /\.js$/))
),
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
'@flecks/socket.packets': Flecks.provide(require.context('./packets', false, /\.js$/)),
},
};

View File

@ -1,4 +1,4 @@
import {Packet} from '@latus/socket';
import {Packet} from '@flecks/socket';
export default () => class RoomWaterPacket extends Packet {

View File

@ -1,4 +1,4 @@
import {Packet} from '@latus/socket';
import {Packet} from '@flecks/socket';
export default () => class TraitUpdatePlantPacket extends Packet {

View File

@ -34,7 +34,7 @@ export default (Room) => class FarmableRoom extends Room {
adjustWaterAt(target, increase) {
const tiles = this.tiles[1];
if (
'client' === process.env.SIDE
'http' === process.env.FLECKS_CORE_BUILD_TARGET
|| TILLED !== tiles.tileAt(target)
) {
return;
@ -98,7 +98,7 @@ export default (Room) => class FarmableRoom extends Room {
const {tileSize} = tiles;
const target = Vector.floor(Vector.div(center, tileSize));
return (
'client' !== process.env.SIDE
'http' !== process.env.FLECKS_CORE_BUILD_TARGET
&& TILLED === tiles.tileAt(target)
&& !this.isPlantAt(center)
);
@ -113,7 +113,7 @@ export default (Room) => class FarmableRoom extends Room {
}
prepareSoilAt(target) {
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
const tiles = this.tiles[1];
tiles.setTileAt(target, TILLED);
this.adjustWaterAt(target, 0);
@ -130,7 +130,7 @@ export default (Room) => class FarmableRoom extends Room {
}
tickWater(elapsed) {
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
return;
}
const water = Object.entries(this.water);

View File

@ -1,6 +1,6 @@
import {spontaneous, Vector} from '@avocado/math';
import {StateProperty, Trait} from '@avocado/traits';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
const decorate = compose(
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;
@ -65,7 +65,7 @@ export default (latus) => class Plant extends decorate(Trait) {
async load(json) {
await super.load(json);
const {Script} = latus.get('%resources');
const {Script} = flecks.get('$avocado/resource.resources');
const {growthCheck, growthScript} = this.params;
if (growthCheck) {
this.growthCheck = await Script.load(growthCheck, {
@ -108,7 +108,7 @@ export default (latus) => class Plant extends decorate(Trait) {
}
tick(elapsed) {
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
return;
}
const {room} = this.entity;

View File

@ -5,7 +5,7 @@ import {Rectangle, Vector} from '@avocado/math';
import {LfoResult} from '@avocado/timing';
// Tools.
export default (latus) => class Tool extends Trait {
export default (flecks) => class Tool extends Trait {
#primitives;
@ -17,7 +17,7 @@ export default (latus) => class Tool extends Trait {
constructor() {
super();
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
this.#throbber = {color: 0};
this.#throbber.lfo = new LfoResult(
this.#throbber,
@ -66,7 +66,7 @@ export default (latus) => class Tool extends Trait {
}
calculateTargetTotal() {
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
const {wielder} = this.entity;
if (!wielder || !wielder.room) {
return;
@ -118,7 +118,7 @@ export default (latus) => class Tool extends Trait {
destroy() {
const {wielder} = this.entity;
this.onWielderChanged(wielder);
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
this.#primitives.destroy();
this.#throbber = {};
}
@ -167,7 +167,7 @@ export default (latus) => class Tool extends Trait {
useTool: () => {
this.calculateTargets();
const promises = this.#targets.map((target) => {
const {Script} = latus.get('%resources');
const {Script} = flecks.get('$avocado/resource.resources');
const context = this.createTargetContext(target);
return Script.loadTickingPromise(this.params.toolScript, context);
});
@ -179,7 +179,7 @@ export default (latus) => class Tool extends Trait {
onWielderActiveSlotIndexChanged() {
this.calculateTargets();
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
this.#primitives.visible = false;
const {wielder} = this.entity;
if (!wielder || !wielder.container || !wielder.is('Receptacle')) {
@ -191,13 +191,13 @@ export default (latus) => class Tool extends Trait {
onWielderChanged(oldWielder, newWielder) {
if (oldWielder && oldWielder.is('Visible')) {
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
oldWielder.removeRasterSibling(this.#primitives);
}
oldWielder.off('activeSlotIndexChanged', this.onWielderActiveSlotIndexChanged);
}
if (newWielder && newWielder.is('Visible')) {
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
newWielder.addRasterSibling(this.#primitives);
}
newWielder.on('activeSlotIndexChanged', this.onWielderActiveSlotIndexChanged, this);
@ -264,7 +264,7 @@ export default (latus) => class Tool extends Trait {
}
repositionPrimitives() {
if ('client' === process.env.SIDE) {
if ('http' === process.env.FLECKS_CORE_BUILD_TARGET) {
const {wielder} = this.entity;
if (!wielder || !wielder.room) {
return;

View File

@ -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

View File

@ -1,6 +1,116 @@
**/*.js
**/*.map
/assets
!/.*
!src/**/*.js
!/test/**/*.js
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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.*

View File

@ -1,33 +1,39 @@
{
"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",
"author": "cha0s",
"license": "MIT",
"scripts": {
"build": "latus-build",
"clean": "latus-build clean",
"fp": "latus-build forcepublish",
"lint": "latus-build lint",
"test": "latus-build test"
"build": "flecks build",
"clean": "flecks clean",
"lint": "flecks lint",
"postversion": "cp package.json dist",
"test": "flecks test"
},
"files": [
"build",
"index.js",
"index.js.map",
"src",
"test",
"test.js",
"test.js.map"
],
"dependencies": {
"@avocado/behavior": "^2.0.0",
"@avocado/traits": "^2.0.0",
"@latus/core": "^2.0.0",
"@latus/react": "^2.0.0",
"@latus/socket": "^2.0.0",
"autoprefixer": "^9.8.6",
"@avocado/behavior": "^3.0.0",
"@avocado/traits": "^3.0.0",
"@flecks/core": "^1.3.0",
"@flecks/react": "^1.3.0",
"@flecks/socket": "^1.3.0",
"debug": "4.3.1"
},
"devDependencies": {
"@latus/build": "1.x",
"source-map-support": "0.5.19"
"@flecks/fleck": "^1.3.0"
}
}

View File

@ -2,7 +2,7 @@ import {
useCallback,
useEvent,
useState,
} from '@latus/react';
} from '@flecks/react';
export default function useInventorySlice(selfEntity, start, end) {
const [slice, setSlice] = useState([]);

View File

@ -1,14 +1,10 @@
import {gatherWithLatus} from '@latus/core';
import {Hooks, Flecks} from '@flecks/core';
export * from './hooks';
export default {
hooks: {
'@avocado/traits/traits': gatherWithLatus(
require.context('./traits', false, /\.js$/),
),
'@latus/socket/packets': gatherWithLatus(
require.context('./packets', false, /\.js$/),
),
[Hooks]: {
'@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)),
'@flecks/socket.packets': Flecks.provide(require.context('./packets', false, /\.js$/)),
},
};

View File

@ -1,5 +1,5 @@
import {compose} from '@latus/core';
import {Packer, Packet} from '@latus/socket';
import {compose} from '@flecks/core';
import {Packer, Packet} from '@flecks/socket';
const decorate = compose(
Packer('json'),

View File

@ -1,4 +1,4 @@
import {Packet} from '@latus/socket';
import {Packet} from '@flecks/socket';
export default () => class TraitUpdateReceptacleItemQtyPacket extends Packet {

View File

@ -1,4 +1,4 @@
import {Packet} from '@latus/socket';
import {Packet} from '@flecks/socket';
export default () => class TraitUpdateReceptacleItemSwapPacket extends Packet {

View File

@ -1,5 +1,5 @@
import {StateProperty, Trait} from '@avocado/traits';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
const decorate = compose(
StateProperty('slotCount', {
@ -11,7 +11,7 @@ const NULL_SLOT = 65535;
const AUTO_SLOT = 65535;
// 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() {
super();
@ -66,7 +66,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
break;
}
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);
break;
}
@ -102,7 +102,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
this.addListenersForItem(item);
this.slotItems[slotNumber] = item;
this.entity.emit('itemAdded', item, slotNumber);
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
this.packetUpdates.push([
'TraitUpdateReceptacleItemFull',
{
@ -118,7 +118,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
addListenersForItem(item) {
const listener = (oldQty, newQty) => {
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
const slotIndex = this.itemSlotIndex(item);
// Valid quantity; update client.
if (newQty > 0) {
@ -193,7 +193,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
listeners() {
const listeners = {};
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
listeners.collisionStart = (other) => {
if (other.is('Item')) {
other.list?.removeEntity(other);
@ -206,7 +206,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
}
async load(json) {
const {Entity} = latus.get('%resources');
const {Entity} = flecks.get('$avocado/resource.resources');
await super.load(json);
await Promise.all(Object.entries(this.params.slots).map(async ([slotIndex, slotSpec]) => {
const item = await Entity.load({extends: slotSpec.extends});
@ -245,7 +245,7 @@ export default (latus) => class Receptacle extends decorate(Trait) {
this.removeListenersForItem(item);
delete this.slotItems[slotIndex];
this.entity.emit('itemRemoved', item, slotIndex);
if ('client' !== process.env.SIDE) {
if ('http' !== process.env.FLECKS_CORE_BUILD_TARGET) {
this.packetUpdates.push([
'TraitUpdateReceptacleItemSwap',
{

View File

@ -1,5 +1,5 @@
import {StateProperty, Trait} from '@avocado/traits';
import {compose} from '@latus/core';
import {compose} from '@flecks/core';
const decorate = compose(
StateProperty('activeSlotIndex', {

View File

@ -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

View File

@ -1,9 +1,116 @@
**/*.js
**/*.map
/assets
!/.*
!/postcss.config.js
!/webpack.config.js
!src/**/*.js
!/test/**/*.js
/*.scss
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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.*

View File

@ -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: '.',
}],
}),
);

View 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;
})();

View File

@ -1,26 +1,36 @@
{
"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",
"scripts": {
"build": "latus-build",
"clean": "latus-build clean",
"fp": "latus-build forcepublish",
"lint": "latus-build lint",
"test": "latus-build test"
"build": "flecks build",
"clean": "flecks clean",
"lint": "flecks lint",
"postversion": "cp package.json dist",
"test": "flecks test"
},
"files": [
"build",
"colors.scss",
"graphics.scss",
"index.js",
"index.js.map",
"reset.scss",
"src",
"test",
"test.js",
"test.js.map"
],
"dependencies": {},
"dependencies": {
"@flecks/core": "^1.3.0"
},
"devDependencies": {
"@latus/build": "1.x",
"@flecks/fleck": "^1.3.0",
"@neutrinojs/copy": "^9.5.0"
}
}

View File

@ -0,0 +1 @@
// ...

View File

@ -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

View File

@ -1,6 +1,116 @@
**/*.js
**/*.map
/assets
!/.*
!src/**/*.js
!/test/**/*.js
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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.*

View File

@ -0,0 +1,6 @@
'@flecks/core': {}
'@flecks/fleck': {}
'@flecks/http': {}
'@flecks/http/server':
build: false
'@flecks/react': {}

View File

@ -1,51 +1,57 @@
{
"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",
"author": "cha0s",
"license": "MIT",
"scripts": {
"build": "latus-build",
"clean": "latus-build clean",
"fp": "latus-build forcepublish",
"lint": "latus-build lint",
"test": "latus-build test"
"build": "flecks build",
"clean": "flecks clean",
"lint": "flecks lint",
"postversion": "cp package.json dist",
"test": "flecks test"
},
"files": [
"build",
"client.js",
"client.js.map",
"index.js",
"index.js.map",
"server.js",
"server.js.map",
"src",
"test",
"test.js",
"test.js.map"
],
"dependencies": {
"@avocado/graphics": "^2.0.0",
"@avocado/input": "^2.0.0",
"@avocado/math": "^2.0.0",
"@avocado/react": "^1.0.0",
"@avocado/resource": "^2.0.0",
"@avocado/s13n": "^2.0.0",
"@avocado/timing": "^2.0.0",
"@avocado/topdown": "^2.0.0",
"@avocado/traits": "^2.0.0",
"@humus/app": "^1.0.0",
"@humus/inventory": "^1.0.0",
"@humus/scss": "^1.0.0",
"@latus/core": "^2.0.0",
"@latus/react": "^2.0.0",
"@latus/redux": "^2.0.0",
"@latus/socket": "^2.0.0",
"classnames": "^2.2.6",
"@avocado/graphics": "^3.0.0",
"@avocado/input": "^3.0.0",
"@avocado/math": "^3.0.0",
"@avocado/react": "^3.0.0",
"@avocado/resource": "^3.0.0",
"@avocado/s13n": "^3.0.0",
"@avocado/timing": "^3.0.0",
"@avocado/topdown": "^3.0.0",
"@avocado/traits": "^3.0.0",
"@flecks/core": "^1.3.0",
"@flecks/react": "^1.3.0",
"@flecks/redux": "^1.3.0",
"@flecks/socket": "^1.3.0",
"@humus/app": "^2.0.0",
"@humus/inventory": "^2.0.0",
"@humus/scss": "^2.0.0",
"debug": "4.3.1",
"express": "^4.17.1",
"glob": "^7.1.6",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0"
"glob": "^7.1.6"
},
"devDependencies": {
"@latus/build": "1.x"
"@flecks/fleck": "^1.3.0",
"@flecks/http": "^1.3.0"
}
}

View File

@ -1,22 +1,19 @@
import {gatherWithLatus} from '@latus/core';
import {Hooks} from '@flecks/core';
import Receiver from './receiver';
import Universe from '../components';
import Title from '../components/title';
export default {
hooks: {
'@humus/app/components': () => Universe,
'@humus/app/title': () => Title,
'@latus/http/client/up': (latus) => {
window.latus = latus;
const Synchronizer = Receiver(latus);
[Hooks]: {
'@humus/app.components': () => Universe,
'@humus/app.title': () => Title,
'@flecks/http/client.up': (flecks) => {
window.flecks = flecks;
const Synchronizer = Receiver(flecks);
const synchronizer = new Synchronizer();
latus.set('%synchronizer', synchronizer);
latus.get('%socket').on('packet', synchronizer.acceptPacket, synchronizer);
flecks.set('$humus/universe.synchronizer', synchronizer);
flecks.get('$flecks/socket.socket').on('packet', synchronizer.acceptPacket, synchronizer);
},
'@latus/socket/packets': gatherWithLatus(
require.context('./packets', false, /\.js$/),
),
},
};

View File

@ -1,11 +1,11 @@
import {Resource} from '@avocado/resource';
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(
EventEmitter,
Synchronized(latus),
Synchronized(flecks),
);
return class Receiver extends decorate(Resource) {
@ -13,7 +13,7 @@ export default (latus) => {
await super.acceptPacket(packet);
const {s13nType} = packet;
if ('create' === s13nType) {
const {Room} = latus.get('%resources');
const {Room} = flecks.get('$avocado/resource.resources');
const {id} = packet.data.synchronized;
this.emit('created', this.synchronized(Room.resourceId, id));
}

Some files were not shown because too many files have changed in this diff Show More