import { sceneSystem } from '.';
import { SceneEntity } from '../../entities/scene.entity';

export class SceneSystemRendering {
    static clear(id: number): void {
        mp.players.forEach((p) => p.call('scene:clear', [id]));
    }

    static push(scene: SceneEntity, color?: [number, number, number, number], player?: PlayerMp): void {
        if (player) {
            player.call('scene:push', [scene.id, scene.position, scene.description, scene.dimension, scene.name, scene.expiration, color]);
        } else {
            mp.players.forEach((p) => p.call('scene:push', [scene.id, scene.position, scene.description, scene.dimension, scene.name, scene.expiration, color]));
        }
    }

    static renderVisibleScenesForPlayer(player: PlayerMp): void {
        sceneSystem.getVisibleScenes().forEach((s) => s.render(player));
    }
}
