Lint code

This commit is contained in:
2026-08-05 19:01:45 +02:00
parent 082d1b9723
commit aafbdc658e
46 changed files with 357 additions and 357 deletions
+2 -1
View File
@@ -7,7 +7,8 @@
"start": "node pony-town.js --login --admin --game", "start": "node pony-town.js --login --admin --game",
"startlocal": "node pony-town.js --login --admin --game --local", "startlocal": "node pony-town.js --login --admin --game --local",
"start-inspect": "node --inspect pony-town.js --login --admin --game --local", "start-inspect": "node --inspect pony-town.js --login --admin --game --local",
"lint": "tslint -c tslint.json src/ts/**/*.ts", "lint": "eslint \"src/ts/**/*.ts\"",
"lint-fix": "eslint \"src/ts/**/*.ts\" --fix",
"dev": "gulp dev", "dev": "gulp dev",
"dev-sprites": "gulp dev --sprites", "dev-sprites": "gulp dev --sprites",
"sw-generate": "workbox generateSW workbox-config.js && gulp patchWebWorker", "sw-generate": "workbox generateSW workbox-config.js && gulp patchWebWorker",
+3 -4
View File
@@ -9,11 +9,10 @@ import './client/polyfils';
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
if (document.body.getAttribute('data-debug') !== 'true' || localStorage.production) { if (document.body.getAttribute('data-debug') !== 'true' || localStorage.production) {
enableProdMode(); enableProdMode();
} }
if (typeof module !== 'undefined' && (module as any).hot) { if (typeof module !== 'undefined' && (module as any).hot) {
(module as any).hot.accept(); (module as any).hot.accept();
} }
+11 -11
View File
@@ -198,17 +198,17 @@ export function createDefaultButtonActions(): ButtonActionSlot[] {
ExpressionExtra.Zzz | ExpressionExtra.Cry | ExpressionExtra.Hearts | ExpressionExtra.Blush)) ExpressionExtra.Zzz | ExpressionExtra.Cry | ExpressionExtra.Hearts | ExpressionExtra.Blush))
}, },
] : [ ] : [
{ action: getActionAction('boop') }, { action: getActionAction('boop') },
{ action: getActionAction('down') }, { action: getActionAction('down') },
{ action: getActionAction('up') }, { action: getActionAction('up') },
{ action: getActionAction('turn-head') }, { action: getActionAction('turn-head') },
{ action: getActionAction('magic') }, { action: getActionAction('magic') },
{ action: expressionButtonAction(undefined) }, { action: expressionButtonAction(undefined) },
{ action: expressionButtonAction(createExpression(Eye.Closed, Eye.Closed, Muzzle.Smile)) }, { action: expressionButtonAction(createExpression(Eye.Closed, Eye.Closed, Muzzle.Smile)) },
{ action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral3, Muzzle.Smile)) }, { action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral3, Muzzle.Smile)) },
{ action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral, Muzzle.Scrunch, Iris.Forward, Iris.Up)) }, { action: expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral, Muzzle.Scrunch, Iris.Forward, Iris.Up)) },
{ action: expressionButtonAction(createExpression(Eye.Angry, Eye.Angry, Muzzle.Scrunch)) }, { action: expressionButtonAction(createExpression(Eye.Angry, Eye.Angry, Muzzle.Scrunch)) },
]; ];
} }
export function serializeActions(slots: ButtonActionSlot[]): string { export function serializeActions(slots: ButtonActionSlot[]): string {
+1 -1
View File
@@ -338,7 +338,7 @@ export class PonyTownGame implements Game {
} }
apply = (func: () => void) => { apply = (func: () => void) => {
return this.zone.run(func); return this.zone.run(func);
} };
applyChanges = () => this.zone.run(() => { }); applyChanges = () => this.zone.run(() => { });
private getScale() { private getScale() {
const defaultScale = pixelRatio() > 1 ? 3 : 2; const defaultScale = pixelRatio() > 1 ? 3 : 2;
+1 -1
View File
@@ -1,4 +1,4 @@
import { isError } from "../common/utils"; import { isError } from '../common/utils';
export interface Game { export interface Game {
fps: number; fps: number;
+2 -2
View File
@@ -133,12 +133,12 @@ export class GamePadController implements InputController {
} }
private gamepadconnected = (e: Event) => { private gamepadconnected = (e: Event) => {
this.gamepadIndex = (e as GamepadEvent).gamepad.index; this.gamepadIndex = (e as GamepadEvent).gamepad.index;
} };
private gamepaddisconnected = (e: Event) => { private gamepaddisconnected = (e: Event) => {
if (this.gamepadIndex === (e as GamepadEvent).gamepad.index) { if (this.gamepadIndex === (e as GamepadEvent).gamepad.index) {
this.scanGamepads(); this.scanGamepads();
} }
} };
} }
function readAxis(manager: InputManager, keyX: Key, keyY: Key, axisX: number, axisY: number, zeroed: boolean): boolean { function readAxis(manager: InputManager, keyX: Key, keyY: Key, axisX: number, axisY: number, zeroed: boolean): boolean {
+3 -3
View File
@@ -70,7 +70,7 @@ export class KeyboardController implements InputController {
this.stack.push(code); this.stack.push(code);
} }
} }
} };
private keyup = (e: KeyboardEvent) => { private keyup = (e: KeyboardEvent) => {
let code = fixKeyCode(e.keyCode); let code = fixKeyCode(e.keyCode);
@@ -89,8 +89,8 @@ export class KeyboardController implements InputController {
} }
removeItem(this.stack, code); removeItem(this.stack, code);
} };
private blur = () => { private blur = () => {
this.manager.clear(); this.manager.clear();
} };
} }
+7 -7
View File
@@ -49,7 +49,7 @@ export class MouseController implements InputController {
this.manager.setValue(Key.MOUSE_X, Math.floor(e.clientX - rect.left)); this.manager.setValue(Key.MOUSE_X, Math.floor(e.clientX - rect.left));
this.manager.setValue(Key.MOUSE_Y, Math.floor(e.clientY - rect.top)); this.manager.setValue(Key.MOUSE_Y, Math.floor(e.clientY - rect.top));
} }
} };
private mousedown = (e: MouseEvent) => { private mousedown = (e: MouseEvent) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@@ -61,29 +61,29 @@ export class MouseController implements InputController {
if (button) { if (button) {
this.manager.setValue(button, 1); this.manager.setValue(button, 1);
} }
} };
private mouseup = (e: MouseEvent) => { private mouseup = (e: MouseEvent) => {
const button = MOUSE_BUTTONS[e.button]; const button = MOUSE_BUTTONS[e.button];
if (button) { if (button) {
this.manager.setValue(button, 0); this.manager.setValue(button, 0);
} }
} };
private mousewheel: any = (e: WheelEvent) => { private mousewheel: any = (e: WheelEvent) => {
this.manager.addValue(Key.MOUSE_WHEEL_X, clamp(e.deltaX, -1, 1)); this.manager.addValue(Key.MOUSE_WHEEL_X, clamp(e.deltaX, -1, 1));
this.manager.addValue(Key.MOUSE_WHEEL_Y, clamp(e.deltaY, -1, 1)); this.manager.addValue(Key.MOUSE_WHEEL_Y, clamp(e.deltaY, -1, 1));
} };
private contextmenu = (e: Event) => { private contextmenu = (e: Event) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
} };
private click = (e: Event) => { private click = (e: Event) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
} };
private blur = () => { private blur = () => {
for (const button of MOUSE_BUTTONS) { for (const button of MOUSE_BUTTONS) {
this.manager.setValue(button, 0); this.manager.setValue(button, 0);
} }
} };
} }
+4 -4
View File
@@ -152,7 +152,7 @@ export class TouchController implements InputController {
this.touch2Id = touch.identifier; this.touch2Id = touch.identifier;
} }
} }
} };
private touchmove = (e: any) => { private touchmove = (e: any) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@@ -165,7 +165,7 @@ export class TouchController implements InputController {
this.manager.setValue(Key.MOUSE_Y, this.touchCurrent.y); this.manager.setValue(Key.MOUSE_Y, this.touchCurrent.y);
this.updateInput(); this.updateInput();
} }
} };
private touchend = (e: any) => { private touchend = (e: any) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@@ -188,10 +188,10 @@ export class TouchController implements InputController {
this.manager.setValue(Key.TOUCH_SECOND_CLICK, 1); this.manager.setValue(Key.TOUCH_SECOND_CLICK, 1);
this.touch2Id = -1; this.touch2Id = -1;
} }
} };
private blur = () => { private blur = () => {
this.reset(); this.reset();
} };
private getTouchXY(touch: Touch) { private getTouchXY(touch: Touch) {
const { left, top } = this.element!.getBoundingClientRect(); const { left, top } = this.element!.getBoundingClientRect();
+6 -6
View File
@@ -1,9 +1,9 @@
import { noop, once } from "lodash"; import { noop, once } from 'lodash';
import { getUrl } from "./rev"; import { getUrl } from './rev';
import { spriteSheets } from "../generated/sprites"; import { spriteSheets } from '../generated/sprites';
import { createCanvas, loadImage } from "../common/canvasUtils"; import { createCanvas, loadImage } from '../common/canvasUtils';
import { createFonts } from "../common/fonts"; import { createFonts } from '../common/fonts';
import { SpriteSheet } from "../common/interfaces"; import { SpriteSheet } from '../common/interfaces';
export function createSpriteUtils() { export function createSpriteUtils() {
createFonts(); createFonts();
+1 -1
View File
@@ -33,7 +33,7 @@ export class ClientActionsTemplate implements SocketClient {
left(_reason: LeaveReason) {} left(_reason: LeaveReason) {}
@Method({ binary: [BinNotificationId, BinEntityId, Bin.Str, Bin.Str, Bin.Str, Bin.U8] }) @Method({ binary: [BinNotificationId, BinEntityId, Bin.Str, Bin.Str, Bin.Str, Bin.U8] })
addNotification(_id: number, _entityId: number, _name: string, _message: string, _note: string, _flags: NotificationFlags) {} addNotification(_id: number, _entityId: number, _name: string, _message: string, _note: string, _flags: NotificationFlags) {}
@Method({ binary: [BinNotificationId] }) @Method({ binary: [BinNotificationId] })
removeNotification(_id: number) { } removeNotification(_id: number) { }
@Method({ binary: [BinEntityId, BinEntityId] }) @Method({ binary: [BinEntityId, BinEntityId] })
+1 -1
View File
@@ -31,4 +31,4 @@ export const enum MapFlags {
EditableEntities = 2, EditableEntities = 2,
EditableTiles = 4, EditableTiles = 4,
EdibleGrass = 8, EdibleGrass = 8,
} }
+6 -6
View File
@@ -294,12 +294,12 @@ function syncLockedBasePonyInfo<T>(
getFillOf2(info.backMane, defaultColor), getFillOf2(info.backMane, defaultColor),
getFillOf2(info.tail, defaultColor), getFillOf2(info.tail, defaultColor),
], [ ], [
info.coatOutline, info.coatOutline,
info.eyeColorRight, info.eyeColorRight,
getOutlineOf2(info.mane, defaultColor), getOutlineOf2(info.mane, defaultColor),
getOutlineOf2(info.backMane, defaultColor), getOutlineOf2(info.backMane, defaultColor),
getOutlineOf2(info.tail, defaultColor), getOutlineOf2(info.tail, defaultColor),
]); ]);
return info; return info;
} }
+3 -3
View File
@@ -123,7 +123,7 @@ export function isValid(c: number): boolean {
|| (c >= 0x231a && c <= 0x231b) || (c >= 0x23e9 && c <= 0x23fa) // emoji || (c >= 0x231a && c <= 0x231b) || (c >= 0x23e9 && c <= 0x23fa) // emoji
|| (c >= 0x1f900 && c <= 0x1f9ff) // Supplemental Symbols and Pictographs || (c >= 0x1f900 && c <= 0x1f9ff) // Supplemental Symbols and Pictographs
|| otherValid.has(c) // other symbols || otherValid.has(c) // other symbols
; ;
} }
export function isValid2(c: number): boolean { export function isValid2(c: number): boolean {
@@ -156,13 +156,13 @@ export function isValid2(c: number): boolean {
|| (c >= 0x1f0a0 && c <= 0x1f0ae) || (c >= 0x1f0b1 && c <= 0x1f0bf) || (c >= 0x1f0c1 && c <= 0x1f0cf) || (c >= 0x1f0a0 && c <= 0x1f0ae) || (c >= 0x1f0b1 && c <= 0x1f0bf) || (c >= 0x1f0c1 && c <= 0x1f0cf)
|| (c >= 0x1f0d1 && c <= 0x1f0df) || (c >= 0x1f0e0 && c <= 0x1f0f5) // Playing Cards || (c >= 0x1f0d1 && c <= 0x1f0df) || (c >= 0x1f0e0 && c <= 0x1f0f5) // Playing Cards
|| (c >= 0x1f1e6 && c <= 0x1f1ff) // Enclosed Alphanumeric Supplement (regional indicators) || (c >= 0x1f1e6 && c <= 0x1f1ff) // Enclosed Alphanumeric Supplement (regional indicators)
; ;
} }
function isInvalid(c: number): boolean { function isInvalid(c: number): boolean {
return c === 0x1f595 // middle finger emoji return c === 0x1f595 // middle finger emoji
|| c === 0x00ad // soft hyphen || c === 0x00ad // soft hyphen
; ;
} }
function isValidForName(c: number): boolean { function isValidForName(c: number): boolean {
@@ -437,7 +437,7 @@ export class AdminAccountDetails implements OnInit, OnDestroy {
} }
highlighCharacter = (char: Character | undefined): boolean => { highlighCharacter = (char: Character | undefined): boolean => {
return !!char && includes(this.ponyNames, char.name.toLowerCase()); return !!char && includes(this.ponyNames, char.name.toLowerCase());
} };
clearSessions() { clearSessions() {
if (this.account) { if (this.account) {
this.clearingSessions = true; this.clearingSessions = true;
@@ -7,7 +7,7 @@ import { transliterate } from 'transliteration';
}) })
export class TranslitPipe implements PipeTransform { export class TranslitPipe implements PipeTransform {
transform(value: string) { transform(value: string) {
if (!value || /^[a-z0-9-_.,\[\]!@#$%^&*{}|\/\\ ]+$/i.test(value)) if (!value || /^[a-z0-9-_.,[]!@#$%^&*{}|\/\\ ]+$/i.test(value))
return undefined; return undefined;
const translit = transliterate(value); const translit = transliterate(value);
@@ -8,7 +8,7 @@ function icon(value: string | undefined, defaultValue: any): any {
const extensions = { const extensions = {
browser: [ browser: [
[/(Amigo|YaBrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION] [/(Amigo|YaBrowser)\/([\w.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]
], ],
}; };
+2 -2
View File
@@ -27,8 +27,8 @@ export class Help {
ngAfterViewInit() { ngAfterViewInit() {
this.route.fragment.subscribe(f => { this.route.fragment.subscribe(f => {
const element = document.querySelector("#" + f); const element = document.querySelector('#' + f);
if (element) setTimeout(() => element.scrollIntoView(), 10); if (element) setTimeout(() => element.scrollIntoView(), 10);
}) });
} }
} }
+1 -1
View File
@@ -79,7 +79,7 @@ export class AdminModel {
console.error(error); console.error(error);
this.error = error.message; this.error = error.message;
return undefined; return undefined;
} };
private checkError = <T>(promise: Promise<T>) => promise.catch(this.handleError) as Promise<T | undefined>; private checkError = <T>(promise: Promise<T>) => promise.catch(this.handleError) as Promise<T | undefined>;
private running = true; private running = true;
private initializedLive = false; private initializedLive = false;
+3 -3
View File
@@ -43,9 +43,9 @@ function getTracks(season: Season, holiday: Holiday, map: MapType) {
'trees-winter', 'trees-winter',
'reindeer-winter', 'reindeer-winter',
] : [ ] : [
'trees', 'trees',
'reindeer', 'reindeer',
]), ]),
'season', 'season',
'ambient', 'ambient',
'building', 'building',
+1 -1
View File
@@ -467,7 +467,7 @@ export class Model {
this.pending = true; this.pending = true;
const alert = !!this.accountAlert ? 'y' : ''; const alert = this.accountAlert ? 'y' : '';
return this.post<JoinResponse>('/api/game/join', { version, ponyId, serverId, alert, url: location.href }) return this.post<JoinResponse>('/api/game/join', { version, ponyId, serverId, alert, url: location.href })
.finally(() => this.pending = false); .finally(() => this.pending = false);
@@ -57,4 +57,4 @@ export class RollbarErrorHandler implements ErrorHandler {
} }
} }
} }
} }
@@ -102,7 +102,7 @@ export class CharacterPreview implements OnDestroy, OnChanges, AfterViewInit {
this.lastFrame = now; this.lastFrame = now;
this.tryDraw(); this.tryDraw();
} }
} };
private tryDraw() { private tryDraw() {
try { try {
this.draw(); this.draw();
@@ -248,10 +248,10 @@ export class ChatBox implements AfterViewInit, OnDestroy {
private say(message: string, chatType: ChatType, entityId: number): boolean { private say(message: string, chatType: ChatType, entityId: number): boolean {
this.game.lastChatMessageType = chatType; this.game.lastChatMessageType = chatType;
if (message.toLowerCase().startsWith('/shrug')) { if (message.toLowerCase().startsWith('/shrug')) {
var rawMessage = message.substring(6); let rawMessage = message.substring(6);
return !!this.game.send(server => return !!this.game.send(server =>
server.say(entityId, ((rawMessage !== '') ? rawMessage + ' ' : '') + `¯\\_(ツ)_/¯`, server.say(entityId, ((rawMessage !== '') ? rawMessage + ' ' : '') + `¯\\_(ツ)_/¯`,
chatType)); chatType));
} else { } else {
return !!this.game.send(server => server.say(entityId, message, chatType)); return !!this.game.send(server => server.say(entityId, message, chatType));
} }
@@ -694,17 +694,17 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
scrollHandler = () => { scrollHandler = () => {
this.scrollingToEnd = true; this.scrollingToEnd = true;
this.scroll.nativeElement.scrollTop = 99999; this.scroll.nativeElement.scrollTop = 99999;
} };
clickNameHandler = (message: ChatLogMessage) => { clickNameHandler = (message: ChatLogMessage) => {
this.zone.run(() => this.nameClick.emit(message)); this.zone.run(() => this.nameClick.emit(message));
} };
clickLabel = (message: ChatLogMessage) => { clickLabel = (message: ChatLogMessage) => {
this.zone.run(() => { this.zone.run(() => {
if (message.label) { if (message.label) {
this.toggleType.emit(message.label); this.toggleType.emit(message.label);
} }
}); });
} };
private clearList() { private clearList() {
removeAllNodes(this.linesElement); removeAllNodes(this.linesElement);
} }
@@ -772,12 +772,12 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
return findEntityFromMessages(id, this.whisper) || return findEntityFromMessages(id, this.whisper) ||
findEntityFromMessages(id, this.party) || findEntityFromMessages(id, this.party) ||
findEntityFromMessages(id, this.local); findEntityFromMessages(id, this.local);
} };
private findEntityFromMessagesByName = (name: string): FakeEntity | undefined => { private findEntityFromMessagesByName = (name: string): FakeEntity | undefined => {
return findEntityFromMessagesByName(name, this.game.playerId, this.whisper) || return findEntityFromMessagesByName(name, this.game.playerId, this.whisper) ||
findEntityFromMessagesByName(name, this.game.playerId, this.party) || findEntityFromMessagesByName(name, this.game.playerId, this.party) ||
findEntityFromMessagesByName(name, this.game.playerId, this.local); findEntityFromMessagesByName(name, this.game.playerId, this.local);
} };
} }
function findEntityFromMessages(id: number, messages: ChatLogMessage[]): FakeEntity | undefined { function findEntityFromMessages(id: number, messages: ChatLogMessage[]): FakeEntity | undefined {
@@ -199,7 +199,7 @@ export class Dropdown {
} else if (this.autoClose && e.keyCode === 27) { // esc } else if (this.autoClose && e.keyCode === 27) { // esc
this.close(); this.close();
} }
} };
private canvasCloseHandler: any = () => this.close(); private canvasCloseHandler: any = () => this.close();
} }
@@ -54,5 +54,5 @@ export class FocusTrap implements OnInit, OnDestroy {
this.lastActiveElement.focus(); this.lastActiveElement.focus();
} }
} }
} };
} }
+1 -1
View File
@@ -166,4 +166,4 @@ const declarations = [
exports: [declarations] exports: [declarations]
}) })
export class SharedModule { export class SharedModule {
} }
@@ -30,7 +30,7 @@ export class SignInBox implements OnInit {
.then(data => { .then(data => {
this.mocks = data; this.mocks = data;
}) })
.catch(noop) .catch(noop);
} }
async createNew() { async createNew() {
const name = prompt('Account name'); const name = prompt('Account name');
@@ -32,7 +32,7 @@ export class ToolsFrame {
if (this.popoverIsOpen) { if (this.popoverIsOpen) {
this.togglePopover(); this.togglePopover();
} }
} };
togglePopover() { togglePopover() {
const rect = (this.element.nativeElement as HTMLElement).getBoundingClientRect(); const rect = (this.element.nativeElement as HTMLElement).getBoundingClientRect();
this.placement = (rect.left < (window.innerWidth / 2)) ? 'right' : 'left'; this.placement = (rect.left < (window.innerWidth / 2)) ? 'right' : 'left';
@@ -472,8 +472,8 @@ export class ToolsAnimation implements OnInit, OnDestroy {
} }
} else { } else {
const frames = this.headAnimation.frames const frames = this.headAnimation.frames
.map(f => [f.duration, '[' + compressHeadFrame(f).join(', ') + ']']) .map(f => [f.duration, '[' + compressHeadFrame(f).join(', ') + ']'])
.map(([repeat, frame]) => parseInt(`${repeat}`, 10) > 1 ? `...repeat(${repeat}, ${frame})` : frame); .map(([repeat, frame]) => parseInt(`${repeat}`, 10) > 1 ? `...repeat(${repeat}, ${frame})` : frame);
console.log(`frames: [\n${frames.map(x => `\t${x}`).join(',\n')}\n]`); console.log(`frames: [\n${frames.map(x => `\t${x}`).join(',\n')}\n]`);
} }
} }
@@ -170,5 +170,5 @@ export class ToolsRegions implements OnInit, OnDestroy {
this.player.y += dy * delta * PONY_SPEED_TROT; this.player.y += dy * delta * PONY_SPEED_TROT;
this.update(); this.update();
} }
} };
} }
+36 -36
View File
@@ -179,96 +179,96 @@ export const GAMEPAD_MAPPINGS: GamepadMapping[] = [
browser('Chrome', 'Logitech Logitech Dual Action (Vendor: 046d Product: c216)', 'Linux'), browser('Chrome', 'Logitech Logitech Dual Action (Vendor: 046d Product: c216)', 'Linux'),
browser('Firefox', '046d-c216-Logitech Logitech Dual Action', 'Linux'), browser('Firefox', '046d-c216-Logitech Logitech Dual Action', 'Linux'),
], ],
axes(0, 1, 2, 3, index(4), index(5)), axes(0, 1, 2, 3, index(4), index(5)),
buttons(1, 2, 0, 3, 8, 9, axisDirection(5, 1), axisDirection(4, -1), axisDirection(4, 1), axisDirection(5, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), buttons(1, 2, 0, 3, 8, 9, axisDirection(5, 1), axisDirection(4, -1), axisDirection(4, 1), axisDirection(5, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)),
gamepad('Logitech F310 (DirectInput) Chrome Windows/OSX', [ gamepad('Logitech F310 (DirectInput) Chrome Windows/OSX', [
browser('Chrome', 'Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)', 'Mac OS X'), browser('Chrome', 'Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)', 'Mac OS X'),
browser('Chrome', 'Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)', 'Windows NT'), browser('Chrome', 'Logitech Dual Action (STANDARD GAMEPAD Vendor: 046d Product: c216)', 'Windows NT'),
], ],
axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)),
gamepad('Logitech F310 (DirectInput) Firefox OSX', [ gamepad('Logitech F310 (DirectInput) Firefox OSX', [
browser('Firefox', '46d-c216-Logitech Dual Action', 'Mac OS X'), browser('Firefox', '46d-c216-Logitech Dual Action', 'Mac OS X'),
], ],
axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)),
buttons(1, 2, 0, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(2, 1), axisDirection(1, -1), axisDirection(1, 1), axisDirection(2, -1), index(6), 5, 11, axisDirection(4, 1), axisDirection(3, -1), undefined, axisDirection(4, -1), index(7), undefined)), buttons(1, 2, 0, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(2, 1), axisDirection(1, -1), axisDirection(1, 1), axisDirection(2, -1), index(6), 5, 11, axisDirection(4, 1), axisDirection(3, -1), undefined, axisDirection(4, -1), index(7), undefined)),
gamepad('Logitech F310 (DirectInput) Firefox Windows', [ gamepad('Logitech F310 (DirectInput) Firefox Windows', [
browser('Firefox', '046d-c216-Logitech Dual Action', 'Windows NT'), browser('Firefox', '046d-c216-Logitech Dual Action', 'Windows NT'),
], ],
axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)),
buttons(1, 2, 0, 3, 8, 9, index(14), index(15), index(16), index(13), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), buttons(1, 2, 0, 3, 8, 9, index(14), index(15), index(16), index(13), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)),
gamepad('Logitech F310 (XInput) Chrome Linux', [ gamepad('Logitech F310 (XInput) Chrome Linux', [
browser('Chrome', 'Logitech Gamepad F310 (STANDARD GAMEPAD Vendor: 046d Product: c21d)', 'Linux'), browser('Chrome', 'Logitech Gamepad F310 (STANDARD GAMEPAD Vendor: 046d Product: c21d)', 'Linux'),
], ],
axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)),
gamepad('Logitech F310 (XInput) Firefox Linux', [ gamepad('Logitech F310 (XInput) Firefox Linux', [
browser('Firefox', '046d-c21d-Logitech Gamepad F310', 'Linux'), browser('Firefox', '046d-c21d-Logitech Gamepad F310', 'Linux'),
], ],
axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)),
buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)),
gamepad('PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268) Chrome OSX Linux', [ gamepad('PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268) Chrome OSX Linux', [
browser('Chrome', 'PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)', 'Mac OS X'), browser('Chrome', 'PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)', 'Mac OS X'),
browser('Chrome', 'Sony PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)', 'Linux'), browser('Chrome', 'Sony PLAYSTATION(R)3 Controller (STANDARD GAMEPAD Vendor: 054c Product: 0268)', 'Linux'),
], ],
axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)),
gamepad('054c-0268-Sony PLAYSTATION(R)3 Controller Firefox Linux', [ gamepad('054c-0268-Sony PLAYSTATION(R)3 Controller Firefox Linux', [
browser('Firefox', '054c-0268-Sony PLAYSTATION(R)3 Controller', 'Linux'), browser('Firefox', '054c-0268-Sony PLAYSTATION(R)3 Controller', 'Linux'),
], ],
axes(0, 1, 2, 3, index(6), index(7), index(12), index(13)), axes(0, 1, 2, 3, index(6), index(7), index(12), index(13)),
buttons(14, 13, 15, 12, 0, 3, index(6), index(7), index(5), index(4), 10, 1, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(8), 11, 2, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(9), 16)), buttons(14, 13, 15, 12, 0, 3, index(6), index(7), index(5), index(4), 10, 1, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(8), 11, 2, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(9), 16)),
gamepad('PS4 Chrome Linux', [ gamepad('PS4 Chrome Linux', [
browser('Chrome', 'Sony Computer Entertainment Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Linux'), browser('Chrome', 'Sony Computer Entertainment Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Linux'),
], ],
axes(0, 1, 2, 3, positiveNegative(15, 14), positiveNegative(13, 12), positive(6), positive(7)), axes(0, 1, 2, 3, positiveNegative(15, 14), positiveNegative(13, 12), positive(6), positive(7)),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)),
gamepad('PS4 Chrome Windows/OSX', [ gamepad('PS4 Chrome Windows/OSX', [
browser('Chrome', 'Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Windows NT'), browser('Chrome', 'Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Windows NT'),
browser('Chrome', 'Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Mac OS X'), browser('Chrome', 'Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)', 'Mac OS X'),
], ],
axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)),
gamepad('PS4 Firefox Linux', [ gamepad('PS4 Firefox Linux', [
browser('Firefox', '054c-05c4-Sony Computer Entertainment Wireless Controller', 'Linux'), browser('Firefox', '054c-05c4-Sony Computer Entertainment Wireless Controller', 'Linux'),
], ],
axes(0, 1, 2, 5, index(6), index(7), index(3), index(4)), axes(0, 1, 2, 5, index(6), index(7), index(3), index(4)),
buttons(1, 2, 0, 3, 8, 9, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)), buttons(1, 2, 0, 3, 8, 9, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)),
gamepad('PS4 Firefox OSX', [ gamepad('PS4 Firefox OSX', [
browser('Firefox', '54c-5c4-Wireless Controller', 'Mac OS X'), browser('Firefox', '54c-5c4-Wireless Controller', 'Mac OS X'),
], ],
axes(0, 1, 2, 5, index(6), index(7)), axes(0, 1, 2, 5, index(6), index(7)),
buttons(0, 1, 2, 3, 8, 9, index(15), index(16), index(17), index(14), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)), buttons(0, 1, 2, 3, 8, 9, index(15), index(16), index(17), index(14), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(5, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(5, -1), index(7), 12)),
gamepad('XBone Chrome Linux', [ gamepad('XBone Chrome Linux', [
browser('Chrome', 'Microsoft Controller (Vendor: 045e Product: 02d1)', 'Linux'), browser('Chrome', 'Microsoft Controller (Vendor: 045e Product: 02d1)', 'Linux'),
], ],
axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)),
buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)),
gamepad('Xbox One Chrome OSX Linux', [ gamepad('Xbox One Chrome OSX Linux', [
browser('Chrome', '©Microsoft Corporation Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)', 'Linux'), browser('Chrome', '©Microsoft Corporation Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)', 'Linux'),
browser('Chrome', 'Xbox One Controller (STANDARD GAMEPAD Vendor: 02d1 Product: 045e)', 'Mac OS X'), browser('Chrome', 'Xbox One Controller (STANDARD GAMEPAD Vendor: 02d1 Product: 045e)', 'Mac OS X'),
], ],
axes(0, 1, 2, 3), axes(0, 1, 2, 3),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)),
gamepad('Xbone Firefox Linux', [ gamepad('Xbone Firefox Linux', [
browser('Firefox', '045e-02d1-Microsoft X-Box One pad', 'Linux'), browser('Firefox', '045e-02d1-Microsoft X-Box One pad', 'Linux'),
], ],
axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)),
buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)),
gamepad('Xbox 360 Chrome Windows/OSX', [ gamepad('Xbox 360 Chrome Windows/OSX', [
browser('Chrome', 'Xbox 360 Controller (STANDARD GAMEPAD Vendor: 028e Product: 045e)', 'Mac OS X'), browser('Chrome', 'Xbox 360 Controller (STANDARD GAMEPAD Vendor: 028e Product: 045e)', 'Mac OS X'),
browser('Chrome', 'Xbox 360 Controller (XInput STANDARD GAMEPAD)', 'Windows NT'), browser('Chrome', 'Xbox 360 Controller (XInput STANDARD GAMEPAD)', 'Windows NT'),
], ],
axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), 16)),
gamepad('Xbox 360 Firefox Linux', [ gamepad('Xbox 360 Firefox Linux', [
browser('Firefox', '045e-028e-Microsoft X-Box 360 pad', 'Linux'), browser('Firefox', '045e-028e-Microsoft X-Box 360 pad', 'Linux'),
], ],
axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)), axes(0, 1, 3, 4, index(6), index(7), index(2), index(5)),
buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)), buttons(0, 1, 2, 3, 6, 7, axisDirection(7, 1), axisDirection(6, -1), axisDirection(6, 1), axisDirection(7, -1), 4, 9, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), axisDirection(2, 1), 5, 10, axisDirection(4, 1), axisDirection(3, -1), axisDirection(3, 1), axisDirection(4, -1), axisDirection(5, 1), 8)),
gamepad('Xbox 360 FF Windows', [ gamepad('Xbox 360 FF Windows', [
browser('Firefox', 'xinput', 'Windows NT'), browser('Firefox', 'xinput', 'Windows NT'),
], ],
axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)), axes(0, 1, 2, 3, index(6), index(7), undefined, index(5)),
buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)), buttons(0, 1, 2, 3, 8, 9, index(13), index(14), index(15), index(12), 4, 10, axisDirection(1, 1), axisDirection(0, -1), axisDirection(0, 1), axisDirection(1, -1), index(6), 5, 11, axisDirection(3, 1), axisDirection(2, -1), axisDirection(2, 1), axisDirection(3, -1), index(7), undefined)),
]; ];
+2 -2
View File
@@ -56,7 +56,7 @@ export class Shader {
const attribs = vertexCode.match(/^attribute [a-zA-Z0-9_]+ ([a-zA-Z0-9_]+)/mg)!; const attribs = vertexCode.match(/^attribute [a-zA-Z0-9_]+ ([a-zA-Z0-9_]+)/mg)!;
for (var i = 0; i < attribs.length; ++i) { for (let i = 0; i < attribs.length; ++i) {
const [, name] = /attribute [a-zA-Z0-9_]+ ([a-zA-Z0-9_]+)/.exec(attribs[i])!; const [, name] = /attribute [a-zA-Z0-9_]+ ([a-zA-Z0-9_]+)/.exec(attribs[i])!;
gl.bindAttribLocation(program, i, name); gl.bindAttribLocation(program, i, name);
} }
@@ -121,4 +121,4 @@ export function disposeShaderProgramData(gl: WebGLRenderingContext, data: Shader
} catch (e) { } catch (e) {
DEVELOPMENT && console.error(e); DEVELOPMENT && console.error(e);
} }
} }
+8 -8
View File
@@ -116,7 +116,7 @@ export async function getChat(search: string, date: string, caseInsensitive: boo
const options = { maxBuffer: 1 * 1024 * 1024 }; // 1MB const options = { maxBuffer: 1 * 1024 * 1024 }; // 1MB
async function fetchChatlog(lines: number) { async function fetchChatlog(lines: number) {
const logFile = paths.pathTo('logs', `info.${format(date, 'yyyyMMdd')}.log`) const logFile = paths.pathTo('logs', `info.${format(date, 'yyyyMMdd')}.log`);
const { stdout } = await execAsync(`grep ${flags}"${query}" "${logFile}" | tail -n ${lines}`, options); const { stdout } = await execAsync(`grep ${flags}"${query}" "${logFile}" | tail -n ${lines}`, options);
return stdout; return stdout;
} }
@@ -243,13 +243,13 @@ export async function getAccountDetails(accountId: ID): Promise<AccountDetails>
invitesSent: invitesSent!.map(convertInvite), invitesSent: invitesSent!.map(convertInvite),
state: account.state || {}, state: account.state || {},
} : { } : {
merges: [], merges: [],
banLog: [], banLog: [],
supporterLog: [], supporterLog: [],
invitesReceived: [], invitesReceived: [],
invitesSent: [], invitesSent: [],
state: {}, state: {},
}; };
} }
export async function getOtherStats(service: AdminService): Promise<OtherStats> { export async function getOtherStats(service: AdminService): Promise<OtherStats> {
+1 -1
View File
@@ -96,7 +96,7 @@ if (!DEVELOPMENT && !TESTS &&
|| INSECURE_RANDOM_VALUES.includes(config.secret) || INSECURE_RANDOM_VALUES.includes(config.secret)
|| INSECURE_RANDOM_VALUES.includes(config.token))) { || INSECURE_RANDOM_VALUES.includes(config.token))) {
console.error( console.error(
` `
================================================================================ ================================================================================
WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
+15 -15
View File
@@ -115,25 +115,25 @@ export function createWoodenFenceMaker(world: World, map: ServerMap) {
...repeat(2, entities.woodenFencePole4), ...repeat(2, entities.woodenFencePole4),
entities.woodenFencePole5, entities.woodenFencePole5,
], [ ], [
...repeat(5, entities.woodenFenceBeamH1), ...repeat(5, entities.woodenFenceBeamH1),
...repeat(5, entities.woodenFenceBeamH2), ...repeat(5, entities.woodenFenceBeamH2),
...repeat(5, entities.woodenFenceBeamH3), ...repeat(5, entities.woodenFenceBeamH3),
entities.woodenFenceBeamH4, entities.woodenFenceBeamH4,
entities.woodenFenceBeamH5, entities.woodenFenceBeamH5,
entities.woodenFenceBeamH6, entities.woodenFenceBeamH6,
], [ ], [
entities.woodenFenceBeamV1, entities.woodenFenceBeamV1,
entities.woodenFenceBeamV2, entities.woodenFenceBeamV2,
entities.woodenFenceBeamV3, entities.woodenFenceBeamV3,
]); ]);
} }
export function createStoneWallFenceMaker(world: World, map: ServerMap) { export function createStoneWallFenceMaker(world: World, map: ServerMap) {
return createFenceMaker(world, map, 2, [ return createFenceMaker(world, map, 2, [
entities.stoneWallPole1, entities.stoneWallPole1,
], [ ], [
entities.stoneWallBeamH1, entities.stoneWallBeamH1,
], [ ], [
entities.stoneWallBeamV1, entities.stoneWallBeamV1,
]); ]);
} }
@@ -68,5 +68,5 @@ export class CollectableController implements Controller {
this.pick(client, entity); this.pick(client, entity);
} }
} }
} };
} }
+2 -2
View File
@@ -25,8 +25,8 @@ export class PlantController implements Controller {
private interact: Interact = (entity, client) => { private interact: Interact = (entity, client) => {
this.world.removeEntity(entity, this.map); this.world.removeEntity(entity, this.map);
removeItem(this.plants, entity); removeItem(this.plants, entity);
this.config.onPick && this.config.onPick(entity, client); this.config?.onPick?.(entity, client);
} };
private nextSpawn = 0; private nextSpawn = 0;
constructor(private world: World, private map: ServerMap, private config: PlantConfig) { constructor(private world: World, private map: ServerMap, private config: PlantConfig) {
} }
+3 -3
View File
@@ -350,7 +350,7 @@ export function authRoutes(
app.post('/create-account', wrap(server, async (data) => { app.post('/create-account', wrap(server, async (data) => {
const accountCount = await Account.countDocuments(); const accountCount = await Account.countDocuments();
const account = await Account.create({ const account = await Account.create({
name: data.body.name, name: data.body.name,
roles: accountCount === 0 ? ['superadmin'] : undefined roles: accountCount === 0 ? ['superadmin'] : undefined
@@ -359,11 +359,11 @@ export function authRoutes(
return [account._id.toString(), account.name]; return [account._id.toString(), account.name];
})); }));
passport.use(new LocalStrategy((login, _pass, done) => passport.use(new LocalStrategy((login, _pass, done) =>
Account.findById(login) Account.findById(login)
.then(data => done(undefined, data as any)) .then(data => done(undefined, data as any))
.catch(e => done(e))) .catch(e => done(e)))
); );
app.get('/local', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/failed-login' })); app.get('/local', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/failed-login' }));
} }
+1 -1
View File
@@ -160,7 +160,7 @@ app.use(require('cookie-parser')());
if (args.login || args.admin) { if (args.login || args.admin) {
passport.serializeUser<string>((account, done) => done(null, (account as IAccount)._id.toString())); passport.serializeUser<string>((account, done) => done(null, (account as IAccount)._id.toString()));
passport.deserializeUser<string>(async (id, done) => { passport.deserializeUser<string>(async (id, done) => {
try { try {
const account = await Account.findById(id).exec(); const account = await Account.findById(id).exec();
done(undefined, account && !isBanned(account) ? account : false); done(undefined, account && !isBanned(account) ? account : false);
+6 -6
View File
@@ -84,19 +84,19 @@ export class StatsTracker {
this.logStat( this.logStat(
url || (req.baseUrl + req.path), typeof result === 'string' ? result.length : JSON.stringify(result).length); url || (req.baseUrl + req.path), typeof result === 'string' ? result.length : JSON.stringify(result).length);
} }
} };
logSwearing = () => { logSwearing = () => {
this.dailySwearing++; this.dailySwearing++;
} };
logSpamming = () => { logSpamming = () => {
this.dailySpamming++; this.dailySpamming++;
} };
logRecvStats = (id: number, name: string, binary: boolean, size: number) => { logRecvStats = (id: number, name: string, binary: boolean, size: number) => {
this.logSocketStats(this.recvStats, id, name, binary, size); this.logSocketStats(this.recvStats, id, name, binary, size);
} };
logSendStats = (id: number, name: string, binary: boolean, size: number) => { logSendStats = (id: number, name: string, binary: boolean, size: number) => {
this.logSocketStats(this.sendStats, id, name, binary, size); this.logSocketStats(this.sendStats, id, name, binary, size);
} };
private logSocketStats(stats: (SocketStats | undefined)[], id: number, name: string, binary: boolean, size: number) { private logSocketStats(stats: (SocketStats | undefined)[], id: number, name: string, binary: boolean, size: number) {
const entry = stats[id] || (stats[id] = { const entry = stats[id] || (stats[id] = {
id, id,
@@ -112,7 +112,7 @@ export class StatsTracker {
lastHourSize: new ByteSize(), lastHourSize: new ByteSize(),
}); });
if (!!binary) { if (binary) {
entry.countBin++; entry.countBin++;
} else { } else {
entry.countStr++; entry.countStr++;
+201 -201
View File
@@ -201,24 +201,24 @@ describe('compressPony', () => {
lockEyeColor: true, lockEyeColor: true,
lockCoatOutline: true, lockCoatOutline: true,
}, { }, {
customOutlines: true, customOutlines: true,
lockEyes: true, lockEyes: true,
lockEyeColor: true, lockEyeColor: true,
lockCoatOutline: true, lockCoatOutline: true,
coatOutline: undefined, coatOutline: undefined,
eyeColorLeft: undefined, eyeColorLeft: undefined,
eyeOpennessLeft: undefined, eyeOpennessLeft: undefined,
eyeWhitesLeft: undefined, eyeWhitesLeft: undefined,
eyelashColorLeft: undefined, eyelashColorLeft: undefined,
})); }));
it('removes lockBackLegAccessory', test({ it('removes lockBackLegAccessory', test({
lockBackLegAccessory: true lockBackLegAccessory: true
}, { }, {
coatOutline: undefined, coatOutline: undefined,
eyeWhitesLeft: undefined, eyeWhitesLeft: undefined,
eyelashColorLeft: undefined, eyelashColorLeft: undefined,
})); }));
it('set', test({ it('set', test({
customOutlines: true, customOutlines: true,
@@ -243,19 +243,19 @@ describe('compressPony', () => {
pattern: 1 pattern: 1
} }
}, { }, {
customOutlines: true, customOutlines: true,
lockCoatOutline: false, lockCoatOutline: false,
eyeWhitesLeft: undefined, eyeWhitesLeft: undefined,
eyelashColorLeft: undefined, eyelashColorLeft: undefined,
tail: { tail: {
type: 1, type: 1,
pattern: 1, pattern: 1,
fills: [BLACK, BLACK, BLACK, BLACK, BLACK], fills: [BLACK, BLACK, BLACK, BLACK, BLACK],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: [BLACK, BLACK, BLACK, BLACK, BLACK], outlines: [BLACK, BLACK, BLACK, BLACK, BLACK],
lockOutlines: [false, false, false, false, false, true], lockOutlines: [false, false, false, false, false, true],
} }
})); }));
it('missing set color', test({ it('missing set color', test({
customOutlines: true, customOutlines: true,
@@ -268,29 +268,29 @@ describe('compressPony', () => {
lockOutlines: [false, false, false, false, false, true], lockOutlines: [false, false, false, false, false, true],
} }
}, { }, {
customOutlines: true, customOutlines: true,
lockCoatOutline: false, lockCoatOutline: false,
eyeWhitesLeft: undefined, eyeWhitesLeft: undefined,
eyelashColorLeft: undefined, eyelashColorLeft: undefined,
tail: { tail: {
type: 1, type: 1,
pattern: 1, pattern: 1,
fills: [RED, BLUE, BLACK, ORANGE, CYAN], fills: [RED, BLUE, BLACK, ORANGE, CYAN],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: [RED, BLACK, RED, RED, RED], outlines: [RED, BLACK, RED, RED, RED],
lockOutlines: [false, false, false, false, false, true], lockOutlines: [false, false, false, false, false, true],
} }
})); }));
it('cm', test({ it('cm', test({
cm: [undefined, RED, undefined, BLUE] as any, cm: [undefined, RED, undefined, BLUE] as any,
}, { }, {
cm: [TRANSPARENT, RED, TRANSPARENT, BLUE], cm: [TRANSPARENT, RED, TRANSPARENT, BLUE],
cmFlip: false, cmFlip: false,
coatOutline: undefined, coatOutline: undefined,
eyeWhitesLeft: undefined, eyeWhitesLeft: undefined,
eyelashColorLeft: undefined, eyelashColorLeft: undefined,
})); }));
}); });
describe('decompressPony()', () => { describe('decompressPony()', () => {
@@ -345,51 +345,51 @@ describe('compressPony', () => {
it('eyeColorLeft', test({ it('eyeColorLeft', test({
eyeColorLeft: 'ff00ff', eyeColorLeft: 'ff00ff',
}, { }, {
coatFill: '000000', coatFill: '000000',
coatOutline: '000000', coatOutline: '000000',
eyeColorLeft: 'ff00ff', eyeColorLeft: 'ff00ff',
eyeColorRight: '000000', eyeColorRight: '000000',
})); }));
it('eyeColorLeft + eyeColorRight', test({ it('eyeColorLeft + eyeColorRight', test({
eyeColorLeft: 'ff00ff', eyeColorLeft: 'ff00ff',
eyeColorRight: '00ff00', eyeColorRight: '00ff00',
}, { }, {
coatFill: '000000', coatFill: '000000',
coatOutline: '000000', coatOutline: '000000',
eyeColorLeft: 'ff00ff', eyeColorLeft: 'ff00ff',
eyeColorRight: '00ff00', eyeColorRight: '00ff00',
})); }));
it('eyeColorLeft + eyeColorRight (locked)', test({ it('eyeColorLeft + eyeColorRight (locked)', test({
lockEyeColor: true, lockEyeColor: true,
eyeColorLeft: '00ff00', eyeColorLeft: '00ff00',
eyeColorRight: 'ff00ff', eyeColorRight: 'ff00ff',
}, { }, {
lockEyes: false, lockEyes: false,
lockEyeColor: true, lockEyeColor: true,
customOutlines: false, customOutlines: false,
coatFill: '000000', coatFill: '000000',
coatOutline: '000000', coatOutline: '000000',
eyeColorLeft: 'ff00ff', eyeColorLeft: 'ff00ff',
eyeColorRight: 'ff00ff', eyeColorRight: 'ff00ff',
})); }));
it('eyeshadow', test({ it('eyeshadow', test({
eyeshadow: true, eyeshadow: true,
eyeshadowColor: 'ff00ff', eyeshadowColor: 'ff00ff',
}, { }, {
eyeshadow: true, eyeshadow: true,
eyeshadowColor: 'ff00ff', eyeshadowColor: 'ff00ff',
coatFill: '000000', coatFill: '000000',
coatOutline: '000000', coatOutline: '000000',
eyeColorLeft: '000000', eyeColorLeft: '000000',
eyeColorRight: '000000', eyeColorRight: '000000',
eyeWhites: 'ffffff', eyeWhites: 'ffffff',
lockEyes: false, lockEyes: false,
lockEyeColor: false, lockEyeColor: false,
customOutlines: false, customOutlines: false,
})); }));
it('cm', test({ cm: ['ff0000', '', '00ff00'] }, { cm: ['ff0000', '', '00ff00'], cmFlip: false })); it('cm', test({ cm: ['ff0000', '', '00ff00'] }, { cm: ['ff0000', '', '00ff00'], cmFlip: false }));
@@ -397,9 +397,9 @@ describe('compressPony', () => {
cm: ['ff0000', '', '00ff00'], cm: ['ff0000', '', '00ff00'],
cmFlip: true, cmFlip: true,
}, { }, {
cm: ['ff0000', '', '00ff00'], cm: ['ff0000', '', '00ff00'],
cmFlip: true, cmFlip: true,
})); }));
it('all locked', test({ it('all locked', test({
tail: { tail: {
@@ -409,15 +409,15 @@ describe('compressPony', () => {
lockFills: [true, true, true, true, true, true], lockFills: [true, true, true, true, true, true],
} }
}, { }, {
tail: { tail: {
type: 2, type: 2,
pattern: 1, pattern: 1,
fills: [undefined, undefined, undefined, undefined, undefined, undefined], fills: [undefined, undefined, undefined, undefined, undefined, undefined],
lockFills: [true, true, true, true, true, true], lockFills: [true, true, true, true, true, true],
outlines: [undefined, undefined, undefined, undefined, undefined, undefined], outlines: [undefined, undefined, undefined, undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('set', test({ it('set', test({
mane: { mane: {
@@ -427,15 +427,15 @@ describe('compressPony', () => {
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
} }
}, { }, {
mane: { mane: {
type: 1, type: 1,
pattern: 1, pattern: 1,
fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0', 'ff000f'], fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0', 'ff000f'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', 'b3000a'], outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', 'b3000a'],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('0 colors', test({ it('0 colors', test({
ears: { ears: {
@@ -445,15 +445,15 @@ describe('compressPony', () => {
lockFills: [false], lockFills: [false],
} }
}, { }, {
ears: { ears: {
type: 0, type: 0,
pattern: 0, pattern: 0,
fills: ['000000'], fills: ['000000'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['000000', undefined, undefined, undefined, undefined, undefined], outlines: ['000000', undefined, undefined, undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('extraAccessory', test({ it('extraAccessory', test({
extraAccessory: { extraAccessory: {
@@ -463,15 +463,15 @@ describe('compressPony', () => {
lockFills: [false, false, false, false, false], lockFills: [false, false, false, false, false],
} }
}, { }, {
extraAccessory: { extraAccessory: {
type: 0, type: 0,
pattern: 0, pattern: 0,
fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0'], fills: ['f0f0f0', 'ff0000', 'fff000', 'ff0f00', 'ff00f0'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', undefined], outlines: ['a8a8a8', 'b30000', 'b3a800', 'b30b00', 'b300a8', undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('neckAccessory', test({ it('neckAccessory', test({
neckAccessory: { type: 0, pattern: 0 } neckAccessory: { type: 0, pattern: 0 }
@@ -491,23 +491,23 @@ describe('compressPony', () => {
lockFills: [true, false, true], lockFills: [true, false, true],
}, },
}, { }, {
mane: { mane: {
type: 1, type: 1,
pattern: 0, pattern: 0,
fills: ['ff0000'], fills: ['ff0000'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], outlines: ['b30000', undefined, undefined, undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
}, },
backMane: { backMane: {
type: 15, type: 15,
pattern: 1, pattern: 1,
fills: ['ff0000', '00ff00', 'ff0000'], fills: ['ff0000', '00ff00', 'ff0000'],
lockFills: [true, false, true, false, false, false], lockFills: [true, false, true, false, false, false],
outlines: ['b30000', '00b300', 'b30000', undefined, undefined, undefined], outlines: ['b30000', '00b300', 'b30000', undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
}, },
})); }));
it('locked back hooves', test({ it('locked back hooves', test({
frontHooves: { frontHooves: {
@@ -521,23 +521,23 @@ describe('compressPony', () => {
lockFills: [true], lockFills: [true],
} }
}, { }, {
frontHooves: { frontHooves: {
type: 0, type: 0,
pattern: 0, pattern: 0,
fills: ['ff0000'], fills: ['ff0000'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], outlines: ['b30000', undefined, undefined, undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
}, },
backHooves: { backHooves: {
type: 1, type: 1,
pattern: 0, pattern: 0,
fills: ['ff0000'], fills: ['ff0000'],
lockFills: [true, false, false, false, false, false], lockFills: [true, false, false, false, false, false],
outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], outlines: ['b30000', undefined, undefined, undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('back mane', test({ it('back mane', test({
mane: { mane: {
@@ -552,23 +552,23 @@ describe('compressPony', () => {
lockFills: [false, false, true, true, true, true], lockFills: [false, false, true, true, true, true],
} }
}, { }, {
mane: { mane: {
type: 3, type: 3,
pattern: 1, pattern: 1,
fills: ['000000', 'ffffff', '000000', '000000', '000000', '000000'], fills: ['000000', 'ffffff', '000000', '000000', '000000', '000000'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['000000', 'b3b3b3', '000000', '000000', '000000', '000000'], outlines: ['000000', 'b3b3b3', '000000', '000000', '000000', '000000'],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
}, },
backMane: { backMane: {
type: 2, type: 2,
pattern: 1, pattern: 1,
fills: ['ffffff', 'ff0000', 'ffffff', 'ffffff', 'ffffff', 'ffffff'], fills: ['ffffff', 'ff0000', 'ffffff', 'ffffff', 'ffffff', 'ffffff'],
lockFills: [false, false, true, true, true, true], lockFills: [false, false, true, true, true, true],
outlines: ['b3b3b3', 'b30000', 'b3b3b3', 'b3b3b3', 'b3b3b3', 'b3b3b3'], outlines: ['b3b3b3', 'b30000', 'b3b3b3', 'b3b3b3', 'b3b3b3', 'b3b3b3'],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('chest accessory (adds default sleeve if missing)', test({ it('chest accessory (adds default sleeve if missing)', test({
chestAccessory: { chestAccessory: {
@@ -577,23 +577,23 @@ describe('compressPony', () => {
fills: ['ff0000', '00ff00', '0000ff'], fills: ['ff0000', '00ff00', '0000ff'],
} }
}, { }, {
chestAccessory: { chestAccessory: {
type: 2, type: 2,
pattern: 8, pattern: 8,
fills: ['ff0000', '00ff00', '0000ff'], fills: ['ff0000', '00ff00', '0000ff'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['b30000', '00b300', '0000b3', undefined, undefined, undefined], outlines: ['b30000', '00b300', '0000b3', undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
}, },
sleeveAccessory: { sleeveAccessory: {
type: 0, type: 0,
pattern: 0, pattern: 0,
fills: ['ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000'], fills: ['ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000', 'ff0000'],
lockFills: [true, true, true, true, true, true], lockFills: [true, true, true, true, true, true],
outlines: ['b30000', 'b30000', 'b30000', 'b30000', 'b30000', 'b30000'], outlines: ['b30000', 'b30000', 'b30000', 'b30000', 'b30000', 'b30000'],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('back leg accessory', test({ it('back leg accessory', test({
backLegAccessory: { backLegAccessory: {
@@ -603,16 +603,16 @@ describe('compressPony', () => {
lockFills: [false], lockFills: [false],
} }
}, { }, {
lockBackLegAccessory: false, lockBackLegAccessory: false,
backLegAccessory: { backLegAccessory: {
type: 1, type: 1,
pattern: 0, pattern: 0,
fills: ['ff0000'], fills: ['ff0000'],
lockFills: [false, false, false, false, false, false], lockFills: [false, false, false, false, false, false],
outlines: ['b30000', undefined, undefined, undefined, undefined, undefined], outlines: ['b30000', undefined, undefined, undefined, undefined, undefined],
lockOutlines: [true, true, true, true, true, true], lockOutlines: [true, true, true, true, true, true],
} }
})); }));
it('cm (with undefined)', test({ it('cm (with undefined)', test({
cm: [ cm: [
@@ -623,15 +623,15 @@ describe('compressPony', () => {
, , 'fde9cd', , , , 'fde9cd', ,
] as any ] as any
}, { }, {
cm: [ cm: [
'', '', '', 'fde9cd', '', '', '', '', 'fde9cd', '',
'fde9cd', '', '', '', '', 'fde9cd', '', '', '', '',
'', '', 'fde9cd', '', 'fde9cd', '', '', 'fde9cd', '', 'fde9cd',
'', '', '', '', '', '', '', '', '', '',
'', '', 'fde9cd' '', '', 'fde9cd'
], ],
cmFlip: false, cmFlip: false,
})); }));
it('back leg accessory (editable)', () => { it('back leg accessory (editable)', () => {
const data = compressPonyString({ const data = compressPonyString({
@@ -45,7 +45,7 @@ describe('spriteSheetUtils', () => {
const createTexture = stub().returns({}); const createTexture = stub().returns({});
const sheet: SpriteSheet[] = [ const sheet: SpriteSheet[] = [
{ sprites: [undefined] as any, src: 'foo', data: createImageData(), { sprites: [undefined] as any, src: 'foo', data: createImageData(),
isSingleChannel: false, texture: undefined, palette: false }, isSingleChannel: false, texture: undefined, palette: false },
]; ];
createTexturesForSpriteSheets({} as any, sheet, createTexture); createTexturesForSpriteSheets({} as any, sheet, createTexture);
+1 -1
View File
@@ -140,7 +140,7 @@ function getEyesFromPsd({ objects2, sprites }: Result, eyesPsd: Psd, irisesPsd:
// const mirrored = (get: ByIndexGetter): ByIndexGetter => (canvas, index) => mirrorCanvas(get(canvas, index), -15); // const mirrored = (get: ByIndexGetter): ByIndexGetter => (canvas, index) => mirrorCanvas(get(canvas, index), -15);
const palette = [0, WHITE, BLACK]; // const palette = [0, WHITE, BLACK]; //
const getEye = (get: ByIndexGetter) => (i: number) => bases.map(base => { const getEye = (get: ByIndexGetter) => (i: number) => bases.map(base => {
const s = addSprite(sprites, get(shadow, i), undefined, palette); const s = addSprite(sprites, get(shadow, i), undefined, palette);
+1 -1
View File
@@ -24,7 +24,7 @@ function ignore(code: number): boolean {
|| (code >= 0x0250 && code <= 0x02AF) // IPA Extensions || (code >= 0x0250 && code <= 0x02AF) // IPA Extensions
|| (code >= 0x2460 && code <= 0x24FF) // Enclosed Alphanumerics || (code >= 0x2460 && code <= 0x24FF) // Enclosed Alphanumerics
|| (code >= 0x2300 && code <= 0x23FF) // Miscellaneous Technical || (code >= 0x2300 && code <= 0x23FF) // Miscellaneous Technical
; ;
} }
charsToCodes(CHARS + ROMAJI + EMOJI).forEach(code => existing.add(code)); charsToCodes(CHARS + ROMAJI + EMOJI).forEach(code => existing.add(code));