‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
fx_shared.gsc
Go to the documentation of this file.
1 #using scripts\shared\callbacks_shared;
2 #using scripts\shared\exploder_shared;
3 #using scripts\shared\system_shared;
4 #using scripts\shared\util_shared;
5 
6 #insert scripts\shared\shared.gsh;
7 
8 #namespace fx;
9 
10 ‪REGISTER_SYSTEM( "fx", &‪__init__, undefined )
11 
12 function ‪__init__()
13 {
14 }
15 
17 {
18  self.v["up"] = anglestoup(self.v["angles"]);
19  self.v["forward"] = anglestoforward(self.v["angles"]);
20 }
21 
22 function ‪get( fx )
23 {
24  assert( isdefined( level._effect[ fx ] ), "Fx " + fx + " is not defined in level._effect." );
25  return level._effect[ fx ];
26 }
27 
28 // Adds effects as entities in level.createFXent[].
29 function ‪create_effect( type, fxid )
30 {
31  ent = undefined;
32 
33  if (!isdefined(level.createFXent))
34  {
35  level.createFXent = [];
36  }
37  if(type == "exploder")
38  {
39  ent = SpawnStruct();
40  }
41  else
42  {
43  if(!isdefined(level._fake_createfx_struct))
44  {
45  level._fake_createfx_struct = SpawnStruct();
46  }
47 
48  ent = level._fake_createfx_struct;
49  }
50 
51  level.createFXent[level.createFXent.size] = ent;
52  ent.v = [];
53  ent.v["type"] = type;
54  ent.v["fxid"] = fxid;
55  ent.v["angles"] = (0,0,0);
56  ent.v["origin"] = (0,0,0);
57  ent.drawn = true;
58  return ent;
59 }
60 
61 function ‪create_loop_effect( fxid )
62 {
63  ent = ‪create_effect( "loopfx", fxid );
64  ent.v[ "delay" ] = 0.5;
65  return ent;
66 }
67 
68 function ‪create_oneshot_effect( fxid )
69 {
70  ent = ‪create_effect( "oneshotfx", fxid );
71  ent.v[ "delay" ] = -15;
72  return ent;
73 }
74 
92 function ‪play( str_fx, v_origin = ( 0, 0, 0 ), v_angles = ( 0, 0, 0 ), time_to_delete_or_notify, b_link_to_self = false, str_tag, b_no_cull, b_ignore_pause_world )
93 {
94  self notify( str_fx );
95 
96  if ( ( !isdefined( time_to_delete_or_notify ) || ( !IsString( time_to_delete_or_notify ) && time_to_delete_or_notify == -1 ) )
97  && ‪IS_TRUE( b_link_to_self ) && isdefined( str_tag ) )
98  {
99  PlayFXOnTag( ‪get( str_fx ), self, str_tag, b_ignore_pause_world );
100  return self;
101  }
102  else
103  {
104  if ( isdefined( time_to_delete_or_notify ) )
105  {
106  m_fx = ‪util::spawn_model( "tag_origin", v_origin, v_angles );
107 
108  if ( ‪IS_TRUE( b_link_to_self ) )
109  {
110  if ( isdefined( str_tag ) )
111  {
112  m_fx LinkTo( self, str_tag, (0, 0, 0), (0, 0, 0) );
113  }
114  else
115  {
116  m_fx LinkTo( self );
117  }
118  }
119 
120  if ( ‪IS_TRUE( b_no_cull ) )
121  {
122  m_fx SetForceNoCull();
123  }
124 
125  PlayFXOnTag( ‪get( str_fx ), m_fx, "tag_origin", b_ignore_pause_world );
126  m_fx thread ‪_play_fx_delete( self, time_to_delete_or_notify );
127  return m_fx;
128  }
129  else
130  {
131  PlayFX( ‪get( str_fx ), v_origin, AnglesToForward( v_angles ), AnglesToUp( v_angles ), b_ignore_pause_world );
132  }
133  }
134 }
135 
136 function ‪_play_fx_delete( ent, time_to_delete_or_notify = (-1) )
137 {
138  if ( IsString( time_to_delete_or_notify ) )
139  {
140  ent ‪util::waittill_either( "death", time_to_delete_or_notify );
141  }
142  else if ( time_to_delete_or_notify > 0 )
143  {
144  ent ‪util::waittill_any_timeout( time_to_delete_or_notify, "death" );
145  }
146  else
147  {
148  ent waittill( "death" );
149  }
150 
151  if ( isdefined( self ) )
152  {
153  self Delete();
154  }
155 }
‪__init__
‪function __init__()
Definition: fx_shared.gsc:12
‪waittill_either
‪function waittill_either(msg1, msg2)
Definition: util_shared.gsc:303
‪waittill_any_timeout
‪function waittill_any_timeout(n_timeout, string1, string2, string3, string4, string5)
Definition: util_shared.csc:423
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪spawn_model
‪function spawn_model(n_client, str_model, origin=(0, 0, 0), angles=(0, 0, 0))
Definition: util_shared.csc:92
‪create_loop_effect
‪function create_loop_effect(fxid)
Definition: fx_shared.gsc:61
‪create_oneshot_effect
‪function create_oneshot_effect(fxid)
Definition: fx_shared.gsc:68
‪play
‪function play(str_fx, v_origin=(0, 0, 0), v_angles=(0, 0, 0), time_to_delete_or_notify, b_link_to_self=false, str_tag, b_no_cull, b_ignore_pause_world)
Definition: fx_shared.gsc:92
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪get
‪function get(fx)
Definition: fx_shared.gsc:22
‪set_forward_and_up_vectors
‪function set_forward_and_up_vectors()
Definition: fx_shared.gsc:16
‪create_effect
‪function create_effect(type, fxid)
Definition: fx_shared.gsc:29
‪_play_fx_delete
‪function _play_fx_delete(ent, time_to_delete_or_notify=(-1))
Definition: fx_shared.gsc:136