import { ResourceDescriptor, QueryDescriptor, Mut } from 'thyseus';
import { Entity, Mut, Query, Res } from "thyseus";
import { CharacterController } from "../../components";
import { PhysicsStore } from "../../resources";
export function saveCharacters(physicsStore: Res<PhysicsStore>, characters: Query<[
    Entity,
    Mut<CharacterController>
]>) {
    for (const [entity, character] of characters) {
        entity.deserialize();
        character.deserialize();
        const object = physicsStore.characterControllers.get(entity.id);
        if (!object)
            continue;
        character.isGrounded = object.computedGrounded();
        entity.serialize();
        character.serialize();
    }
}
saveCharacters.parameters = [new ResourceDescriptor(PhysicsStore), new QueryDescriptor([Entity, new Mut(CharacterController)])];
