refactor: tidy
This commit is contained in:
parent
ece20dfcd7
commit
dfc7665856
|
@ -13,9 +13,8 @@ export default class Emitter extends Component {
|
|||
}
|
||||
instanceFromSchema() {
|
||||
const Component = this;
|
||||
const Instance = super.instanceFromSchema();
|
||||
return class EmitterInstance extends Instance {
|
||||
emitting = [];
|
||||
return class EmitterInstance extends super.instanceFromSchema() {
|
||||
emitting = {};
|
||||
id = 0;
|
||||
emit(specification) {
|
||||
Component.markChange(this.entity, 'emit', {[this.id++]: specification});
|
||||
|
|
|
@ -28,19 +28,20 @@ export default function Entities({filters}) {
|
|||
}
|
||||
const updatedEntities = {...entities};
|
||||
for (const id in payload) {
|
||||
if ('1' === id) {
|
||||
continue;
|
||||
}
|
||||
const update = payload[id];
|
||||
if (false === update) {
|
||||
delete updatedEntities[id];
|
||||
}
|
||||
else {
|
||||
if ('1' !== id) {
|
||||
updatedEntities[id] = ecs.get(id);
|
||||
if (update.Emitter?.emit) {
|
||||
updatedEntities[id].Emitter.emitting = {
|
||||
...updatedEntities[id].Emitter.emitting,
|
||||
...update.Emitter.emit,
|
||||
};
|
||||
}
|
||||
updatedEntities[id] = ecs.get(id);
|
||||
if (update.Emitter?.emit) {
|
||||
updatedEntities[id].Emitter.emitting = {
|
||||
...updatedEntities[id].Emitter.emitting,
|
||||
...update.Emitter.emit,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,23 +368,21 @@ export default function Ui({disconnected}) {
|
|||
ref={gameRef}
|
||||
>
|
||||
<Pixi applyFilters={applyFilters} scale={scale} />
|
||||
{mainEntity && (
|
||||
<Dom devtoolsIsOpen={devtoolsIsOpen}>
|
||||
<HotBar
|
||||
active={activeSlot}
|
||||
onActivate={(i) => {
|
||||
client.send({
|
||||
type: 'Action',
|
||||
payload: {type: 'swapSlots', value: [0, i + 1]},
|
||||
});
|
||||
}}
|
||||
slots={hotbarSlots}
|
||||
/>
|
||||
{showDisconnected && (
|
||||
<Disconnected />
|
||||
)}
|
||||
</Dom>
|
||||
)}
|
||||
<Dom devtoolsIsOpen={devtoolsIsOpen}>
|
||||
<HotBar
|
||||
active={activeSlot}
|
||||
onActivate={(i) => {
|
||||
client.send({
|
||||
type: 'Action',
|
||||
payload: {type: 'swapSlots', value: [0, i + 1]},
|
||||
});
|
||||
}}
|
||||
slots={hotbarSlots}
|
||||
/>
|
||||
{showDisconnected && (
|
||||
<Disconnected />
|
||||
)}
|
||||
</Dom>
|
||||
</div>
|
||||
<div className={[styles.devtools, devtoolsIsOpen && styles.devtoolsIsOpen].filter(Boolean).join(' ')}>
|
||||
<Devtools
|
||||
|
|
Loading…
Reference in New Issue
Block a user