‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
dom.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\util_shared;
6 
7 #insert scripts\shared\shared.gsh;
8 #insert scripts\shared\version.gsh;
9 
10 #precache( "client_fx", "ui/fx_dom_cap_indicator_team" );
11 #precache( "client_fx", "ui/fx_dom_cap_indicator_neutral" );
12 #precache( "client_fx", "ui/fx_dom_marker_team" );
13 #precache( "client_fx", "ui/fx_dom_marker_neutral" );
14 
15 function ‪main()
16 {
18  if( GetGametypeSetting( "silentPlant" ) != 0 )
19  setsoundcontext( "bomb_plant", "silent" );
20 }
21 
22 function ‪on_localclient_connect( localClientNum )
23 {
24  self.domFlags = [];
25 
26  while ( !isdefined( level.domFlags["a"] ) )
27  {
28  self.domFlags["a"] = ServerObjective_GetObjective( localClientNum, "dom_a" );
29  self.domFlags["b"] = ServerObjective_GetObjective( localClientNum, "dom_b" );
30  self.domFlags["c"] = ServerObjective_GetObjective( localClientNum, "dom_c" );
31  wait (0.05);
32  }
33 
34  foreach( key, flag_objective in self.‪domFlags)
35  {
36  self thread ‪monitor_flag_fx(localClientNum, flag_objective, key);
37  }
38 }
39 
40 function ‪monitor_flag_fx(localClientNum, flag_objective, flag_name)
41 {
42  if ( !IsDefined( flag_objective ) )
43  return;
44 
45  flag = SpawnStruct();
46 
47  flag.name = flag_name;
48  flag.objectiveId = flag_objective;
49  flag.origin = ServerObjective_GetObjectiveOrigin( localClientNum, flag_objective );
50  flag.angles = (0,0,0);
51 
52  flag_entity = ServerObjective_GetObjectiveEntity( localClientNum, flag_objective );
53 
54  if ( isdefined(flag_entity) )
55  {
56  flag.origin = flag_entity.origin;
57  flag.angles = flag_entity.angles;
58  }
59 
60  fx_name = ‪get_base_fx( flag, "neutral" );
61  ‪play_base_fx( localClientNum, flag, fx_name, "neutral" );
62  flag.last_progress = 0;
63  while(1)
64  {
65 
66  team = ServerObjective_GetObjectiveTeam( localClientNum, flag_objective );
67  if ( team != flag.last_team )
68  {
69  flag ‪update_base_fx( localClientNum, flag, team );
70  }
71 
72  progress = (ServerObjective_GetObjectiveProgress( localClientNum, flag_objective ) > 0);
73  if ( progress != flag.last_progress )
74  {
75  flag ‪update_cap_fx( localClientNum, flag, team, progress );
76  }
77 
78  wait(0.05);
79  }
80 }
81 
82 function ‪play_base_fx( localClientNum, flag, fx_name, team )
83 {
84  if ( isdefined( flag.base_fx ) )
85  {
86  StopFx( localClientNum, flag.base_fx );
87  }
88 
89  up = anglesToUp(flag.angles);
90  forward = anglesToForward(flag.angles);
91  flag.base_fx = ‪PlayFx(localClientNum, fx_name, flag.origin, up, forward );
92  SetFxTeam( localClientNum, flag.base_fx, team );
93 
94  flag.last_team = team;
95 }
96 
97 function ‪update_base_fx( localClientNum, flag, team )
98 {
99  fx_name = ‪get_base_fx( flag, team );
100 
101  if ( team == "neutral" )
102  {
103  ‪play_base_fx( localClientNum, flag, fx_name, team );
104  }
105  else if ( flag.last_team == "neutral" )
106  {
107  ‪play_base_fx( localClientNum, flag, fx_name, team );
108  }
109  else
110  {
111  SetFxTeam( localClientNum, flag.base_fx, team );
112  flag.last_team = team;
113  }
114 }
115 
116 function ‪play_cap_fx( localClientNum, flag, fx_name, team )
117 {
118  if ( isdefined( flag.cap_fx ) )
119  {
120  KillFx( localClientNum, flag.cap_fx );
121  }
122 
123  up = anglesToUp(flag.angles);
124  forward = anglesToForward(flag.angles);
125  flag.cap_fx = ‪PlayFx(localClientNum, fx_name, flag.origin, up, forward );
126  SetFxTeam( localClientNum, flag.cap_fx, team );
127 }
128 
129 function ‪update_cap_fx( localClientNum, flag, team, progress )
130 {
131  if ( progress == 0 )
132  {
133  if ( isdefined( flag.cap_fx ) )
134  {
135  KillFx( localClientNum, flag.cap_fx );
136  }
137  flag.last_progress = progress;
138  return;
139  }
140 
141  fx_name = ‪get_cap_fx( flag, team );
142 
143  ‪play_cap_fx( localClientNum, flag, fx_name, team );
144 
145  flag.last_progress = progress;
146 }
147 
148 function ‪get_base_fx( flag, team )
149 {
150  if ( isdefined( level.domFlagBaseFxOverride ) )
151  {
152  fx = [[level.domFlagBaseFxOverride]]( flag, team );
153  if ( isdefined( fx ) )
154  return fx;
155  }
156 
157  if ( team == "neutral" )
158  {
159  return "ui/fx_dom_marker_neutral";
160  }
161  else
162  {
163  return "ui/fx_dom_marker_team";
164  }
165 }
166 
167 function ‪get_cap_fx( flag, team )
168 {
169  if ( isdefined( level.domFlagCapFxOverride ) )
170  {
171  fx = [[level.domFlagCapFxOverride]]( flag, team );
172  if ( isdefined( fx ) )
173  return fx;
174  }
175 
176  if ( team == "neutral" )
177  {
178  return "ui/fx_dom_cap_indicator_neutral";
179  }
180  else
181  {
182  return "ui/fx_dom_cap_indicator_team";
183  }
184 }
‪monitor_flag_fx
‪function monitor_flag_fx(localClientNum, flag_objective, flag_name)
Definition: dom.csc:40
‪update_base_fx
‪function update_base_fx(localClientNum, flag, team)
Definition: dom.csc:97
‪play_cap_fx
‪function play_cap_fx(localClientNum, flag, fx_name, team)
Definition: dom.csc:116
‪update_cap_fx
‪function update_cap_fx(localClientNum, flag, team, progress)
Definition: dom.csc:129
‪get_cap_fx
‪function get_cap_fx(flag, team)
Definition: dom.csc:167
‪on_localclient_connect
‪function on_localclient_connect(localClientNum)
Definition: dom.csc:22
‪play_base_fx
‪function play_base_fx(localClientNum, flag, fx_name, team)
Definition: dom.csc:82
‪get_base_fx
‪function get_base_fx(flag, team)
Definition: dom.csc:148
‪domFlags
‪function domFlags()
Definition: dom.gsc:313
‪main
‪function main()
Definition: dom.csc:15
‪PlayFx
‪function PlayFx(name)
Definition: _counteruav.gsc:390