fix: dialogues and entities on ECS change
This commit is contained in:
parent
ad18da3b93
commit
dd456743f8
|
@ -16,6 +16,11 @@ export default class Interlocutor extends Component {
|
|||
return class InterlocutorInstance extends super.instanceFromSchema() {
|
||||
dialogues = {};
|
||||
id = 0;
|
||||
destroy() {
|
||||
for (const key in this.dialogues) {
|
||||
this.dialogues[key].onClose();
|
||||
}
|
||||
}
|
||||
dialogue(specification) {
|
||||
Component.markChange(this.entity, 'dialogue', {[this.id++]: specification});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {useState} from 'react';
|
||||
|
||||
import {usePacket} from '@/context/client.js';
|
||||
import {useEcs, useEcsTick} from '@/context/ecs.js';
|
||||
import {parseLetters} from '@/dialogue.js';
|
||||
|
||||
|
@ -8,6 +9,9 @@ import Entity from './entity.jsx';
|
|||
export default function Entities({camera, scale, setMonopolizers}) {
|
||||
const [ecs] = useEcs();
|
||||
const [entities, setEntities] = useState({});
|
||||
usePacket('EcsChange', async () => {
|
||||
setEntities({});
|
||||
}, [setEntities]);
|
||||
useEcsTick((payload) => {
|
||||
if (!ecs) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user