UNPKG

ts-tiled-converter

Version:

Typescript library to convert tiled map to Studio map

46 lines 2.45 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildLayerWithTileCommandCollection = void 0; var lodash_uniq_1 = __importDefault(require("lodash.uniq")); var buildLayerWithTileCommandCollection = function (splittedLayers) { var _a, _b, _c, _d, _e; var passages = ((_a = splittedLayers.specialLayers.find(function (_a) { var name = _a.name; return name === 'passages'; })) === null || _a === void 0 ? void 0 : _a.layer) || []; var systemTags = ((_b = splittedLayers.specialLayers.find(function (_a) { var name = _a.name; return name === 'systemtags'; })) === null || _b === void 0 ? void 0 : _b.layer) || []; var systemTagsBridge1 = ((_c = splittedLayers.specialLayers.find(function (_a) { var name = _a.name; return name === 'systemtags_bridge1'; })) === null || _c === void 0 ? void 0 : _c.layer) || []; var systemTagsBridge2 = ((_d = splittedLayers.specialLayers.find(function (_a) { var name = _a.name; return name === 'systemtags_bridge2'; })) === null || _d === void 0 ? void 0 : _d.layer) || []; var terrainTags = ((_e = splittedLayers.specialLayers.find(function (_a) { var name = _a.name; return name === 'terrain_tag'; })) === null || _e === void 0 ? void 0 : _e.layer) || []; var priorities = [0, 1, 2, 3, 4, 5].map(function (priority) { return ({ priority: priority }); }); return { commands: { passages: (0, lodash_uniq_1.default)(passages).map(function (passage) { return ({ passage: passage }); }), systemTags: (0, lodash_uniq_1.default)(systemTags.concat(systemTagsBridge1).concat(systemTagsBridge2)).map(function (systemTag) { return ({ systemTag: systemTag }); }), terrainTags: (0, lodash_uniq_1.default)(terrainTags).map(function (terrainTag) { return ({ terrainTag: terrainTag }); }), priorities: priorities, }, passages: passages, systemTags: systemTags, systemTagsBridge1: systemTagsBridge1, systemTagsBridge2: systemTagsBridge2, terrainTags: terrainTags, }; }; exports.buildLayerWithTileCommandCollection = buildLayerWithTileCommandCollection; //# sourceMappingURL=buildLayerWithTileCommandCollection.js.map