feat: evaluation context

This commit is contained in:
cha0s 2019-04-13 16:20:22 -05:00
parent bda4b6383e
commit ffb3657ad8

View File

@ -83,6 +83,7 @@ room.on('entityAdded', (entity) => {
if ('string' === typeof selfEntity) {
if (entity === room.findEntity(selfEntity)) {
selfEntity = entity;
evaluationContext.selfEntity = selfEntity;
// Add back our self entity traits.
for (const type of selfEntityOnlyTraits) {
entity.addTrait(type);
@ -270,3 +271,11 @@ const UiComponent = <Ui
throughputTicker={throughputTicker}
/>;
ReactDOM.render(UiComponent, stage.ui);
// Eval.
const evaluationContext = {
room,
selfEntity,
stage,
};
// Just inject it into global for now.
window.humus = evaluationContext;