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

Add loadouts to operators #1

Closed
danielwerg opened this issue Feb 22, 2023 · 7 comments · Fixed by #3
Closed

Add loadouts to operators #1

danielwerg opened this issue Feb 22, 2023 · 7 comments · Fixed by #3
Assignees
Labels
type: feature New feature or request

Comments

@danielwerg
Copy link
Owner

danielwerg commented Feb 22, 2023

Feature

Each operator should have their own loadout.
marcopixel/r6operators#6

Ideal solution or implementation

Show

src/operators/recruit_attack/index.ts:

// ...

export const recruitAttack = {
  slug: 'recruit_attack',
  // ...
-  weapons: {
-    primary: ['l85a2', 'mk_14_ebr', 'm249'],
-    secondary: ['p12', 'super_shorty', 'c75_auto']
-  },
+  weapons: {
+    primary: [
+      {
+        slug: 'l85a2',
+        sights: ['holo_a'],
+        barrels: ['flash_hider'],
+        grips: ['vertical_grip'],
+        underBarrels: null
+      },
+      {
+        slug: 'mk_14_ebr',
+        sights: ['scope_3.0x'],
+        barrels: ['muzzle_brake'],
+        grips: ['vertical_grip'],
+        underBarrels: null
+      },
+      {
+        slug: 'm249',
+        sights: ['reflex_a'],
+        barrels: ['compensator'],
+        grips: ['vertical_grip'],
+        underBarrels: null
+      }
+    ],
+    secondary: [
+      {
+        slug: 'p12',
+        sights: null,
+        barrels: ['suppressor'],
+        grips: null,
+        underBarrels: null
+      },
+      {
+        slug: 'super_shorty',
+        sights: null,
+        barrels: null,
+        grips: null,
+        underBarrels: ['laser']
+      },
+      {
+        slug: 'c75_auto',
+        sights: null,
+        barrels: null,
+        grips: null,
+        underBarrels: null
+      }
+    ]
+  },
  // ...
} satisfies Operator;

src/operators/types.ts:

export interface OperatorWeapons {
  primary: OperatorWeapon[];
  secondary: OperatorWeapon[];
}

export interface OperatorWeapon {
  slug: WeaponSlug;
  sights: SightSlug[] | null;
  barrels: BarrelSlug[] | null;
  grips: GripSlug[] | null;
  underBarrels: UnderBarrelSlug[] | null;
}

Other context

Handle forced attachments

Examples:

https://github.com/danielwerg/r6data/blob/feat/operator-weapon-loadouts/src/operators/caveira/index.ts#L46
https://github.com/danielwerg/r6data/blob/feat/operator-weapon-loadouts/src/operators/echo/index.ts#L42
https://github.com/danielwerg/r6data/blob/feat/operator-weapon-loadouts/src/operators/ela/index.ts#L49

@danielwerg danielwerg added the type: feature New feature or request label Feb 22, 2023
@danielwerg danielwerg self-assigned this Feb 22, 2023
@danielwerg
Copy link
Owner Author

@PandaDriver156 I have published a branch - https://github.com/danielwerg/r6data/tree/feat/operator-weapon-loadouts. Will start working on defenders, fork that branch instead of master.

@PandaDriver156
Copy link
Contributor

@PandaDriver156 I have published a branch - https://github.com/danielwerg/r6data/tree/feat/operator-weapon-loadouts. Will start working on defenders, fork that branch instead of master.

Thanks, I'll start working on attackers tomorrow then.

@danielwerg
Copy link
Owner Author

Not sure what is a best way to handle "forced" attachments. Here is few example to show what I mean:

https://github.com/danielwerg/r6data/blob/feat/operator-weapon-loadouts/src/operators/caveira/index.ts#L46
https://github.com/danielwerg/r6data/blob/feat/operator-weapon-loadouts/src/operators/echo/index.ts#L42
https://github.com/danielwerg/r6data/blob/feat/operator-weapon-loadouts/src/operators/ela/index.ts#L49

Just going to leave comments for now.

@danielwerg
Copy link
Owner Author

I'm using this regex while refactoring:
find: '([\w_\-.]+)'
replace: { slug: '$1', sights: null, barrels: null, grips: null, underBarrels: ['laser'] }
Saved me quite some time.

@PandaDriver156
Copy link
Contributor

https://github.com/PandaDriver156/r6data/tree/operator-weapon-loadouts
Done for today, I've refactored all attacker "Pathfinder" operators. The sights array contains bit too many elements though, as almost all attackers have access to more than just the 1x scopes. barrels also has 4 elements on some weapons, because COMMON_BARRELS contains extended barrel too, which is not applicable to some attacker weapons (not sure if that's a problem, just mentioning).

I'm using this regex while refactoring: find: '([\w_\-.]+)' replace: { slug: '$1', sights: null, barrels: null, grips: null, underBarrels: ['laser'] } Saved me quite some time.

Thanks, it really did save a lot of time.

Should I open a PR? If yes, which branch should be targeted?

@danielwerg
Copy link
Owner Author

Awesome, I thinks there so much we can do for sights but we should have a var for barrels without extended barrel.
Target https://github.com/danielwerg/r6data/tree/feat/operator-weapon-loadouts branch

@danielwerg
Copy link
Owner Author

I'm not good at naming things, but maybe something like this?

- export const COMMON_BARRELS = [
-   'flash_hider',
-   'compensator',
-   'muzzle_brake',
-   'suppressor',
-   'extended_barrel'
- ] satisfies BarrelSlug[];

+ export const COMMON_BARRELS_NO_EXTENDED_BARREL = [
+   'flash_hider',
+   'compensator',
+   'muzzle_brake',
+   'suppressor'
+ ] satisfies BarrelSlug[];

+ export const COMMON_BARRELS_ALL = [
+   'flash_hider',
+   'compensator',
+   'muzzle_brake',
+   'suppressor',
+   'extended_barrel'
+ ] satisfies BarrelSlug[];

@danielwerg danielwerg linked a pull request Mar 1, 2023 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants