Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoformatting #21

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Formatting Checks

on:
pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'

- name: Setup Node.js 18
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Formatting Checks
run: npm run format:check

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
dist/
docs/
.husky/
.github/
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": true,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "always",
"endOfLine": "lf",
"bracketSpacing": true,
"bracketSameLine": false
}
34 changes: 20 additions & 14 deletions momentum/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,39 @@ interface MapData {
name: string;
thumbnail: {
urlLarge: string;
}
};
mainTrack: {
difficulty: number;
numZones: number;
isLinear: boolean;
}
credits: { type: string, user: { alias: string } }[];
};
credits: { type: string; user: { alias: string } }[];
}

declare type TimerEvent = TimerEventEnum[keyof TimerEventEnum];
declare interface TimerEventEnum {
Started: 0,
Finished: 1,
Stopped: 2,
Failed: 3,
Started: 0;
Finished: 1;
Stopped: 2;
Failed: 3;
}

declare type TimerState = TimerStateEnum[keyof TimerStateEnum];
declare interface TimerStateEnum {
NotRunning: 0,
Running: 1,
Practice: 2,
NotRunning: 0;
Running: 1;
Practice: 2;
}

declare interface GlobalEventNameMap {
'OnMomentumTimerStateChange': (ent: unknown, type: TimerEvent) => void,
'OnMomentumZoneChange': (enter: unknown, linear: unknown, curZone: unknown, curTrack: unknown, timerState: TimerState) => void,
'OnSaveStateUpdate': (count: number, current: unknown, usingMenu: boolean) => void,
'OnMomentumReplayStopped': () => void,
OnMomentumTimerStateChange: (ent: unknown, type: TimerEvent) => void;
OnMomentumZoneChange: (
enter: unknown,
linear: unknown,
curZone: unknown,
curTrack: unknown,
timerState: TimerState
) => void;
OnSaveStateUpdate: (count: number, current: unknown, usingMenu: boolean) => void;
OnMomentumReplayStopped: () => void;
}
23 changes: 14 additions & 9 deletions p2ce/achievements.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@

interface Achievement {
name: string; // Name of the achievement
index: number; // Index of the achievement (for use with the API)
achieved: boolean; // True if this has been achieved
available: boolean; // True if this is available
hide_until_achieved: boolean; // True if this is a "hidden" achievement. It should not be displayed in its full glory until achieved
/** Name of the achievement */
name: string;
/** Index of the achievement (for use with the API) */
index: number;
/** True if this has been achieved */
achieved: boolean;
/** True if this is available */
available: boolean;
/** True if this is a "hidden" achievement. It should not be displayed in its full glory until achieved */
hide_until_achieved: boolean;
flags: number;
count: number; // Current count, if a stat is involved with this achievement. The achievement is granted when count >= goal
goal: number; // Stat goal for this achievement
/** Current count, if a stat is involved with this achievement. The achievement is granted when count >= goal */
count: number;
/**Stat goal for this achievement */
goal: number;
}

declare namespace AchievementsAPI {

/**
* Returns true if cheats were turned on at any point during this session
*/
Expand Down
84 changes: 42 additions & 42 deletions p2ce/weapons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,67 @@
*/

declare interface GlobalEventNameMap {
'WeaponStateChange': (mode: WeaponStateMode, index: int32) => void,
'WeaponSelect': (action: WeaponSelectAction) => void,
WeaponStateChange: (mode: WeaponStateMode, index: int32) => void;
WeaponSelect: (action: WeaponSelectAction) => void;
}

/** @group enum */
declare enum WeaponStateMode {
SWITCH = 0,
PICKUP = 1,
DROP = 2,
SWITCH = 0,
PICKUP = 1,
DROP = 2
}

/** @group enum */
declare enum WeaponSelectAction {
NEXT = 0,
PREV = 1,
SHOW = 2,
HIDE = 3,
HIDE = 3
}

interface Weapon {
name: string;
classname: string;
viewmodel: string;
playermodel: string;
name: string;
classname: string;
viewmodel: string;
playermodel: string;

slot: number;
position: number;
slot: number;
position: number;

type: 'melee' | 'gun';
type: 'melee' | 'gun';

primary: {
usesPrimary: boolean; // True when this weapon uses primary ammo
usesClips: boolean; // True when this weapon uses clips
clipSize: number; // The clip size of the weapon
clipAmmo: number; // The ammo in the current clip
ammoType: string; // The name of the ammo, or an empty string if no name given
maxAmmo: number; // The max amount of primary ammo
ammo: number; // The amount of ammo remaining
};
primary: {
usesPrimary: boolean; // True when this weapon uses primary ammo
usesClips: boolean; // True when this weapon uses clips
clipSize: number; // The clip size of the weapon
clipAmmo: number; // The ammo in the current clip
ammoType: string; // The name of the ammo, or an empty string if no name given
maxAmmo: number; // The max amount of primary ammo
ammo: number; // The amount of ammo remaining
};

secondary: {
usesSecondary: boolean; // True when this weapon uses secondary ammo
usesClips: boolean; // True when this weapon uses clips
clipSize: number; // The clip size of the weapon
clipAmmo: number; // The ammo in the current clip
ammoType: string; // The name of the ammo, or an empty string if no name given
maxAmmo: number; // The max amount of secondary ammo
ammo: number; // The amount of ammo remaining
};
secondary: {
usesSecondary: boolean; // True when this weapon uses secondary ammo
usesClips: boolean; // True when this weapon uses clips
clipSize: number; // The clip size of the weapon
clipAmmo: number; // The ammo in the current clip
ammoType: string; // The name of the ammo, or an empty string if no name given
maxAmmo: number; // The max amount of secondary ammo
ammo: number; // The amount of ammo remaining
};
}

declare namespace WeaponsAPI {
function GetWeaponCount(): uint32;
function GetWeapons(): (Weapon | null)[];
function GetActiveWeapon(): uint32;
function HasWeaponClass(classname: string): boolean;
function HasWeapon(id: uint32): boolean;
function GetWeaponInfo(id: uint32): Weapon | null;
function GetActiveWeaponInfo(): Weapon | null;
function CanSwitchToWeapon(id: uint32): boolean;
function SwitchToWeapon(id: uint32): boolean;
function GetWeaponIndexFromClass(classname: string): uint32;
function DropWeapon(id: uint32, throwVecX: number, throwVecY: number, throwVecZ: number): boolean;
function GetWeaponCount(): uint32;
function GetWeapons(): (Weapon | null)[];
function GetActiveWeapon(): uint32;
function HasWeaponClass(classname: string): boolean;
function HasWeapon(id: uint32): boolean;
function GetWeaponInfo(id: uint32): Weapon | null;
function GetActiveWeaponInfo(): Weapon | null;
function CanSwitchToWeapon(id: uint32): boolean;
function SwitchToWeapon(id: uint32): boolean;
function GetWeaponIndexFromClass(classname: string): uint32;
function DropWeapon(id: uint32, throwVecX: number, throwVecY: number, throwVecZ: number): boolean;
}
Loading
Loading