feat: client and server traits

This commit is contained in:
cha0s 2019-04-14 20:39:27 -05:00
parent ca26fb4828
commit 0f737601fb
5 changed files with 17 additions and 12 deletions

View File

@ -51,6 +51,7 @@ room.on('entityAdded', (entity) => {
// Traits that shouldn't be on client. // Traits that shouldn't be on client.
const noClientTraits = [ const noClientTraits = [
'behaved', 'behaved',
'informed',
]; ];
// If there's no physics, then remove physical trait. // If there's no physics, then remove physical trait.
if (!room.world) { if (!room.world) {

View File

@ -7,8 +7,8 @@ import {Trait} from '@avocado/entity';
import {Rectangle, Vector} from '@avocado/math'; import {Rectangle, Vector} from '@avocado/math';
import {Packer, Synchronizer} from '@avocado/state'; import {Packer, Synchronizer} from '@avocado/state';
import {KeysPacket} from '../packet/keys'; import {KeysPacket} from '../../common/packet/keys';
import {StatePacket} from '../packet/state'; import {StatePacket} from '../../common/packet/state';
const decorate = compose( const decorate = compose(
); );

View File

@ -34,6 +34,9 @@ config.devServer = {
watchContentBase: true, watchContentBase: true,
}; };
config.devtool = 'eval-source-map'; config.devtool = 'eval-source-map';
config.module.rules[1].use.options.paths.push(
path.resolve(__dirname, 'client'),
);
config.node = { config.node = {
fs: 'empty', fs: 'empty',
path: 'empty', path: 'empty',

View File

@ -18,16 +18,14 @@ const config = {
}, },
{ {
test: /register-traits.js/, test: /register-traits.js/,
use: [ use: {
{ loader: './generate-trait-defs',
loader: './generate-trait-defs', options: {
options: { paths: [
paths: [ path.resolve(__dirname, 'common'),
path.resolve(__dirname, 'common'), ],
], }
} },
},
],
}, },
], ],
}, },

View File

@ -19,6 +19,9 @@ config.externals = [
whitelist: /@avocado/, whitelist: /@avocado/,
}), }),
]; ];
config.module.rules[1].use.options.paths.push(
path.resolve(__dirname, 'server'),
);
const nodeArgs = []; const nodeArgs = [];
if (process.argv.find((arg) => '--prof' === arg)) { if (process.argv.find((arg) => '--prof' === arg)) {
nodeArgs.push('--prof'); nodeArgs.push('--prof');