refactor: selfEntity

This commit is contained in:
cha0s 2019-10-16 01:09:58 -05:00
parent 20837ea2f0
commit f106371fca
2 changed files with 2 additions and 3 deletions

View File

@ -28,7 +28,7 @@ const MenuComponent = ({app}) => {
opened ? 'open' : '',
)}>
<Inventory selfEntity={selfEntity} />
<QuickStatus app={app} />
<QuickStatus selfEntity={selfEntity} />
<WorldTime worldTime={app.worldTime} />
<Hotbar selfEntity={selfEntity} />
</div>

View File

@ -11,8 +11,7 @@ const decorate = compose(
contempo(require('./quick-status.raw.scss').default),
);
const QuickStatusComponent = ({app}) => {
const selfEntity = usePropertyChange(app, 'selfEntity');
const QuickStatusComponent = ({selfEntity}) => {
const life = usePropertyChange(selfEntity, 'life', 0);
const maxLife = usePropertyChange(selfEntity, 'maxLife', 0);
const width = life / maxLife;