refactor: gathering

This commit is contained in:
cha0s 2024-01-28 11:18:33 -06:00
parent 05d242342c
commit bbcb05b946
8 changed files with 49 additions and 43 deletions

View File

@ -25,20 +25,20 @@
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@avocado/s13n": "^4.0.0", "@avocado/s13n": "^4.0.0",
"@avocado/topdown": "^4.0.0", "@avocado/topdown": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/passport-local-react": "^3.0.0", "@flecks/passport-local-react": "^3.1.3",
"@flecks/passport-react": "^3.0.0", "@flecks/passport-react": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/react-redux": "^3.0.0", "@flecks/react-redux": "^3.1.3",
"@flecks/redux": "^3.0.0", "@flecks/redux": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"@flecks/web": "^3.0.0", "@flecks/web": "^3.1.3",
"@humus/inventory": "^4.0.0", "@humus/inventory": "^4.0.0",
"fscreen": "^1.2.0", "fscreen": "^1.2.0",
"react-joystick-component": "^4.0.0" "react-joystick-component": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -17,10 +17,10 @@
"server.js" "server.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0" "@flecks/core": "^3.1.3"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -26,14 +26,14 @@
"@avocado/react": "^4.0.0", "@avocado/react": "^4.0.0",
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"debug": "4.3.1", "debug": "4.3.1",
"lodash.flatten": "^4.4.0" "lodash.flatten": "^4.4.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -18,8 +18,10 @@ export const hooks = {
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);
}, },
'@flecks/core.gathered': () => ({
affinities: {},
}),
'@flecks/core.starting': (flecks) => { '@flecks/core.starting': (flecks) => {
flecks.humus.combat.Affinities = flecks.gather('@humus/combat.affinities');
const interactions = flatten(flecks.invokeFlat('@humus/combat.interactions')) const interactions = flatten(flecks.invokeFlat('@humus/combat.interactions'))
.reduce( .reduce(
(r, interaction) => { (r, interaction) => {
@ -46,15 +48,19 @@ export const hooks = {
export const mixin = (Flecks) => class FlecksWithHumusCombat extends Flecks { export const mixin = (Flecks) => class FlecksWithHumusCombat extends Flecks {
constructor(...args) { constructor(runtime) {
super(...args); super(runtime);
if (!this.humus) { if (!this.humus) {
this.humus = {}; this.humus = {};
} }
if (!this.humus.combat) { if (!this.humus.combat) {
this.humus.combat = {}; this.humus.combat = {};
} }
this.humus.combat.Affinities = {}; Object.defineProperty(
this.humus.combat,
'Affinities',
{get: () => this.gathered('@humus/combat.affinities')},
);
this.humus.combat.interactions = () => {}; this.humus.combat.interactions = () => {};
} }

View File

@ -38,15 +38,15 @@
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/topdown": "^4.0.0", "@avocado/topdown": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/redux": "^3.0.0", "@flecks/redux": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"debug": "4.3.1", "debug": "4.3.1",
"is-electron": "^2.2.1" "is-electron": "^2.2.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -25,12 +25,12 @@
"@avocado/math": "^4.0.0", "@avocado/math": "^4.0.0",
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"debug": "4.3.1" "debug": "4.3.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -22,13 +22,13 @@
"@avocado/behavior": "^4.0.0", "@avocado/behavior": "^4.0.0",
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"debug": "4.3.1" "debug": "4.3.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -27,16 +27,16 @@
"@avocado/s13n": "^4.0.0", "@avocado/s13n": "^4.0.0",
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/redux": "^3.0.0", "@flecks/redux": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"@humus/app": "^4.0.0", "@humus/app": "^4.0.0",
"debug": "4.3.1", "debug": "4.3.1",
"express": "^4.17.1" "express": "^4.17.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }