‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
custom_class.csc
Go to the documentation of this file.
1 
2 #using scripts\shared\array_shared;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\duplicaterender_mgr;
6 #using scripts\shared\exploder_shared;
7 #using scripts\shared\filter_shared;
8 #using scripts\shared\util_shared;
9 #using scripts\shared\postfx_shared;
10 
11 #using scripts\core\_multi_extracam;
12 #using scripts\codescripts\struct;
13 
14 // ARCHETYPE SCRIPTS - by putting them here, any autoexec functions will execute automatically.
15 #using scripts\shared\ai\zombie;
16 #using scripts\shared\ai\systems\destructible_character;
17 #using scripts\shared\ai\archetype_damage_effects;
18 
19 #using scripts\shared\_character_customization;
20 #using scripts\shared\lui_shared;
21 #insert scripts\shared\shared.gsh;
22 #insert scripts\shared\version.gsh;
23 #insert scripts\shared\duplicaterender.gsh;
24 #insert scripts\shared\statstable_shared.gsh;
25 
26 #define PAINTSHOP_WEAPON_KICK_EXPLODER_NAME "weapon_kick"
27 #define PAINTSHOP_LIGHT_EXPLODER_NAME "lights_paintshop"
28 #define PAINTSHOP_LIGHT_ZOOM_EXPLODER_NAME "lights_paintshop_zoom"
29 #define CAC_LOCKED_WEAPON "mc/sonar_frontend_locked_gun"
30 
31 #namespace customclass;
32 
33 function ‪localClientConnect(localClientNum)
34 {
35  level thread ‪custom_class_init( localClientNum );
36 }
37 
38 function ‪init()
39 {
40  level.weapon_script_model = [];
41  level.preload_weapon_model = [];
42  level.last_weapon_name = [];
43  level.current_weapon = [];
44  level.attachment_names = [];
45  level.attachment_indices = [];
46  level.paintshopHiddenPosition = [];
47  level.camo_index = [];
48  level.reticle_index = [];
49  level.show_player_tag = [];
50  level.show_emblem = [];
51  level.preload_weapon_complete = [];
52  level.preload_weapon_complete = [];
53  level.weapon_clientscript_cac_model = [];
54 
55  level.weaponNone = GetWeapon( "none" );
56  level.weapon_position = ‪struct::get("paintshop_weapon_position");
57  ‪duplicate_render::set_dr_filter_offscreen( "cac_locked_weapon", 10, "cac_locked_weapon", undefined, ‪DR_TYPE_OFFSCREEN, ‪CAC_LOCKED_WEAPON, ‪DR_CULL_NEVER );
58 }
59 
60 function ‪custom_class_init( localClientNum )
61 {
62  level.last_weapon_name[ localClientNum ] = "";
63  level.current_weapon[ localClientNum ] = undefined;
64 
65  level thread ‪custom_class_start_threads( localClientNum );
66  level thread ‪handle_cac_customization( localClientNum );
67 }
68 
69 function ‪custom_class_start_threads( localClientNum )
70 {
71  level endon( "disconnect" );
72 
73  while( 1 )
74  {
75  level thread ‪custom_class_update( localClientNum );
76  level thread ‪custom_class_attachment_select_focus( localClientNum );
77  level thread ‪custom_class_remove( localClientNum );
78  level thread ‪custom_class_closed( localClientNum );
79 
80  level ‪util::waittill_any( "CustomClass_update" + localClientNum, "CustomClass_focus" + localClientNum, "CustomClass_remove" + localClientNum, "CustomClass_closed" + localClientNum);
81  }
82 }
83 
84 function ‪handle_cac_customization( localClientNum )
85 {
86  level endon( "disconnect" );
87 
88  self.lastXcam = [];
89  self.lastSubxcam = [];
90  self.lastNotetrack = [];
91 
92  while( 1 )
93  {
94  level thread ‪handle_cac_customization_focus( localClientNum );
95  level thread ‪handle_cac_customization_weaponoption( localClientNum );
96  level thread ‪handle_cac_customization_attachmentvariant( localClientNum );
97  level thread ‪handle_cac_customization_closed( localClientNum );
98 
99  level waittill( "cam_customization_closed" + localClientNum);
100  }
101 }
102 
103 function ‪custom_class_update( localClientNum )
104 {
105  level endon( "disconnect" );
106  level endon( "CustomClass_focus" + localClientNum );
107  level endon( "CustomClass_remove" + localClientNum);
108  level endon( "CustomClass_closed" + localClientNum);
109 
110  level waittill( "CustomClass_update" + localClientNum, param1, param2, param3, param4, param5, param6, param7 );
111 
112  base_weapon_slot = param1;
113  weapon_full_name = param2;
114  camera = param3; //"select01", "select02", or "select03"
115  weapon_options_param = param4;
116  acv_param = param5;
117  is_item_unlocked = param6;
118  is_item_tokenlocked = param7;
119  ‪DEFAULT( is_item_unlocked, true );
120  ‪DEFAULT( is_item_tokenlocked, false );
121 
122  if( IsDefined( weapon_full_name ) )
123  {
124  if( IsDefined( acv_param ) && acv_param != "none" )
125  {
126  ‪set_attachment_cosmetic_variants( localClientNum, acv_param );
127  }
128 
129  if( IsDefined( weapon_options_param ) && weapon_options_param != "none" )
130  {
131  ‪set_weapon_options( localClientNum, weapon_options_param );
132  }
133 
134  ‪postfx::setFrontendStreamingOverlay( localClientNum, "cac", true );
135 
136  position = level.weapon_position;
137 
138  if( !IsDefined( level.weapon_script_model[ localClientNum ] ) )
139  {
140  level.weapon_script_model[ localClientNum ] = ‪spawn_weapon_model( localClientNum, position.origin, position.angles );
141  level.preload_weapon_model[ localClientNum ] = ‪spawn_weapon_model( localClientNum, position.origin, position.angles );
142  level.preload_weapon_model[ localClientNum ] Hide();
143  }
144 
145  ‪toggle_locked_weapon_shader( localClientNum, is_item_unlocked );
146  ‪toggle_tokenlocked_weapon_shader( localClientNum, is_item_unlocked && is_item_tokenlocked );
147 
148  ‪update_weapon_script_model( localClientNum, weapon_full_name, undefined, is_item_unlocked, is_item_tokenlocked );
149 
150  level notify( "xcamMoved" );
151 
152  lerpDuration = ‪get_lerp_duration( camera );
153  ‪setup_paintshop_bg( localClientNum, camera );
154  level ‪transition_camera_immediate( localClientNum, base_weapon_slot, "cam_cac_weapon", "cam_cac", lerpDuration, camera );
155  }
156  else if( IsDefined(param1) && param1 == "purchased" )
157  {
158  ‪toggle_tokenlocked_weapon_shader( localClientNum, false );
159  }
160 }
161 
162 function ‪toggle_locked_weapon_shader( localClientNum, is_item_unlocked = true )
163 {
164  if( !IsDefined( level.weapon_script_model[ localClientNum ] ) )
165  {
166  return;
167  }
168 
169  if( is_item_unlocked != 1 )
170  {
171  EnableFrontendLockedWeaponOverlay( localClientNum, true );
172  }
173  else
174  {
175  EnableFrontendLockedWeaponOverlay( localClientNum, false );
176  }
177 }
178 
179 function ‪toggle_tokenlocked_weapon_shader( localClientNum, is_item_tokenlocked = false )
180 {
181  if( !IsDefined( level.weapon_script_model[ localClientNum ] ) )
182  {
183  return;
184  }
185 
186  if( is_item_tokenlocked )
187  {
188  EnableFrontendTokenLockedWeaponOverlay( localClientNum, true );
189  }
190  else
191  {
192  EnableFrontendTokenLockedWeaponOverlay( localClientNum, false );
193  }
194 }
195 
196 function ‪is_optic( attachmentName )
197 {
198  csv_filename = "gamedata/weapons/common/attachmentTable.csv";
199 
200  row = tableLookupRowNum( csv_filename, ‪ATTACHMENT_TABLE_COL_NAME, attachmentName );
201 
202  if ( row > -1 )
203  {
204  group = tableLookupColumnForRow( csv_filename, row, ‪ATTACHMENT_TABLE_COL_GROUP );
205  return ( group == "optic" );
206  }
207 
208  return false;
209 }
210 
211 function ‪custom_class_attachment_select_focus( localClientNum )
212 {
213  level endon( "disconnect" );
214  level endon( "CustomClass_update" + localClientNum );
215  level endon( "CustomClass_remove" + localClientNum );
216  level endon( "CustomClass_closed" + localClientNum );
217 
218  level waittill( "CustomClass_focus" + localClientNum, param1, param2, param3, param4, param5, param6 );
219  level endon( "CustomClass_focus" + localClientNum );
220 
221  base_weapon_slot = param1;
222  weapon_full_name = param2;
223  attachment = param3;
224  weapon_options_param = param4;
225  acv_param = param5;
226  doNotMoveCamera = param6;
227 
228  update_weapon_options = false;
229  weaponAttachmentIntersection = ‪get_attachments_intersection( level.last_weapon_name[ localClientNum ], weapon_full_name );
230 
231  if( IsDefined( acv_param ) && acv_param != "none" )
232  {
233  ‪set_attachment_cosmetic_variants( localClientNum, acv_param );
234  }
235 
236  initialdelay = .30;
237  lerpDuration = 400;
238 
239  if( ‪is_optic(attachment) )
240  {
241  initialdelay = 0;
242  lerpDuration = 200;
243  }
244 
245  ‪preload_weapon_model( localClientNum, weaponAttachmentIntersection, update_weapon_options );
246  ‪wait_preload_weapon( localClientNum );
247 
248  ‪update_weapon_script_model( localClientNum, weaponAttachmentIntersection, update_weapon_options );
249 
250  //update camera transitions
251  if( weapon_full_name == weaponAttachmentIntersection )
252  {
253  weapon_full_name = undefined;
254  }
255 
256  if ( ‪IS_TRUE( doNotMoveCamera ) )
257  {
258  if( IsDefined( weapon_full_name ) )
259  {
260  ‪preload_weapon_model( localClientNum, weapon_full_name, false );
261 
262  wait initialDelay;
263 
264  ‪wait_preload_weapon( localClientNum );
265 
266  ‪update_weapon_script_model( localClientNum, weapon_full_name, false );
267  }
268  }
269  else
270  {
271  level thread ‪transition_camera( localClientNum, base_weapon_slot, "cam_cac_attachments", "cam_cac", initialDelay, lerpDuration, attachment, weapon_full_name );
272  }
273 
274  if( IsDefined( weapon_options_param ) && weapon_options_param != "none" )
275  {
276  ‪set_weapon_options( localClientNum, weapon_options_param );
277  }
278 }
279 
280 function ‪custom_class_remove( localClientNum )
281 {
282  level endon( "disconnect" );
283  level endon( "CustomClass_update" + localClientNum );
284  level endon( "CustomClass_focus" + localClientNum );
285  level endon( "CustomClass_closed" + localClientNum );
286 
287  level waittill( "CustomClass_remove" + localClientNum, param1, param2, param3, param4, param5, param6 );
288 
289  ‪postfx::setFrontendStreamingOverlay( localClientNum, "cac", false );
290  EnableFrontendLockedWeaponOverlay( localClientNum, false );
291  EnableFrontendTokenLockedWeaponOverlay( localClientNum, false );
292 
293  //creating a default position for the camera in case we land on a loadout slot that doesn't have a model (perks and wildcards)
294  position = level.weapon_position;
295  camera = "select01";
296  xcamName = "ui_cam_cac_ar_standard";
297  PlayMainCamXCam( localClientNum, xcamName, 0, "cam_cac", camera, position.origin, position.angles );
298  ‪setup_paintshop_bg( localClientNum, camera );
299 
300  if( IsDefined( level.weapon_script_model[ localClientNum ] ) )
301  {
302  level.weapon_script_model[ localClientNum ] forcedelete();
303  }
304  level.last_weapon_name[ localClientNum ] = "";
305 }
306 
307 function ‪custom_class_closed( localClientNum )
308 {
309  level endon( "disconnect" );
310  level endon( "CustomClass_update" + localClientNum );
311  level endon( "CustomClass_focus" + localClientNum );
312  level endon( "CustomClass_remove" + localClientNum );
313 
314  level waittill( "CustomClass_closed" + localClientNum, param1, param2, param3, param4, param5, param6 );
315 
316  if( IsDefined( level.weapon_script_model[ localClientNum ] ) )
317  {
318  level.weapon_script_model[ localClientNum ] forcedelete();
319  }
320 
321  ‪postfx::setFrontendStreamingOverlay( localClientNum, "cac", false );
322  EnableFrontendLockedWeaponOverlay( localClientNum, false );
323  EnableFrontendTokenLockedWeaponOverlay( localClientNum, false );
324 
325  level.last_weapon_name[ localClientNum ] = "";
326 }
327 
328 function ‪spawn_weapon_model( localClientNum, origin, angles )
329 {
330  weapon_model = ‪Spawn( localClientNum, origin, "script_model" );
331  weapon_model SetHighDetail( true, true );
332 
333  if( IsDefined( angles ) )
334  {
335  weapon_model.angles = angles;
336  }
337 
338  return weapon_model;
339 }
340 
341 function ‪set_attachment_cosmetic_variants( localClientNum, acv_param )
342 {
343  acv_indexes = strtok( acv_param, "," );
344 
345  level.attachment_names[ localClientNum ] = [];
346  level.attachment_indices[ localClientNum ] = [];
347 
348  for( i = 0; i + 1 < acv_indexes.size; i += 2 )
349  {
350  level.attachment_names[ localClientNum ][ level.attachment_names[ localClientNum ].size ] = acv_indexes[i];
351  level.attachment_indices[ localClientNum ][ level.attachment_indices[ localClientNum ].size ] = int( acv_indexes[i+1] );
352  }
353 }
354 
355 function ‪hide_paintshop_bg( localClientNum )
356 {
357  paintshop_bg = GetEnt( localClientNum, "paintshop_black", "targetname" );
358  if( IsDefined( paintshop_bg ) )
359  {
360  if( !IsDefined( level.paintshopHiddenPosition[ localClientNum ] ) )
361  {
362  level.paintshopHiddenPosition[ localClientNum ] = paintshop_bg.origin;
363  }
364  paintshop_bg hide();
365  paintshop_bg moveto( level.paintshopHiddenPosition[ localClientNum ], 0.01 );
366  }
367 }
368 
369 function ‪show_paintshop_bg( localClientNum )
370 {
371  paintshop_bg = GetEnt( localClientNum, "paintshop_black", "targetname" );
372  if( IsDefined( paintshop_bg ) )
373  {
374  paintshop_bg show();
375  paintshop_bg moveto( level.paintshopHiddenPosition[ localClientNum ] + (0,0,227), 0.01 );
376  }
377 }
378 
379 function ‪get_camo_index( localClientNum )
380 {
381  if( !IsDefined( level.camo_index[ localClientNum ] ) )
382  {
383  level.camo_index[ localClientNum ] = 0;
384  }
385 
386  return level.camo_index[ localClientNum ];
387 }
388 
389 function ‪get_reticle_index( localClientNum )
390 {
391  if( !IsDefined( level.reticle_index[ localClientNum ] ) )
392  {
393  level.reticle_index[ localClientNum ] = 0;
394  }
395 
396  return level.reticle_index[ localClientNum ];
397 }
398 
399 function ‪get_show_payer_tag( localClientNum )
400 {
401  if( !IsDefined( level.show_player_tag[ localClientNum ] ) )
402  {
403  level.show_player_tag[ localClientNum ] = false;
404  }
405 
406  return level.show_player_tag[ localClientNum ];
407 }
408 
409 function ‪get_show_emblem( localClientNum )
410 {
411  if( !IsDefined( level.show_emblem[ localClientNum ] ) )
412  {
413  level.show_emblem[ localClientNum ] = false;
414  }
415 
416  return level.show_emblem[ localClientNum ];
417 }
418 
419 function ‪get_show_paintshop( localClientNum )
420 {
421  if( !IsDefined( level.show_paintshop[ localClientNum ] ) )
422  {
423  level.show_paintshop[ localClientNum ] = false;
424  }
425 
426  return level.show_paintshop[ localClientNum ];
427 }
428 
429 function ‪set_weapon_options( localClientNum, weapon_options_param )
430 {
431  weapon_options = strtok( weapon_options_param, "," );
432 
433  level.camo_index[ localClientNum ] = int( weapon_options[0] );
434  level.show_player_tag[ localClientNum ] = false;
435  level.show_emblem[ localClientNum ] = false;
436  level.reticle_index[ localClientNum ] = int( weapon_options[1] );
437  level.show_paintshop[ localClientNum ] = int( weapon_options[2] );
438 
439  if( IsDefined( weapon_options ) && IsDefined( level.weapon_script_model[ localClientNum ] ) )
440  {
441  level.weapon_script_model[ localClientNum ] SetWeaponRenderOptions( ‪get_camo_index( localClientNum ), ‪get_reticle_index( localClientNum ), ‪get_show_payer_tag( localClientNum ), ‪get_show_emblem( localClientNum ), ‪get_show_paintshop( localClientNum ) );
442  }
443 }
444 
445 function ‪get_lerp_duration( camera )
446 {
447  lerpDuration = 0;
448  if( IsDefined( camera ) )
449  {
450  paintshopCameraCloseUp = ( camera == "left" || camera == "right" || camera == "top" || camera == "paintshop_preview_left" || camera == "paintshop_preview_right" || camera == "paintshop_preview_top");
451  if( paintshopCameraCloseUp )
452  {
453  lerpDuration = 500;
454  }
455  }
456 
457  return lerpDuration;
458 }
459 
460 function ‪setup_paintshop_bg( localClientNum, camera )
461 {
462  if( IsDefined( camera ) )
463  {
464  paintshopCameraCloseUp = ( camera == "left" || camera == "right" || camera == "top" || camera == "paintshop_preview_left" || camera == "paintshop_preview_right" || camera == "paintshop_preview_top" );
465  PlayRadiantExploder( localClientNum, ‪PAINTSHOP_WEAPON_KICK_EXPLODER_NAME );
466  if( paintshopCameraCloseUp )
467  {
468  ‪show_paintshop_bg( localCLientNum );
469  KillRadiantExploder( localClientNum, ‪PAINTSHOP_LIGHT_EXPLODER_NAME );
470  KillRadiantExploder( localClientNum, ‪PAINTSHOP_WEAPON_KICK_EXPLODER_NAME );
471  PlayRadiantExploder( localClientNum, ‪PAINTSHOP_LIGHT_ZOOM_EXPLODER_NAME );
472  }
473  else
474  {
475  ‪hide_paintshop_bg( localClientNum );
476  KillRadiantExploder( localClientNum, ‪PAINTSHOP_LIGHT_ZOOM_EXPLODER_NAME );
477  PlayRadiantExploder( localClientNum, ‪PAINTSHOP_LIGHT_EXPLODER_NAME );
478  PlayRadiantExploder( localClientNum, ‪PAINTSHOP_WEAPON_KICK_EXPLODER_NAME );
479  }
480  }
481 }
482 
483 function ‪transition_camera_immediate( localClientNum, weaponType, camera, subxcam, lerpDuration, notetrack )
484 {
485  xcam = GetWeaponXCam( level.current_weapon[ localClientNum ], camera );
486 
487  if( !IsDefined( xcam ) )
488  {
489  if( StrStartsWith( weaponType, "specialty" ) )
490  {
491  xcam = "ui_cam_cac_perk";
492  }
493  else if( StrStartsWith( weaponType, "bonuscard" ) )
494  {
495  xcam = "ui_cam_cac_wildcard";
496  }
497  else if( StrStartsWith( weaponType, "cybercore" ) || StrStartsWith( weaponType, "cybercom" ) )
498  {
499  xcam = "ui_cam_cac_perk";
500  }
501  else if ( StrStartsWith( weaponType, "bubblegum" ) )
502  {
503  xcam = "ui_cam_cac_bgb";
504  }
505  else
506  {
507  xcam = GetWeaponXCam( GetWeapon( "ar_standard" ), camera );
508  }
509  }
510 
511  self.lastXcam[weaponType] = xcam;
512  self.lastSubxcam[weaponType] = subxcam;
513  self.lastNotetrack[weaponType] = notetrack;
514 
515  position = level.weapon_position;
516  model = level.weapon_script_model[ localClientNum ];
517 
518  PlayMainCamXCam( localClientNum, xcam, lerpDuration, subxcam, notetrack, position.origin, position.angles, model, position.origin, position.angles );
519  if( notetrack == "top" || notetrack == "right" || notetrack == "left" )
520  {
521  SetAllowXCamRightStickRotation( localClientNum, false );
522  }
523 }
524 
525 function ‪wait_preload_weapon( localClientNum )
526 {
527  if( level.preload_weapon_complete[ localClientNum ] )
528  {
529  return;
530  }
531 
532  level waittill( "preload_weapon_complete_" + localClientNum );
533 }
534 
535 function ‪preload_weapon_watcher( localClientNum )
536 {
537  level endon( "preload_weapon_changing_" + localClientNum );
538  level endon( "preload_weapon_complete_" + localClientNum );
539 
540  while( true )
541  {
542  if( level.preload_weapon_model[ localClientNum ] isStreamed() )
543  {
544  level.preload_weapon_complete[ localClientNum ] = true;
545  level notify( "preload_weapon_complete_" + localClientNum );
546  return;
547  }
548 
549  wait 0.1;
550  }
551 }
552 
553 function ‪preload_weapon_model( localClientNum, newWeaponString, should_update_weapon_options = true )
554 {
555  level notify( "preload_weapon_changing_" + localClientNum );
556 
557  level.preload_weapon_complete[ localClientNum ] = false;
558  current_weapon = GetWeaponWithAttachments( newWeaponString );
559  if ( current_weapon == level.weaponNone )
560  {
561  level.preload_weapon_complete[ localClientNum ] = true;
562  level notify( "preload_weapon_complete_" + localClientNum );
563  return;
564  }
565 
566  if( isDefined(current_weapon.frontendmodel) )
567  {
568  level.preload_weapon_model[ localClientNum ] UseWeaponModel( current_weapon, current_weapon.frontendmodel );
569  }
570  else
571  {
572  level.preload_weapon_model[ localClientNum ] UseWeaponModel( current_weapon );
573  }
574 
575  if( IsDefined( level.preload_weapon_model[ localClientNum ] ) )
576  {
577  if( IsDefined( level.attachment_names[ localClientNum ] ) && IsDefined( level.attachment_indices[ localClientNum ] ) )
578  {
579  for( i = 0; i < level.attachment_names[ localClientNum ].size; i++ )
580  {
581  level.preload_weapon_model[ localClientNum ] SetAttachmentCosmeticVariantIndex( newWeaponString, level.attachment_names[ localClientNum ][i], level.attachment_indices[ localClientNum ][i] );
582  }
583  }
584 
585  if( should_update_weapon_options )
586  {
587  level.preload_weapon_model[ localClientNum ] SetWeaponRenderOptions( ‪get_camo_index( localClientNum ), ‪get_reticle_index( localClientNum ), ‪get_show_payer_tag( localClientNum ), ‪get_show_emblem( localClientNum ), ‪get_show_paintshop( localClientNum ) );
588  }
589  }
590 
591  level thread ‪preload_weapon_watcher( localClientNum );
592 }
593 
594 
595 function ‪update_weapon_script_model( localClientNum, newWeaponString, should_update_weapon_options = true, is_item_unlocked = true, is_item_tokenlocked = false )
596 {
597  level.last_weapon_name[ localClientNum ] = newWeaponString;
598  level.current_weapon[ localClientNum ] = GetWeaponWithAttachments( level.last_weapon_name[ localClientNum ] );
599  if ( level.current_weapon[ localClientNum ] == level.weaponNone )
600  {
601  // for perks and wildcards
602  level.weapon_script_model[ localClientNum ] delete();
603  position = level.weapon_position;
604  level.weapon_script_model[ localClientNum ] = ‪spawn_weapon_model( localClientNum, position.origin, position.angles );
605  ‪toggle_locked_weapon_shader( localClientNum, is_item_unlocked );
606  ‪toggle_tokenlocked_weapon_shader( localClientNum, is_item_unlocked && is_item_tokenlocked );
607 
608  level.weapon_script_model[ localClientNum ] SetModel( level.last_weapon_name[ localClientNum ] );
609  level.weapon_script_model[ localClientNum ] SetDedicatedShadow( true );
610 
611  return;
612  }
613 
614  if( isDefined(level.current_weapon[ localClientNum ].frontendmodel) )
615  {
616  level.weapon_script_model[ localClientNum ] UseWeaponModel( level.current_weapon[ localClientNum ], level.current_weapon[ localClientNum ].frontendmodel );
617  }
618  else
619  {
620  level.weapon_script_model[ localClientNum ] UseWeaponModel( level.current_weapon[ localClientNum ] );
621  }
622 
623  if( IsDefined( level.weapon_script_model[ localClientNum ] ) )
624  {
625  if( IsDefined( level.attachment_names[ localClientNum ] ) && IsDefined( level.attachment_indices[ localClientNum ] ) )
626  {
627  for( i = 0; i < level.attachment_names[ localClientNum ].size; i++ )
628  {
629  level.weapon_script_model[ localClientNum ] SetAttachmentCosmeticVariantIndex( newWeaponString, level.attachment_names[ localClientNum ][i], level.attachment_indices[ localClientNum ][i] );
630  }
631  }
632 
633  if( should_update_weapon_options )
634  {
635  level.weapon_script_model[ localClientNum ] SetWeaponRenderOptions( ‪get_camo_index( localClientNum ), ‪get_reticle_index( localClientNum ), ‪get_show_payer_tag( localClientNum ), ‪get_show_emblem( localClientNum ), ‪get_show_paintshop( localClientNum ) );
636  }
637  }
638 
639  level.weapon_script_model[ localClientNum ] SetDedicatedShadow( true );
640 }
641 
642 function ‪transition_camera( localClientNum, weaponType, camera, subxcam, initialDelay, lerpDuration, notetrack, newWeaponString, should_update_weapon_options = false )
643 {
644  self endon( "entityshutdown" );
645  self notify( "xcamMoved" );
646  self endon( "xcamMoved" );
647  level endon( "cam_customization_closed" );
648 
649  if( IsDefined( newWeaponString ) )
650  {
651  ‪preload_weapon_model( localClientNum, newWeaponString, should_update_weapon_options );
652  }
653 
654  wait initialDelay;
655 
656  ‪transition_camera_immediate( localClientNum, weaponType, camera, subxcam, lerpDuration, notetrack );
657 
658  if( IsDefined( newWeaponString ) )
659  {
660  wait lerpDuration / 1000;
661 
662  ‪wait_preload_weapon( localClientNum );
663 
664  ‪update_weapon_script_model( localClientNum, newWeaponString, should_update_weapon_options );
665  }
666 }
667 
668 function ‪get_attachments_intersection( oldWeapon, newWeapon )
669 {
670  if( !isDefined(oldWeapon) )
671  {
672  return newWeapon;
673  }
674 
675  oldWeaponParams = strtok(oldWeapon, "+");
676  newWeaponParams = strtok(newWeapon, "+");
677 
678  if( oldWeaponParams[0] != newWeaponParams[0] )
679  {
680  return newWeapon;
681  }
682 
683  newWeaponString = newWeaponParams[0];
684 
685  for ( i = 1; i < newWeaponParams.size; i++ )
686  {
687  if( isinarray( oldWeaponParams, newWeaponParams[i] ) )
688  {
689  newWeaponString += "+" + newWeaponParams[i];
690  }
691  }
692 
693  return newWeaponString;
694 }
695 
696 function ‪handle_cac_customization_focus( localClientNum )
697 {
698  level endon( "disconnect" );
699  level endon( "cam_customization_closed" + localClientNum );
700 
701  while( true )
702  {
703  level waittill( "cam_customization_focus" + localClientNum, param1, param2 );
704 
705  base_weapon_slot = param1;
706  notetrack = param2;
707  if( IsDefined( level.weapon_script_model[ localClientNum ] ) )
708  {
709  should_update_weapon_options = true;
710  level thread ‪customclass::transition_camera( localClientNum, base_weapon_slot, "cam_cac_weapon", "cam_cac", .30, 400, notetrack, level.last_weapon_name[ localClientNum ], should_update_weapon_options );
711  }
712  }
713 }
714 
716 {
717  level endon("disconnect");
718  level endon( "cam_customization_closed" + localClientNum );
719 
720  while( true )
721  {
722  level waittill( "cam_customization_wo" + localClientNum, weapon_option, weapon_option_new_index, is_item_locked );
723 
724  if( IsDefined( level.weapon_script_model[ localClientNum ] ) )
725  {
726  if( ‪IS_TRUE( is_item_locked ) )
727  {
728  weapon_option_new_index = 0;
729  }
730 
731  switch( weapon_option )
732  {
733  case "camo":
734  level.camo_index[ localClientNum ] = int( weapon_option_new_index );
735  break;
736  case "reticle":
737  level.reticle_index[ localClientNum ] = int( weapon_option_new_index );
738  break;
739  case "paintjob":
740  level.show_paintshop[ localClientNum ] = int( weapon_option_new_index );
741  break;
742  default:
743  break;
744  }
745 
746  level.weapon_script_model[ localClientNum ] SetWeaponRenderOptions( ‪customclass::get_camo_index( localClientNum ), ‪customclass::get_reticle_index( localClientNum ), ‪customclass::get_show_payer_tag( localClientNum ), ‪customclass::get_show_emblem( localClientNum ), ‪customclass::get_show_paintshop( localClientNum ) );
747  }
748  }
749 }
750 
752 {
753  level endon( "disconnect" );
754  level endon( "cam_customization_closed" + localClientNum );
755 
756  while( true )
757  {
758  level waittill( "cam_customization_acv" + localClientNum, weapon_attachment_name, acv_index );
759 
760  for ( i = 0; i < level.attachment_names[ localClientNum ].size; i++ )
761  {
762  if( level.attachment_names[ localClientNum ][i] == weapon_attachment_name )
763  {
764  level.attachment_indices[ localClientNum ][i] = int( acv_index );
765  break;
766  }
767  }
768 
769  if( IsDefined( level.weapon_script_model[ localClientNum ] ) )
770  {
771  level.weapon_script_model[ localClientNum ] SetAttachmentCosmeticVariantIndex( level.last_weapon_name[ localClientNum ], weapon_attachment_name, int( acv_index ) );
772  }
773  }
774 }
775 
776 function ‪handle_cac_customization_closed( localClientNum )
777 {
778  level endon("disconnect");
779 
780  level waittill( "cam_customization_closed" + localClientNum, param1, param2, param3, param4 );
781 
782  if( IsDefined( level.weapon_clientscript_cac_model[ localClientNum ] ) && IsDefined( level.weapon_clientscript_cac_model[ localClientNum ][ level.loadout_slot_name ] ) )
783  {
784  level.weapon_clientscript_cac_model[ localClientNum ][ level.loadout_slot_name ] SetWeaponRenderOptions( ‪customclass::get_camo_index( localClientNum ), ‪customclass::get_reticle_index( localClientNum ), ‪customclass::get_show_payer_tag( localClientNum ), ‪customclass::get_show_emblem( localClientNum ), ‪customclass::get_show_paintshop( localClientNum ) );
785  for( i = 0; i < level.attachment_names[ localClientNum ].size; i++ )
786  {
787  level.weapon_clientscript_cac_model[ localClientNum ][ level.loadout_slot_name ] SetAttachmentCosmeticVariantIndex( level.last_weapon_name[ localClientNum ], level.attachment_names[ localClientNum ][i], level.attachment_indices[ localClientNum ][i] );
788  }
789  }
790 }
‪get_show_emblem
‪function get_show_emblem(localClientNum)
Definition: custom_class.csc:409
‪PAINTSHOP_LIGHT_EXPLODER_NAME
‪#define PAINTSHOP_LIGHT_EXPLODER_NAME
Definition: custom_class.csc:27
‪get_lerp_duration
‪function get_lerp_duration(camera)
Definition: custom_class.csc:445
‪preload_weapon_model
‪function preload_weapon_model(localClientNum, newWeaponString, should_update_weapon_options=true)
Definition: custom_class.csc:553
‪PAINTSHOP_WEAPON_KICK_EXPLODER_NAME
‪#define PAINTSHOP_WEAPON_KICK_EXPLODER_NAME
Definition: custom_class.csc:26
‪PAINTSHOP_LIGHT_ZOOM_EXPLODER_NAME
‪#define PAINTSHOP_LIGHT_ZOOM_EXPLODER_NAME
Definition: custom_class.csc:28
‪preload_weapon_watcher
‪function preload_weapon_watcher(localClientNum)
Definition: custom_class.csc:535
‪transition_camera
‪function transition_camera(localClientNum, weaponType, camera, subxcam, initialDelay, lerpDuration, notetrack, newWeaponString, should_update_weapon_options=false)
Definition: custom_class.csc:642
‪get_attachments_intersection
‪function get_attachments_intersection(oldWeapon, newWeapon)
Definition: custom_class.csc:668
‪get_show_paintshop
‪function get_show_paintshop(localClientNum)
Definition: custom_class.csc:419
‪setFrontendStreamingOverlay
‪function setFrontendStreamingOverlay(localClientNum, system, enabled)
Definition: postfx_shared.csc:279
‪DR_TYPE_OFFSCREEN
‪#define DR_TYPE_OFFSCREEN
Definition: duplicaterender.gsh:6
‪get_camo_index
‪function get_camo_index(localClientNum)
Definition: custom_class.csc:379
‪spawn_weapon_model
‪function spawn_weapon_model(localClientNum, origin, angles)
Definition: custom_class.csc:328
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪custom_class_start_threads
‪function custom_class_start_threads(localClientNum)
Definition: custom_class.csc:69
‪handle_cac_customization_closed
‪function handle_cac_customization_closed(localClientNum)
Definition: custom_class.csc:776
‪hide_paintshop_bg
‪function hide_paintshop_bg(localClientNum)
Definition: custom_class.csc:355
‪DEFAULT
‪#define DEFAULT(__var, __default)
Definition: shared.gsh:270
‪ATTACHMENT_TABLE_COL_NAME
‪#define ATTACHMENT_TABLE_COL_NAME
Definition: statstable_shared.gsh:22
‪transition_camera_immediate
‪function transition_camera_immediate(localClientNum, weaponType, camera, subxcam, lerpDuration, notetrack)
Definition: custom_class.csc:483
‪DR_CULL_NEVER
‪#define DR_CULL_NEVER
Definition: duplicaterender.gsh:15
‪get_show_payer_tag
‪function get_show_payer_tag(localClientNum)
Definition: custom_class.csc:399
‪set_weapon_options
‪function set_weapon_options(localClientNum, weapon_options_param)
Definition: custom_class.csc:429
‪ATTACHMENT_TABLE_COL_GROUP
‪#define ATTACHMENT_TABLE_COL_GROUP
Definition: statstable_shared.gsh:21
‪custom_class_closed
‪function custom_class_closed(localClientNum)
Definition: custom_class.csc:307
‪init
‪function init()
Definition: custom_class.csc:38
‪waittill_any
‪function waittill_any(str_notify1, str_notify2, str_notify3, str_notify4, str_notify5)
Definition: util_shared.csc:375
‪custom_class_update
‪function custom_class_update(localClientNum)
Definition: custom_class.csc:103
‪custom_class_init
‪function custom_class_init(localClientNum)
Definition: custom_class.csc:60
‪wait_preload_weapon
‪function wait_preload_weapon(localClientNum)
Definition: custom_class.csc:525
‪update_weapon_script_model
‪function update_weapon_script_model(localClientNum, newWeaponString, should_update_weapon_options=true, is_item_unlocked=true, is_item_tokenlocked=false)
Definition: custom_class.csc:595
‪Spawn
‪function Spawn(parent, onDeathCallback)
Definition: _flak_drone.gsc:427
‪setup_paintshop_bg
‪function setup_paintshop_bg(localClientNum, camera)
Definition: custom_class.csc:460
‪show_paintshop_bg
‪function show_paintshop_bg(localClientNum)
Definition: custom_class.csc:369
‪handle_cac_customization_weaponoption
‪function handle_cac_customization_weaponoption(localClientNum)
Definition: custom_class.csc:715
‪set_attachment_cosmetic_variants
‪function set_attachment_cosmetic_variants(localClientNum, acv_param)
Definition: custom_class.csc:341
‪CAC_LOCKED_WEAPON
‪#define CAC_LOCKED_WEAPON
Definition: custom_class.csc:29
‪toggle_locked_weapon_shader
‪function toggle_locked_weapon_shader(localClientNum, is_item_unlocked=true)
Definition: custom_class.csc:162
‪custom_class_attachment_select_focus
‪function custom_class_attachment_select_focus(localClientNum)
Definition: custom_class.csc:211
‪localClientConnect
‪function localClientConnect(localClientNum)
Definition: custom_class.csc:33
‪set_dr_filter_offscreen
‪function set_dr_filter_offscreen(name, priority, require_flags, refuse_flags, drtype1, drval1, drcull1, drtype2, drval2, drcull2, drtype3, drval3, drcull3)
Definition: duplicaterender_mgr.csc:177
‪get_reticle_index
‪function get_reticle_index(localClientNum)
Definition: custom_class.csc:389
‪toggle_tokenlocked_weapon_shader
‪function toggle_tokenlocked_weapon_shader(localClientNum, is_item_tokenlocked=false)
Definition: custom_class.csc:179
‪custom_class_remove
‪function custom_class_remove(localClientNum)
Definition: custom_class.csc:280
‪is_optic
‪function is_optic(attachmentName)
Definition: custom_class.csc:196
‪handle_cac_customization_attachmentvariant
‪function handle_cac_customization_attachmentvariant(localClientNum)
Definition: custom_class.csc:751
‪handle_cac_customization_focus
‪function handle_cac_customization_focus(localClientNum)
Definition: custom_class.csc:696
‪handle_cac_customization
‪function handle_cac_customization(localClientNum)
Definition: custom_class.csc:84