Ignore polygons with fewer than three sides

This commit is contained in:
Jordan Eldredge 2020-04-29 14:12:07 -07:00
parent 9ebfa7b795
commit 0bd8b09ecf

View file

@ -26,6 +26,11 @@ export default function regionParser(regionStr: string): RegionData {
let pointIndex = 0;
const polygons = pointCounts.map((numStr) => {
const num = Number(numStr);
if (num < 3) {
// What use is a polygon with less than three sides?
pointIndex += num;
return null;
}
const polygon = points.slice(pointIndex, pointIndex + num).join(" ");
if (!polygon.length) {
// It's possible that the skin author specified more polygons than provided points.