‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_riotshield.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\system_shared;
5 #using scripts\shared\util_shared;
6 
7 #insert scripts\shared\shared.gsh;
8 #insert scripts\shared\version.gsh;
9 
10 #precache( "client_fx", "_t6/weapon/riotshield/fx_riotshield_depoly_lights" );
11 #precache( "client_fx", "_t6/weapon/riotshield/fx_riotshield_depoly_dust" );
12 
13 #using_animtree ( "mp_riotshield" );
14 
15 #namespace riotshield;
16 
17 function ‪init_shared()
18 {
20 
21  level._effect["riotshield_light"] = "_t6/weapon/riotshield/fx_riotshield_depoly_lights";
22  level._effect["riotshield_dust"] = "_t6/weapon/riotshield/fx_riotshield_depoly_dust";
23 }
24 
25 //******************************************************************
26 // *
27 // *
28 //******************************************************************
29 function ‪shield_state_change( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
30 {
31  self endon("entityshutdown");
32 
33  switch( newVal )
34  {
36  {
37  instant = ( oldVal == ‪RIOTSHIELD_STATE_DESTROYED );
38  self thread ‪riotshield_deploy_anim( localClientNum, instant );
39  break;
40  }
42  {
43  self thread ‪riotshield_destroy_anim( localClientNum );
44  break;
45  }
46  }
47 }
48 
49 //******************************************************************
50 // *
51 // *
52 //******************************************************************
53 function ‪riotshield_deploy_anim( localClientNum, instant )
54 {
55  self endon("entityshutdown");
56 
57  self thread ‪watch_riotshield_damage();
58 
59  self ‪util::waittill_dobj( localClientNum );
60 
61  self UseAnimTree( #animtree );
62 
63  if ( instant )
64  {
65  self SetAnimTime( %o_riot_stand_deploy, 1.0 );
66  }
67  else
68  {
69  self SetAnim( %o_riot_stand_deploy, 1.0, 0.0, 1.0 );
70  PlayFXOnTag( localClientNum, level._effect["riotshield_dust"], self, "tag_origin" );
71  }
72 
73  if ( !instant )
74  {
75  wait( 0.8 );
76  }
77 
78  self.shieldLightFx = PlayFXOnTag( localClientNum, level._effect["riotshield_light"], self, "tag_fx" );
79 }
80 
81 //******************************************************************
82 // *
83 // *
84 //******************************************************************
86 {
87  self endon("entityshutdown");
88 
89  while (1)
90  {
91  self waittill( "damage", damage_loc, damage_type );
92 
93  self UseAnimTree( #animtree );
94 
95  //println("CLIENT: Riotshield hit - " + damage_type + " " + damage_loc );
96 
97  if ( damage_type == "MOD_MELEE" || damage_type == "MOD_MELEE_WEAPON_BUTT" || damage_type == "MOD_MELEE_ASSASSINATE" )
98  {
99  self SetAnim( %o_riot_stand_melee_front, 1.0, 0.0, 1.0 );
100  }
101  else
102  {
103  self SetAnim( %o_riot_stand_shot, 1.0, 0.0, 1.0 );
104  }
105  }
106 }
107 
108 //******************************************************************
109 // *
110 // *
111 //******************************************************************
112 function ‪riotshield_destroy_anim( localClientNum )
113 {
114  self endon("entityshutdown");
115 
116  if ( isdefined( self.shieldLightFx ))
117  {
118  stopfx( localClientNum, self.shieldLightFx );
119  }
120 
121  // tagTMR<NOTE>: Don't update the anim the same frame as the model swap
122  wait (0.05);
123 
124  self PlaySound( localClientNum, "wpn_shield_destroy" );
125 
126  self UseAnimTree( #animtree );
127  self SetAnim( %o_riot_stand_destroyed, 1.0, 0.0, 1.0 );
128 
129  wait( 1.0 );
130  self SetForceNotSimple();
131 }
‪RIOTSHIELD_STATE_DEPLOYED
‪#define RIOTSHIELD_STATE_DEPLOYED
Definition: shared.gsh:316
‪init_shared
‪function init_shared()
Definition: _riotshield.csc:17
‪riotshield_destroy_anim
‪function riotshield_destroy_anim(localClientNum)
Definition: _riotshield.csc:112
‪shield_state_change
‪function shield_state_change(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _riotshield.csc:29
‪CF_CALLBACK_ZERO_ON_NEW_ENT
‪#define CF_CALLBACK_ZERO_ON_NEW_ENT
Definition: version.gsh:103
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪RIOTSHIELD_STATE_DESTROYED
‪#define RIOTSHIELD_STATE_DESTROYED
Definition: shared.gsh:317
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪riotshield_deploy_anim
‪function riotshield_deploy_anim(localClientNum, instant)
Definition: _riotshield.csc:53
‪watch_riotshield_damage
‪function watch_riotshield_damage()
Definition: _riotshield.csc:85
‪waittill_dobj
‪function waittill_dobj(localClientNum)
Definition: util_shared.csc:1117
‪register
‪function register()
Definition: _ai_tank.gsc:126