-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
128 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Gamemode, GamemodeCategory, GamemodeToGamemodeCategory } from '../'; | ||
import { ElementOf, ValueOf } from '../types/utils/util.type'; | ||
|
||
const GLOBAL_TAGS = ['Portals', 'Multiroute'] as const; | ||
|
||
// prettier-ignore | ||
const GAMEMODE_TAGS = { | ||
[GamemodeCategory.SURF]: [ | ||
'Unit', | ||
'Tech', | ||
'Spins', | ||
'Booster', | ||
'Headhit', | ||
'Bhop' | ||
] as const, | ||
[GamemodeCategory.BHOP]: [ | ||
'Strafe', | ||
'Tech', | ||
'Fly', | ||
'Surf', | ||
'Weapons', | ||
'Spins' | ||
] as const, | ||
[GamemodeCategory.CLIMB]: [ | ||
'Ladder' | ||
] as const, | ||
[GamemodeCategory.RJ]: [ | ||
'Sync', | ||
'Wallpogo', | ||
'Speedshot', | ||
'Bounce', | ||
'Jurf', | ||
'Edgebug', | ||
'Wallbug', | ||
'Wallshot' | ||
] as const, | ||
[GamemodeCategory.SJ]: [ | ||
'Airpogo', | ||
'Wallpogo', | ||
'Vert' | ||
] as const, | ||
[GamemodeCategory.AHOP]: [ | ||
'HL2' | ||
] as const, | ||
[GamemodeCategory.CONC]: [ | ||
'Prec', | ||
'Juggle', | ||
'Limited Ammo' | ||
] as const, | ||
[GamemodeCategory.DEFRAG]: [ | ||
'Strafe', | ||
'Rocket Launcher', | ||
'Grenade Launcher', | ||
'Plasma Gun', | ||
'BFG', | ||
'Combo', | ||
'Haste', | ||
'Damageboost', | ||
'Climb', | ||
'Trick' | ||
] as const | ||
}; | ||
|
||
// We could add support for individual subcategories (Gamemodes), but don't | ||
// have a single example of one yet. | ||
|
||
/** | ||
* Union of every possible tag in Momentum. | ||
*/ | ||
export type MapTag = | ||
| (typeof GLOBAL_TAGS)[number] | ||
| ElementOf<ValueOf<typeof GAMEMODE_TAGS>>; | ||
|
||
// TODO: BUMP DEPS, REMOVE SPREAD!! | ||
export const MapTags: Map<Gamemode, Set<MapTag>> = new Map( | ||
[...GamemodeToGamemodeCategory.entries()].map(([gamemode, category]) => [ | ||
gamemode, | ||
new Set([...GLOBAL_TAGS, ...(GAMEMODE_TAGS[category] ?? [])]) as any | ||
]) | ||
) as any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Trivial types that are useful in many places. | ||
* This package is exported to Panorama, which doesn't support type-fest, add | ||
* here if needed. | ||
*/ | ||
|
||
export type ValueOf<T> = T[keyof T]; | ||
export type ElementOf<T> = T extends (infer E)[] ? E : never; | ||
|
||
export type KeyOfMap<T> = T extends Map<infer K, any> ? K : never; | ||
export type ValueOfMap<T> = T extends Map<any, infer V> ? V : never; | ||
|
||
export type ElementOfSet<T> = T extends Set<infer K> ? K : never; |