chore: ded

This commit is contained in:
cha0s 2021-04-28 00:19:44 -05:00
parent 8c40f81341
commit 813e4a1cda
4 changed files with 2 additions and 94 deletions

View File

@ -1,52 +0,0 @@
import {JsonResource} from '@avocado/resource';
export default class BaseEntity extends JsonResource {
static children(entity) {
return Object.fromEntries(
Object.entries(
Object.values(entity.traits)
.reduce(
(r, {constructor}) => ({
...r,
...constructor.children(entity),
}),
{
addTrait: {
label: 'Add trait',
type: 'void',
args: [],
},
destroy: {
label: 'Destroy',
type: 'void',
args: [],
},
elapsed: {
type: 'number',
},
is: {
type: 'bool',
args: [
{
type: 'string',
label: 'type',
},
],
},
list: {
type: 'entity-list',
},
uptime: {
type: 'number',
},
uri: {
type: 'string',
},
},
),
),
);
}
}

View File

@ -1,14 +1,12 @@
import {gatherWithLatus} from '@latus/core';
import hotEntities from './hot-entities';
import types from './types';
export {default as EntityListView} from './entity-list-view';
export {default as fullEntity} from './full-entity';
export default {
hooks: {
'@avocado/behavior/types': types,
'@avocado/resource/resources': gatherWithLatus(
require.context('./resources', false, /\.js$/),
),

View File

@ -8,9 +8,9 @@ import {
} from '@avocado/core';
import {Synchronized} from '@avocado/s13n';
import {compose, EventEmitter} from '@latus/core';
import {JsonResource} from '@avocado/resource';
import {defineTraitAccessors, enumerateTraitAccessorKeys} from '../accessors';
import BaseEntity from '../base-entity';
import hotEntities from '../hot-entities';
const debug = D('@avocado/entity');
@ -22,7 +22,7 @@ export default (latus) => {
EventEmitter,
Synchronized(latus),
);
return class Entity extends decorate(BaseEntity) {
return class Entity extends decorate(JsonResource) {
#hooks = {};

View File

@ -1,38 +0,0 @@
import BaseEntity from './base-entity';
export default () => ({
entity: {
children: BaseEntity.children,
create: () => null,
infer: (v) => BaseEntity.children === v?.constructor?.children,
},
'entity-list': {
children: () => ({
queryEntities: {
type: 'array',
args: [
{
type: 'rectangle',
},
{
compile: false,
type: 'condition',
},
],
},
queryPoint: {
type: 'array',
args: [
{
type: 'vector',
},
{
compile: false,
type: 'condition',
},
],
},
}),
infer: (v) => !!v?.entities,
},
});