Mid-Simulator/dist/game.js.map

8 lines
279 KiB
Text
Raw Normal View History

2022-04-18 01:14:39 +00:00
{
"version": 3,
"sources": ["../node_modules/kaboom/src/utils.ts", "../node_modules/kaboom/src/math.ts", "../node_modules/kaboom/src/fps.ts", "../node_modules/kaboom/src/timer.ts", "../node_modules/kaboom/src/kaboom.ts", "../code/main.js"],
"sourcesContent": ["export class IDList<T> extends Map<number, T> {\n\t_lastID: number;\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis._lastID = 0;\n\t}\n\tpush(v: T): number {\n\t\tconst id = this._lastID;\n\t\tthis.set(id, v);\n\t\tthis._lastID++;\n\t\treturn id;\n\t}\n\tpushd(v: T): () => void {\n\t\tconst id = this.push(v);\n\t\treturn () => this.delete(id);\n\t}\n}\n\nexport function deepEq(o1: any, o2: any): boolean {\n\tconst t1 = typeof o1;\n\tconst t2 = typeof o2;\n\tif (t1 !== t2) {\n\t\treturn false;\n\t}\n\tif (t1 === \"object\" && t2 === \"object\") {\n\t\tconst k1 = Object.keys(o1);\n\t\tconst k2 = Object.keys(o2);\n\t\tif (k1.length !== k2.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (const k of k1) {\n\t\t\tconst v1 = o1[k];\n\t\t\tconst v2 = o2[k];\n\t\t\tif (!(typeof v1 === \"function\" && typeof v2 === \"function\")) {\n\t\t\t\tif (!deepEq(v1, v2)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\treturn o1 === o2;\n}\n\nexport function downloadURL(url: string, filename: string) {\n\tconst a = document.createElement(\"a\");\n\tdocument.body.appendChild(a);\n\ta.setAttribute(\"style\", \"display: none\");\n\ta.href = url;\n\ta.download = filename;\n\ta.click();\n\tdocument.body.removeChild(a);\n}\n\nexport function downloadBlob(blob: Blob, filename: string) {\n\tconst url = URL.createObjectURL(blob);\n\tdownloadURL(url, filename);\n\tURL.revokeObjectURL(url);\n}\n\nexport function isDataURL(str: string) {\n\treturn str.match(/^data:\\w+\\/\\w+;base64,.+/);\n}\n\nexport const uid = (() => {\n\tlet id = 0;\n\treturn () => id++;\n})();\n\nconst warned = new Set();\n\nexport function deprecateMsg(oldName: string, newName: string) {\n\tif (!warned.has(oldName)) {\n\t\twarned.add(oldName);\n\t\tconsole.warn(`${oldName} is deprecated. Use ${newName} instead.`);\n\t}\n}\n\nexport const deprecate = (oldName: string, newName: string, newFunc: (...args) => any) => (...args) => {\n\tdeprecateMsg(oldName, newName);\n\treturn newFunc(...args);\n};\n", "import {\n\tVec4,\n\tPoint,\n\tPolygon,\n\tArea,\n} from \"./types\";\n\nimport {\n\tdeprecateMsg,\n} from \"./utils\";\n\nexport function deg2rad(deg: number): number {\n\treturn deg * Math.PI / 180;\n}\n\nexport function rad2deg(rad: number): number {\n\treturn rad * 180 / Math.PI;\n}\n\nexport function clamp(\n\tval: number,\n\tmin: number,\n\tmax: number,\n): number {\n\tif (min > max) {\n\t\treturn clamp(val, max, min);\n\t}\n\treturn Math.min(Math.max(val, min), max);\n}\n\nexport function lerp(\n\ta: number,\n\tb: number,\n\tt: number,\n): number {\n\treturn a + (b - a) * t;\n}\n\nexport function map(\n\tv: number,\n\tl1: number,\n\th1: number,\n\tl2: number,\n\th2: number,\n): number {\n\treturn l2 + (v - l1) / (h1 - l1) * (h2 - l2);\n}\n\nexport function mapc(\n\tv: number,\n\tl1: number,\n\th1: number,\n\tl2: number,\n\th2: number,\n): number {\n\treturn clamp(map(v, l1, h1, l2, h2), l2, h2);\n}\n\nexport class Vec2 {\n\tx: number = 0;\n\ty: number = 0;\n\tconstructor(x: number = 0, y: number = x) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t}\n\tstatic fromAngle(deg: number) {\n\t\tconst angle = deg2rad(deg);\n\t\treturn new Vec2(Math.cos(angle), Math.sin(angle));\n\t}\n\tstatic LEFT = new Vec2(-1, 0);\n\tstatic RIGHT = new Vec2(1, 0);\n\tstatic UP = new Vec2(0, -1);\n\tstatic DOWN = new Vec2(0, 1);\n\tclone(): Vec2 {\n\t\treturn new Vec2(this.x, this.y);\n\t}\n\tadd(...args): Vec2 {\n\t\tconst p2 = vec2(...args);\n\t\treturn new Vec2(this.x + p2.x, this.y + p2.y);\n\t}\n\tsub(...args): Vec2 {\n\t\tconst p2 = vec2(...args);\n\t\treturn new Vec2(this.x - p2.x, this.y - p2.y);\n\t}\n\tscale(...args): Vec2 {\n\t\tconst s = vec2(...args);\n\t\treturn new Vec2(this.x * s.x, this.y * s.y);\n\t}\n\tdist(...args): number {\n\t\tconst p2 = vec2(...args);\n\t\treturn Math.sqrt(\n\t\t\t(this.x - p2.x) * (this.x - p2.x)\n\t\t\t+ (this.y - p2.y) * (this.y - p2.y)\n\t\t);\n\t}\n\tlen(): number {\n\t\treturn this.dist(new Vec2(0, 0));\n\t}\n\tunit(): Vec2 {\n\t\treturn this.scale(1 / this.len());\n\t}\n\tnormal(): Vec2 {\n\t\treturn n
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAA,IAAA,qCAAwB,IAAe;IAE7C,eAAe,GAAM;AACpB,YAAM,GAAG;AAFV,QAAA,MAAA;AAGC,WAAK,UAAU;;IAEhB,KAAK,GAAc;AAClB,UAAM,IAAK,KAAK;AAChB,aAAA,KAAK,IAAI,GAAI,IACb,KAAK,WACE;;IAER,MAAM,GAAkB;AACvB,UAAM,IAAK,KAAK,KAAK;AACrB,aAAO,MAAM,KAAK,OAAO;;KAdpB;AAAA,IAAA,GAAA;AAkBA,cAAgB,GAAS,GAAkB;AACjD,QAAM,IAAK,OAAO,GACZ,IAAK,OAAO;AAClB,QAAI,MAAO;AACV,aAAO;AAER,QAAI,MAAO,YAAY,MAAO,UAAU;AACvC,UAAM,IAAK,OAAO,KAAK,IACjB,IAAK,OAAO,KAAK;AACvB,UAAI,EAAG,WAAW,EAAG;AACpB,eAAO;AAER,eAAW,KAAK,GAAI;AACnB,YAAM,IAAK,EAA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