From c58b4056690a4ab8b9a88fde9b2379b8b887d5c5 Mon Sep 17 00:00:00 2001 From: cha0s Date: Tue, 6 Apr 2021 15:43:23 -0500 Subject: [PATCH] refactor: gatherFlat --- TODO.md | 1 + packages/behavior/src/persea/index.js | 4 ++-- packages/behavior/src/persea/traits/behaved.jsx | 2 +- packages/entity/src/persea/index.js | 4 ++-- packages/entity/src/persea/traits/alive.jsx | 3 +-- packages/entity/src/persea/traits/directional.jsx | 2 +- packages/physics/package.json | 1 + packages/physics/src/persea/index.js | 4 ++-- packages/physics/src/persea/traits/collider.jsx | 2 +- packages/physics/src/persea/traits/emitted.jsx | 2 +- packages/physics/src/persea/traits/emitter.jsx | 2 +- packages/sound/src/persea/index.js | 4 ++-- packages/sound/src/persea/traits/audible.jsx | 2 +- packages/timing/src/persea/index.js | 4 ++-- packages/timing/src/persea/traits/animated.jsx | 2 +- 15 files changed, 20 insertions(+), 19 deletions(-) diff --git a/TODO.md b/TODO.md index a9a6f7f..6e4317c 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,4 @@ - entities should probably belong to room instead of layer - don't tick entities without any ticking traits - ~~production build~~ +- Trait::initializeStateProperties should be rolled into ::load() diff --git a/packages/behavior/src/persea/index.js b/packages/behavior/src/persea/index.js index d17e931..f73fb91 100644 --- a/packages/behavior/src/persea/index.js +++ b/packages/behavior/src/persea/index.js @@ -1,4 +1,4 @@ -import {gatherWithLatus} from '@latus/core'; +import {gatherFlat} from '@latus/core'; import Condition from './components/condition'; import Expression from './components/expression'; @@ -22,7 +22,7 @@ export default { literal: Literal, }); }, - '@avocado/traits/components': gatherWithLatus( + '@avocado/traits/components': gatherFlat( require.context('./traits', false, /\.jsx$/), ), }, diff --git a/packages/behavior/src/persea/traits/behaved.jsx b/packages/behavior/src/persea/traits/behaved.jsx index 5092b9f..31ea5b7 100644 --- a/packages/behavior/src/persea/traits/behaved.jsx +++ b/packages/behavior/src/persea/traits/behaved.jsx @@ -160,4 +160,4 @@ Behaved.propTypes = { path: PropTypes.string.isRequired, }; -export default () => Behaved; +export default Behaved; diff --git a/packages/entity/src/persea/index.js b/packages/entity/src/persea/index.js index 559ab9c..2fe4768 100644 --- a/packages/entity/src/persea/index.js +++ b/packages/entity/src/persea/index.js @@ -1,4 +1,4 @@ -import {gatherWithLatus} from '@latus/core'; +import {gatherFlat} from '@latus/core'; import EntityController from './controllers/entity'; @@ -11,7 +11,7 @@ export default { '@avocado/resource/persea.controllers': () => [ EntityController, ], - '@avocado/traits/components': gatherWithLatus( + '@avocado/traits/components': gatherFlat( require.context('./traits', false, /\.jsx$/), ), }, diff --git a/packages/entity/src/persea/traits/alive.jsx b/packages/entity/src/persea/traits/alive.jsx index 60efa23..313b6a1 100644 --- a/packages/entity/src/persea/traits/alive.jsx +++ b/packages/entity/src/persea/traits/alive.jsx @@ -1,5 +1,4 @@ import './alive.scss'; - import {join} from 'path'; import {Number} from '@avocado/persea'; @@ -91,4 +90,4 @@ Alive.propTypes = { path: PropTypes.string.isRequired, }; -export default () => Alive; +export default Alive; diff --git a/packages/entity/src/persea/traits/directional.jsx b/packages/entity/src/persea/traits/directional.jsx index 3b10b2c..7324e81 100644 --- a/packages/entity/src/persea/traits/directional.jsx +++ b/packages/entity/src/persea/traits/directional.jsx @@ -67,4 +67,4 @@ Directional.propTypes = { path: PropTypes.string.isRequired, }; -export default () => Directional; +export default Directional; diff --git a/packages/physics/package.json b/packages/physics/package.json index d00a9bf..e9c8ad5 100644 --- a/packages/physics/package.json +++ b/packages/physics/package.json @@ -23,6 +23,7 @@ "@avocado/entity": "^2.0.0", "@avocado/graphics": "^2.0.0", "@avocado/math": "^2.0.0", + "@avocado/persea": "^1.0.0", "@avocado/react": "^1.0.0", "@avocado/resource": "^2.0.0", "@avocado/s13n": "^2.0.0", diff --git a/packages/physics/src/persea/index.js b/packages/physics/src/persea/index.js index feba002..52a53e4 100644 --- a/packages/physics/src/persea/index.js +++ b/packages/physics/src/persea/index.js @@ -1,8 +1,8 @@ -import {gatherWithLatus} from '@latus/core'; +import {gatherFlat} from '@latus/core'; export default { hooks: { - '@avocado/traits/components': gatherWithLatus( + '@avocado/traits/components': gatherFlat( require.context('./traits', false, /\.jsx$/), ), }, diff --git a/packages/physics/src/persea/traits/collider.jsx b/packages/physics/src/persea/traits/collider.jsx index 505bc04..f5d6743 100644 --- a/packages/physics/src/persea/traits/collider.jsx +++ b/packages/physics/src/persea/traits/collider.jsx @@ -140,4 +140,4 @@ Collider.propTypes = { path: PropTypes.string.isRequired, }; -export default () => Collider; +export default Collider; diff --git a/packages/physics/src/persea/traits/emitted.jsx b/packages/physics/src/persea/traits/emitted.jsx index 681a379..b07080d 100644 --- a/packages/physics/src/persea/traits/emitted.jsx +++ b/packages/physics/src/persea/traits/emitted.jsx @@ -179,4 +179,4 @@ Emitted.propTypes = { path: PropTypes.string.isRequired, }; -export default () => Emitted; +export default Emitted; diff --git a/packages/physics/src/persea/traits/emitter.jsx b/packages/physics/src/persea/traits/emitter.jsx index eacbcd7..18df92c 100644 --- a/packages/physics/src/persea/traits/emitter.jsx +++ b/packages/physics/src/persea/traits/emitter.jsx @@ -54,4 +54,4 @@ Emitter.propTypes = { path: PropTypes.string.isRequired, }; -export default () => Emitter; +export default Emitter; diff --git a/packages/sound/src/persea/index.js b/packages/sound/src/persea/index.js index 7345890..5da65e0 100644 --- a/packages/sound/src/persea/index.js +++ b/packages/sound/src/persea/index.js @@ -1,4 +1,4 @@ -import {gatherWithLatus} from '@latus/core'; +import {gatherFlat} from '@latus/core'; import AudioController from './controllers/audio'; import SoundController from './controllers/sound'; @@ -14,7 +14,7 @@ export default { AudioController, SoundController, ], - '@avocado/traits/components': gatherWithLatus( + '@avocado/traits/components': gatherFlat( require.context('./traits', false, /\.jsx$/), ), }, diff --git a/packages/sound/src/persea/traits/audible.jsx b/packages/sound/src/persea/traits/audible.jsx index a0f0d82..de66d64 100644 --- a/packages/sound/src/persea/traits/audible.jsx +++ b/packages/sound/src/persea/traits/audible.jsx @@ -105,4 +105,4 @@ Audible.propTypes = { }; Audible.propTypes = {}; -export default () => Audible; +export default Audible; diff --git a/packages/timing/src/persea/index.js b/packages/timing/src/persea/index.js index eb7c265..133db74 100644 --- a/packages/timing/src/persea/index.js +++ b/packages/timing/src/persea/index.js @@ -1,4 +1,4 @@ -import {gatherWithLatus} from '@latus/core'; +import {gatherFlat} from '@latus/core'; import AnimationController from './controllers/animation'; @@ -11,7 +11,7 @@ export default { '@avocado/resource/persea.controllers': () => [ AnimationController, ], - '@avocado/traits/components': gatherWithLatus( + '@avocado/traits/components': gatherFlat( require.context('./traits', false, /\.jsx$/), ), }, diff --git a/packages/timing/src/persea/traits/animated.jsx b/packages/timing/src/persea/traits/animated.jsx index 443c740..a33281c 100644 --- a/packages/timing/src/persea/traits/animated.jsx +++ b/packages/timing/src/persea/traits/animated.jsx @@ -80,4 +80,4 @@ Animated.propTypes = { }; Animated.propTypes = {}; -export default () => Animated; +export default Animated;