‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_gadget_thief.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\system_shared;
6 #using scripts\shared\util_shared;
7 
8 #insert scripts\shared\shared.gsh;
9 #insert scripts\shared\version.gsh;
10 
11 #namespace gadget_thief;
12 
13 ‪REGISTER_SYSTEM( "gadget_thief", &‪__init__, undefined )
14 
15 #precache( "client_fx", "weapon/fx_hero_blackjack_beam_source" );
16 #precache( "client_fx", "weapon/fx_hero_blackjack_beam_target" );
17 
18 function ‪__init__()
19 {
23 
24  ‪clientfield::register( "clientuimodel", "playerAbilities.playerGadget3.flashStart", ‪VERSION_TU11, 3, "int", undefined, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
25  ‪clientfield::register( "clientuimodel", "playerAbilities.playerGadget3.flashEnd", ‪VERSION_TU11, 3, "int", undefined, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
26 
27  level._effect["fx_hero_blackjack_beam_source"] = "weapon/fx_hero_blackjack_beam_source";
28  level._effect["fx_hero_blackjack_beam_target"] = "weapon/fx_hero_blackjack_beam_target";
29 
31 }
32 
33 function ‪thief_clientfield_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
34 {
35  self endon( "entityshutdown" );
36 
37  playfxoncamera( localclientnum, level._effect["fx_hero_blackjack_beam_target"], (0,0,0), (1,0,0), (0,0,1) );
38  playfx( localclientnum, level._effect["fx_hero_blackjack_beam_source"], self.origin );
39 }
40 
41 function ‪thief_ui_model_clientfield_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
42 {
43  ‪update_thief( localClientNum, newVal );
44 }
45 
46 function ‪thief_weapon_option_ui_model_clientfield_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
47 {
48  ‪update_thief_weapon( localClientNum, newVal );
49 }
50 
51 function ‪update_thief( localClientNum, newVal )
52 {
53  controllerModel = GetUIModelForController( localClientNum );
54  if ( isdefined( controllerModel ) )
55  {
56  thiefStatusModel = GetUIModel( controllerModel, "playerAbilities.playerGadget3.thiefStatus" );
57  if ( isdefined( thiefStatusModel ) )
58  {
59  SetUIModelValue( thiefStatusModel, newVal );
60  }
61  }
62 }
63 
64 function ‪update_thief_weapon( localClientNum, newVal )
65 {
66  controllerModel = GetUIModelForController( localClientNum );
67  if ( isdefined( controllerModel ) )
68  {
69  thiefStatusModel = GetUIModel( controllerModel, "playerAbilities.playerGadget3.thiefWeaponStatus" );
70  if ( isdefined( thiefStatusModel ) )
71  {
72  SetUIModelValue( thiefStatusModel, newVal );
73  }
74  }
75 }
76 
77 function ‪on_localplayer_spawned( localClientNum )
78 {
79  thief_state = 0;
80  thief_weapon_option = 0;
81 
82  if ( getserverhighestclientfieldversion() >= ‪VERSION_TU11 )
83  {
84  thief_state = self ‪clientfield::get_to_player( "thief_state" );
85  thief_weapon_option = self ‪clientfield::get_to_player( "thief_weapon_option" );
86  }
87 
88 
89  ‪update_thief( localClientNum, thief_state );
90  ‪update_thief_weapon( localClientNum, thief_weapon_option );
91 }
‪VERSION_TU11
‪#define VERSION_TU11
Definition: version.gsh:61
‪update_thief
‪function update_thief(localClientNum, newVal)
Definition: _gadget_thief.csc:51
‪get_to_player
‪function get_to_player(field_name)
Definition: clientfield_shared.csc:38
‪thief_clientfield_cb
‪function thief_clientfield_cb(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _gadget_thief.csc:33
‪thief_ui_model_clientfield_cb
‪function thief_ui_model_clientfield_cb(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _gadget_thief.csc:41
‪CF_CALLBACK_ZERO_ON_NEW_ENT
‪#define CF_CALLBACK_ZERO_ON_NEW_ENT
Definition: version.gsh:103
‪update_thief_weapon
‪function update_thief_weapon(localClientNum, newVal)
Definition: _gadget_thief.csc:64
‪on_localplayer_spawned
‪function on_localplayer_spawned(localClientNum)
Definition: _gadget_thief.csc:77
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪thief_weapon_option_ui_model_clientfield_cb
‪function thief_weapon_option_ui_model_clientfield_cb(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _gadget_thief.csc:46
‪__init__
‪function __init__()
Definition: _gadget_thief.csc:18
‪register
‪function register()
Definition: _ai_tank.gsc:126