‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
archetype_robot.csc
Go to the documentation of this file.
1 #using scripts\shared\ai_shared;
2 #using scripts\shared\clientfield_shared;
3 #using scripts\shared\duplicaterender_mgr;
4 #using scripts\shared\util_shared;
5 #using scripts\shared\ai\systems\fx_character;
6 #using scripts\shared\ai\systems\gib;
7 #using scripts\shared\system_shared;
8 
9 #insert scripts\shared\shared.gsh;
10 #insert scripts\shared\duplicaterender.gsh;
11 #insert scripts\shared\version.gsh;
12 #insert scripts\shared\ai\archetype_robot.gsh;
13 #insert scripts\shared\ai\systems\gib.gsh;
14 #insert scripts\shared\archetype_shared\archetype_shared.gsh;
15 
16 #precache( "client_fx", ROBOT_EMP_FX_FILE );
17 #precache( "client_fx", ROBOT_MIND_CONTROL_EXPLOSION_FX_FILE );
18 
19 ‪REGISTER_SYSTEM( "robot", &‪__init__, undefined )
20 
21 function autoexec ‪precache()
22 {
23  level._effect[ ‪ROBOT_EMP_FX ] = ‪ROBOT_EMP_FX_FILE;
25 }
26 
27 function ‪__init__()
28 {
30  {
32  "actor",
40 
42  "actor",
50 
52  "actor",
60 
62  "actor",
70  }
71 
73 }
74 
75 #namespace RobotClientUtils;
76 
77 function private ‪robotSoldierSpawnSetup( localClientNum )
78 {
79  entity = self;
80 }
81 
82 function private ‪robotLighting( localClientNum, entity, flicker, mindControlState )
83 {
84  switch ( mindControlState )
85  {
87  entity TmodeClearFlag( 0 );
88 
89  if ( flicker )
90  {
91  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_BASE_FLICKER( entity ) );
92  }
93  else
94  {
95  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_BASE( entity ) );
96  }
97  break;
99  entity TmodeClearFlag( 0 );
100 
101  ‪FxClientUtils::StopAllFXBundles( localClientNum, entity );
102 
103  if ( flicker )
104  {
105  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_ROGUE_LEVEL_1_FLICKER( entity ) );
106  }
107  else
108  {
109  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_ROGUE_LEVEL_1( entity ) );
110  }
111 
112  if ( !‪GibClientUtils::IsGibbed( localClientNum, entity, ‪GIB_TORSO_HEAD_FLAG ) )
113  {
114  entity PlaySound(localClientNum, "fly_bot_ctrl_lvl_01_start", entity.origin);
115  }
116  break;
118  entity TmodeSetFlag( 0 );
119 
120  ‪FxClientUtils::StopAllFXBundles( localClientNum, entity );
121 
122  if ( flicker )
123  {
124  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_ROGUE_LEVEL_2_FLICKER( entity ) );
125  }
126  else
127  {
128  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_ROGUE_LEVEL_2( entity ) );
129  }
130 
131  if ( !‪GibClientUtils::IsGibbed( localClientNum, entity, ‪GIB_TORSO_HEAD_FLAG ) )
132  {
133  entity PlaySound(localClientNum, "fly_bot_ctrl_lvl_02_start", entity.origin);
134  }
135  break;
137  entity TmodeSetFlag( 0 );
138 
139  ‪FxClientUtils::StopAllFXBundles( localClientNum, entity );
140 
141  if ( flicker )
142  {
143  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_ROGUE_LEVEL_3_FLICKER( entity ) );
144  }
145  else
146  {
147  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_ROGUE_LEVEL_3( entity ) );
148  }
149 
150  entity PlaySound(localClientNum, "fly_bot_ctrl_lvl_03_start", entity.origin);
151 
152  break;
153  }
154 }
155 
156 function private ‪robotLightsHandler( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump )
157 {
158  entity = self;
159 
160  if ( !IsDefined( entity ) ||
161  !entity IsAI() ||
162  ( IsDefined( entity.archetype ) && entity.archetype != "robot" ) )
163  {
164  return;
165  }
166 
167  ‪FxClientUtils::StopAllFXBundles( localClientNum, entity );
168 
169  flicker = newValue == ‪ROBOT_LIGHTS_FLICKER;
170 
171  if ( newValue == ‪ROBOT_LIGHTS_ON || newValue == ‪ROBOT_LIGHTS_HACKED || flicker )
172  {
173  ‪robotLighting( localClientNum, entity, flicker, ‪clientfield::get( ‪ROBOT_MIND_CONTROL_CLIENTFIELD ) );
174  }
175  else if ( newValue == ‪ROBOT_LIGHTS_DEATH )
176  {
177  ‪FxClientUtils::PlayFxBundle( localClientNum, entity, ‪ROBOT_FX_DEATH( entity ) );
178  }
179 }
180 
181 function private ‪robotEmpHandler( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump )
182 {
183  entity = self;
184 
185  if ( !IsDefined( entity ) ||
186  !entity IsAI() ||
187  ( IsDefined( entity.archetype ) && entity.archetype != "robot" ) )
188  {
189  return;
190  }
191 
192  if ( IsDefined( entity.empFX ) )
193  {
194  StopFx( localClientNum, entity.empFX );
195  }
196 
197  switch ( newValue )
198  {
199  case ‪ROBOT_EMP_OFF:
200  break;
201  case ‪ROBOT_EMP_ON:
202  entity.empFX = PlayFxOnTag(
203  localClientNum,
204  level._effect[ ‪ROBOT_EMP_FX ],
205  entity,
207  break;
208  }
209 }
210 
211 function private ‪robotMindControlHandler( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump )
212 {
213  entity = self;
214 
215  if ( !IsDefined( entity ) ||
216  !entity IsAI() ||
217  ( IsDefined( entity.archetype ) && entity.archetype != "robot" ) )
218  {
219  return;
220  }
221 
223  flicker = lights == ‪ROBOT_LIGHTS_FLICKER;
224 
225  if ( lights == ‪ROBOT_LIGHTS_ON || flicker )
226  {
227  ‪robotLighting( localClientNum, entity, flicker, newValue );
228  }
229 }
230 
231 function ‪robotMindControlExplosionHandler( localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump )
232 {
233  entity = self;
234 
235  if ( !IsDefined( entity ) ||
236  !entity IsAI() ||
237  ( IsDefined( entity.archetype ) && entity.archetype != "robot" ) )
238  {
239  return;
240  }
241 
242  switch ( newValue )
243  {
245  entity.explosionFx =
246  PlayFxOnTag(
247  localClientNum,
248  level._effect[ ‪ROBOT_MIND_CONTROL_EXPLOSION_FX ],
249  entity,
251  break;
252  }
253 }
‪ROBOT_LIGHTS_BITS
‪#define ROBOT_LIGHTS_BITS
Definition: archetype_robot.gsh:180
‪StopAllFXBundles
‪function StopAllFXBundles(localClientNum, entity)
Definition: fx_character.csc:14
‪ROBOT_FX_ROGUE_LEVEL_1
‪#define ROBOT_FX_ROGUE_LEVEL_1(entity)
Definition: archetype_robot.gsh:209
‪ROBOT_MIND_CONTROL_EXPLOSION_ON
‪#define ROBOT_MIND_CONTROL_EXPLOSION_ON
Definition: archetype_robot.gsh:171
‪ROBOT_MIND_CONTROL_LEVEL_0
‪#define ROBOT_MIND_CONTROL_LEVEL_0
Definition: archetype_robot.gsh:162
‪ROBOT_FX_ROGUE_LEVEL_2
‪#define ROBOT_FX_ROGUE_LEVEL_2(entity)
Definition: archetype_robot.gsh:211
‪ROBOT_MIND_CONTROL_EXPLOSION_CLIENTFIELD
‪#define ROBOT_MIND_CONTROL_EXPLOSION_CLIENTFIELD
Definition: archetype_robot.gsh:167
‪ROBOT_FX_BASE_FLICKER
‪#define ROBOT_FX_BASE_FLICKER(entity)
Definition: archetype_robot.gsh:207
‪ROBOT_EMP_OFF
‪#define ROBOT_EMP_OFF
Definition: archetype_robot.gsh:176
‪ROBOT_FX_ROGUE_LEVEL_3
‪#define ROBOT_FX_ROGUE_LEVEL_3(entity)
Definition: archetype_robot.gsh:213
‪robotLightsHandler
‪function private robotLightsHandler(localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump)
Definition: archetype_robot.csc:156
‪CF_CALLBACK_ZERO_ON_NEW_ENT
‪#define CF_CALLBACK_ZERO_ON_NEW_ENT
Definition: version.gsh:103
‪ROBOT_FX_DEATH
‪#define ROBOT_FX_DEATH(entity)
Definition: archetype_robot.gsh:208
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪precache
‪function autoexec precache()
Definition: archetype_robot.csc:21
‪ROBOT_FX_BASE
‪#define ROBOT_FX_BASE(entity)
Definition: archetype_robot.gsh:206
‪ROBOT_LIGHTS_CLIENTFIELD
‪#define ROBOT_LIGHTS_CLIENTFIELD
Definition: archetype_robot.gsh:179
‪PlayFxBundle
‪function PlayFxBundle(localClientNum, entity, fxScriptBundle)
Definition: fx_character.csc:13
‪ROBOT_MIND_CONTROL_EXPLOSION_TYPE
‪#define ROBOT_MIND_CONTROL_EXPLOSION_TYPE
Definition: archetype_robot.gsh:169
‪ROBOT_LIGHTS_ON
‪#define ROBOT_LIGHTS_ON
Definition: archetype_robot.gsh:182
‪robotLighting
‪function private robotLighting(localClientNum, entity, flicker, mindControlState)
Definition: archetype_robot.csc:82
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪ROBOT_FX_ROGUE_LEVEL_3_FLICKER
‪#define ROBOT_FX_ROGUE_LEVEL_3_FLICKER(entity)
Definition: archetype_robot.gsh:214
‪ROBOT_LIGHTS_DEATH
‪#define ROBOT_LIGHTS_DEATH
Definition: archetype_robot.gsh:186
‪ROBOT_MIND_CONTROL_LEVEL_1
‪#define ROBOT_MIND_CONTROL_LEVEL_1
Definition: archetype_robot.gsh:163
‪ROBOT_LIGHTS_HACKED
‪#define ROBOT_LIGHTS_HACKED
Definition: archetype_robot.gsh:185
‪ROBOT_EMP_FX
‪#define ROBOT_EMP_FX
Definition: archetype_robot.gsh:202
‪robotSoldierSpawnSetup
‪function private robotSoldierSpawnSetup(localClientNum)
Definition: archetype_robot.csc:77
‪ROBOT_LIGHTS_FLICKER
‪#define ROBOT_LIGHTS_FLICKER
Definition: archetype_robot.gsh:183
‪ROBOT_MIND_CONTROL_LEVEL_3
‪#define ROBOT_MIND_CONTROL_LEVEL_3
Definition: archetype_robot.gsh:165
‪__init__
‪function __init__()
Definition: archetype_robot.csc:27
‪ROBOT_MIND_CONTROL_BITS
‪#define ROBOT_MIND_CONTROL_BITS
Definition: archetype_robot.gsh:160
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪robotMindControlHandler
‪function private robotMindControlHandler(localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump)
Definition: archetype_robot.csc:211
‪IsGibbed
‪function IsGibbed(localClientNum, entity, gibFlag)
Definition: gib.csc:734
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪robotMindControlExplosionHandler
‪function robotMindControlExplosionHandler(localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump)
Definition: archetype_robot.csc:231
‪ROBOT_MIND_CONTROL_CLIENTFIELD
‪#define ROBOT_MIND_CONTROL_CLIENTFIELD
Definition: archetype_robot.gsh:159
‪ROBOT_EMP_CLIENTFIELD
‪#define ROBOT_EMP_CLIENTFIELD
Definition: archetype_robot.gsh:173
‪ROBOT_EMP_FX_FILE
‪#define ROBOT_EMP_FX_FILE
Definition: archetype_robot.gsh:203
‪ROBOT_EMP_BITS
‪#define ROBOT_EMP_BITS
Definition: archetype_robot.gsh:174
‪ROBOT_EMP_ON
‪#define ROBOT_EMP_ON
Definition: archetype_robot.gsh:177
‪ROBOT_MIND_CONTROL_EXPLOSION_FX_TAG
‪#define ROBOT_MIND_CONTROL_EXPLOSION_FX_TAG
Definition: archetype_robot.gsh:200
‪add_archetype_spawn_function
‪function add_archetype_spawn_function(archetype, spawn_func)
Definition: ai_shared.csc:23
‪ROBOT_MIND_CONTROL_EXPLOSION_FX
‪#define ROBOT_MIND_CONTROL_EXPLOSION_FX
Definition: archetype_robot.gsh:198
‪ROBOT_MIND_CONTROL_EXPLOSION_BITS
‪#define ROBOT_MIND_CONTROL_EXPLOSION_BITS
Definition: archetype_robot.gsh:168
‪ROBOT_MIND_CONTROL_LEVEL_2
‪#define ROBOT_MIND_CONTROL_LEVEL_2
Definition: archetype_robot.gsh:164
‪ROBOT_FX_ROGUE_LEVEL_1_FLICKER
‪#define ROBOT_FX_ROGUE_LEVEL_1_FLICKER(entity)
Definition: archetype_robot.gsh:210
‪ROBOT_LIGHTS_TYPE
‪#define ROBOT_LIGHTS_TYPE
Definition: archetype_robot.gsh:181
‪ROBOT_EMP_FX_TAG
‪#define ROBOT_EMP_FX_TAG
Definition: archetype_robot.gsh:204
‪shouldRegisterClientFieldForArchetype
‪function shouldRegisterClientFieldForArchetype(archetype)
Definition: ai_shared.csc:72
‪ROBOT_FX_ROGUE_LEVEL_2_FLICKER
‪#define ROBOT_FX_ROGUE_LEVEL_2_FLICKER(entity)
Definition: archetype_robot.gsh:212
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪ROBOT_EMP_TYPE
‪#define ROBOT_EMP_TYPE
Definition: archetype_robot.gsh:175
‪ROBOT_MIND_CONTROL_TYPE
‪#define ROBOT_MIND_CONTROL_TYPE
Definition: archetype_robot.gsh:161
‪ARCHETYPE_ROBOT
‪#define ARCHETYPE_ROBOT
Definition: archetype_shared.gsh:8
‪robotEmpHandler
‪function private robotEmpHandler(localClientNum, oldValue, newValue, bNewEnt, bInitialSnap, fieldName, wasDemoJump)
Definition: archetype_robot.csc:181
‪GIB_TORSO_HEAD_FLAG
‪#define GIB_TORSO_HEAD_FLAG
Definition: gib.gsh:24
‪ROBOT_MIND_CONTROL_EXPLOSION_FX_FILE
‪#define ROBOT_MIND_CONTROL_EXPLOSION_FX_FILE
Definition: archetype_robot.gsh:199