‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_burnplayer.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\system_shared;
4 #using scripts\shared\util_shared;
5 #using scripts\shared\clientfield_shared;
6 #using scripts\shared\postfx_shared;
7 #using scripts\shared\callbacks_shared;
8 
9 #insert scripts\shared\shared.gsh;
10 #insert scripts\shared\version.gsh;
11 
12 #namespace burnplayer;
13 
14 ‪REGISTER_SYSTEM( "burnplayer", &‪__init__, undefined )
15 
16 // human burning effects
17 #precache( "client_fx", "fire/fx_fire_ai_human_arm_left_loop" );
18 #precache( "client_fx", "fire/fx_fire_ai_human_arm_left_os" );
19 #precache( "client_fx", "fire/fx_fire_ai_human_arm_right_loop" );
20 #precache( "client_fx", "fire/fx_fire_ai_human_arm_right_os" );
21 #precache( "client_fx", "fire/fx_fire_ai_human_hip_left_loop" );
22 #precache( "client_fx", "fire/fx_fire_ai_human_hip_left_os" );
23 #precache( "client_fx", "fire/fx_fire_ai_human_hip_right_loop" );
24 #precache( "client_fx", "fire/fx_fire_ai_human_hip_right_os" );
25 #precache( "client_fx", "fire/fx_fire_ai_human_leg_left_loop" );
26 #precache( "client_fx", "fire/fx_fire_ai_human_leg_left_os" );
27 #precache( "client_fx", "fire/fx_fire_ai_human_leg_right_loop" );
28 #precache( "client_fx", "fire/fx_fire_ai_human_leg_right_os" );
29 #precache( "client_fx", "fire/fx_fire_ai_human_torso_loop" );
30 #precache( "client_fx", "fire/fx_fire_ai_human_torso_os" );
31 #precache( "client_fx", "fire/fx_fire_ai_human_head_loop" );
32 #precache( "client_fx", "fire/fx_fire_ai_human_head_os" );
33 
34 function ‪__init__()
35 {
41 }
42 
43 
44 function ‪LoadEffects()
45 {
46  //fire fx
47  level._effect["burn_j_elbow_le_loop"] = "fire/fx_fire_ai_human_arm_left_loop"; // hand and forearm fires
48  level._effect["burn_j_elbow_ri_loop"] = "fire/fx_fire_ai_human_arm_right_loop";
49  level._effect["burn_j_shoulder_le_loop"] = "fire/fx_fire_ai_human_arm_left_loop"; // upper arm fires
50  level._effect["burn_j_shoulder_ri_loop"] = "fire/fx_fire_ai_human_arm_right_loop";
51  level._effect["burn_j_spine4_loop"] = "fire/fx_fire_ai_human_torso_loop"; // upper torso fires
52  level._effect["burn_j_hip_le_loop"] = "fire/fx_fire_ai_human_hip_left_loop"; // thigh fires
53  level._effect["burn_j_hip_ri_loop"] = "fire/fx_fire_ai_human_hip_right_loop";
54  level._effect["burn_j_knee_le_loop"] = "fire/fx_fire_ai_human_leg_left_loop"; // shin fires
55  level._effect["burn_j_knee_ri_loop"] = "fire/fx_fire_ai_human_leg_right_loop";
56  level._effect["burn_j_head_loop"] = "fire/fx_fire_ai_human_head_loop"; // head fire
57 
58  level._effect["burn_j_elbow_le_os"] = "fire/fx_fire_ai_human_arm_left_os"; // hand and forearm fires
59  level._effect["burn_j_elbow_ri_os"] = "fire/fx_fire_ai_human_arm_right_os";
60  level._effect["burn_j_shoulder_le_os"] = "fire/fx_fire_ai_human_arm_left_os"; // upper arm fires
61  level._effect["burn_j_shoulder_ri_os"] = "fire/fx_fire_ai_human_arm_right_os";
62  level._effect["burn_j_spine4_os"] = "fire/fx_fire_ai_human_torso_os"; // upper torso fires
63  level._effect["burn_j_hip_le_os"] = "fire/fx_fire_ai_human_hip_left_os"; // thigh fire
64  level._effect["burn_j_hip_ri_os"] = "fire/fx_fire_ai_human_hip_right_os";
65  level._effect["burn_j_knee_le_os"] = "fire/fx_fire_ai_human_leg_left_os"; // shin fires
66  level._effect["burn_j_knee_ri_os"] = "fire/fx_fire_ai_human_leg_right_os";
67  level._effect["burn_j_head_os"] = "fire/fx_fire_ai_human_head_os"; // head fire
68 
69  level.burnTags = ‪array("j_elbow_le", "j_elbow_ri", "j_shoulder_le", "j_shoulder_ri", "j_spine4", "j_spinelower", "j_hip_le", "j_hip_ri", "j_head", "j_knee_le", "j_knee_ri" );
70 }
71 
72 function ‪on_local_client_connect( localClientNum )
73 {
74  RegisterRewindFX( localClientNum, level._effect["burn_j_elbow_le_loop"]);
75  RegisterRewindFX( localClientNum, level._effect["burn_j_elbow_ri_loop"]);
76  RegisterRewindFX( localClientNum, level._effect["burn_j_shoulder_le_loop"]);
77  RegisterRewindFX( localClientNum, level._effect["burn_j_shoulder_ri_loop"]);
78  RegisterRewindFX( localClientNum, level._effect["burn_j_spine4_loop"]);
79  RegisterRewindFX( localClientNum, level._effect["burn_j_hip_le_loop"]);
80  RegisterRewindFX( localClientNum, level._effect["burn_j_hip_ri_loop"]);
81  RegisterRewindFX( localClientNum, level._effect["burn_j_knee_le_loop"]);
82  RegisterRewindFX( localClientNum, level._effect["burn_j_knee_ri_loop"]);
83  RegisterRewindFX( localClientNum, level._effect["burn_j_head_loop"]);
84 }
85 
86 function ‪on_localplayer_spawned( localClientNum )
87 {
88 
89 }
90 
91 function ‪burning_callback( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
92 {
93  if ( newVal )
94  {
95  self ‪burn_on( localClientNum );
96  }
97  else
98  {
99  self ‪burn_off( localClientNum );
100  }
101 }
102 
103 function ‪burning_corpse_callback( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
104 {
105  if ( newVal )
106  {
107  self ‪set_corpse_burning( localClientNum );
108  }
109  else
110  {
111  self ‪burn_off( localClientNum );
112  }
113 }
114 
115 function ‪set_corpse_burning( localClientNum )
116 {
117  self thread ‪_burnBody( localClientNum );
118 }
119 
120 function ‪burn_off( localClientNum )
121 {
122  self notify( "burn_off" );
123 
124  if( GetLocalPlayer( localClientNum ) == self )
125  {
127  }
128 }
129 
130 function ‪burn_on( localClientNum )
131 {
132  if( GetLocalPlayer( localClientNum ) != self || IsThirdPerson( localClientNum ) )
133  {
134  self thread ‪_burnBody( localClientNum );
135  }
136 
137  if( GetLocalPlayer( localClientNum ) == self && !IsThirdPerson( localClientNum ) )
138  {
139  self thread ‪burn_on_postfx();
140  }
141 }
142 
144 {
145  self endon( "entityshutdown" );
146  self endon( "burn_off" );
147  self endon( "death" );
148  self notify( "burn_on_postfx" );
149  self endon( "burn_on_postfx" );
150 
151  self thread postfx::PlayPostfxBundle( "pstfx_burn_loop" );
152 }
153 
154 function private ‪_burnTag( localClientNum, tag, postfix )
155 {
156  if( isDefined( self ) && self hasdobj( localclientnum ) )
157  {
158  fxname = "burn_" + tag + postfix;
159  if( isDefined( level._effect[fxname] ) )
160  {
161  return PlayFXOnTag( localClientNum, level._effect[fxname], self, tag );
162  }
163  }
164 }
165 
166 function private ‪_burnTagsOn( localClientNum, tags )
167 {
168  if( !isDefined( self ) )
169  return;
170 
171  self endon( "entityshutdown" );
172  self endon( "burn_off" );
173  self notify( "burn_tags_on" );
174  self endon( "burn_tags_on" );
175 
176  activeFx = [];
177  for( i = 0; i < tags.size; i++ )
178  {
179  activeFx[activeFx.size] = self ‪_burnTag( localClientNum, tags[i], "_loop" );
180  }
181 
182  burnSound = self playloopsound( "chr_burn_loop_overlay", .5);
183 
184  self thread ‪_burnTagsWatchEnd( localClientNum, activeFx, burnSound );
185  self thread ‪_burnTagsWatchClear( localClientNum, activeFx, burnSound );
186 }
187 
188 function private ‪_burnBody(localClientNum)
189 {
190  self endon("entityshutdown");
191 
192  self thread ‪_burnTagsOn( localClientNum, level.burnTags );
193 }
194 
195 function private ‪_burnTagsWatchEnd( localClientNum, fxArray, burnSound )
196 {
197  self endon ( "entityshutdown" );
198 
199  self waittill( "burn_off" );
200 
201  if( isdefined( burnSound ) )
202  {
203  self stoploopsound( burnSound, 1 );
204  }
205 
206  if( isDefined( fxArray ) )
207  {
208  foreach( fx in fxArray )
209  {
210  StopFx( localClientNum, fx );
211  }
212  }
213 }
214 
215 function private ‪_burnTagsWatchClear( localClientNum, fxArray, burnSound )
216 {
217  self endon( "burn_off" );
218  self waittill( "entityshutdown" );
219 
220  if( isdefined( burnSound ) )
221  {
222  stopsound( burnSound );
223  }
224 
225  if( isDefined( fxArray ) )
226  {
227  foreach( fx in fxArray )
228  {
229  StopFx( localClientNum, fx );
230  }
231  }
232 }
‪LoadEffects
‪function LoadEffects()
Definition: _burnplayer.csc:44
‪on_local_client_connect
‪function on_local_client_connect(localClientNum)
Definition: _burnplayer.csc:72
‪_burnBody
‪function private _burnBody(localClientNum)
Definition: _burnplayer.csc:188
‪burn_on
‪function burn_on(localClientNum)
Definition: _burnplayer.csc:130
‪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
‪on_localplayer_spawned
‪function on_localplayer_spawned(localClientNum)
Definition: _burnplayer.csc:86
‪burn_on_postfx
‪function burn_on_postfx()
Definition: _burnplayer.csc:143
‪on_localclient_connect
‪function on_localclient_connect(localClientNum)
Definition: ctf.csc:20
‪set_corpse_burning
‪function set_corpse_burning(localClientNum)
Definition: _burnplayer.csc:115
‪_burnTagsWatchClear
‪function private _burnTagsWatchClear(localClientNum, fxArray, burnSound)
Definition: _burnplayer.csc:215
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪__init__
‪function __init__()
Definition: _burnplayer.csc:34
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪array
‪function filter array
Definition: array_shared.csc:16
‪burning_corpse_callback
‪function burning_corpse_callback(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _burnplayer.csc:103
‪_burnTag
‪function private _burnTag(localClientNum, tag, postfix)
Definition: _burnplayer.csc:154
‪_burnTagsOn
‪function private _burnTagsOn(localClientNum, tags)
Definition: _burnplayer.csc:166
‪_burnTagsWatchEnd
‪function private _burnTagsWatchEnd(localClientNum, fxArray, burnSound)
Definition: _burnplayer.csc:195
‪exitPostfxBundle
‪function exitPostfxBundle()
Definition: postfx_shared.csc:270
‪burn_off
‪function burn_off(localClientNum)
Definition: _burnplayer.csc:120
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪burning_callback
‪function burning_callback(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _burnplayer.csc:91