import * as Types from '../../../../types/world/worldTypes';
import * as THREE from 'three';
import * as CONSTANTS from '../../../../types/world/worldConstants';
import addZonesToScene from './addZonesToScene';

export default function loadZones(
    lines: Types.RefLines,
    floorGroupZone: Types.RefGroup
) {
    if (!floorGroupZone.current) return
    floorGroupZone.current.children = [];
    const zones = lines.current.filter((line) => line[0][3] && line[1][3] === CONSTANTS.lineConfig.zoneName);

    if (zones.length > 0) {
        zones.forEach((zone: Types.Line) => {
            addZonesToScene(zone, floorGroupZone, new THREE.Color(CONSTANTS.zoneConfig.color))
        })
    }
}