‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_oob.csc
Go to the documentation of this file.
1 #using scripts\shared\system_shared;
2 #using scripts\shared\clientfield_shared;
3 #using scripts\shared\filter_shared;
4 #using scripts\shared\callbacks_shared;
5 
6 #insert scripts\shared\clientfields.gsh;
7 #insert scripts\shared\shared.gsh;
8 #insert scripts\shared\version.gsh;
9 
10 #namespace oob;
11 
12 ‪REGISTER_SYSTEM( "out_of_bounds", &‪__init__, undefined )
13 
14 #define OOB_TIMELIMIT_MS_DEFAULT 6000 //Change the value in the _oob.gsc file to match this one
15 #define OOB_TIMELIMIT_MS_DEFAULT_MP 3000 //Change the value in the _oob.gsc file to match this one
16 #define OOB_TIMEKEEP_MP 3000 //Change the value in the _oob.gsc file to match this one
17 
18 function ‪__init__()
19 {
20  if(SessionModeIsMultiplayerGame())
21  {
22  level.oob_timelimit_ms = GetDvarInt( "oob_timelimit_ms", ‪OOB_TIMELIMIT_MS_DEFAULT_MP );
23  level.oob_timekeep_ms = GetDvarInt( "oob_timekeep_ms", ‪OOB_TIMEKEEP_MP );
24  }
25  else
26  {
27  level.oob_timelimit_ms = GetDvarInt( "oob_timelimit_ms", ‪OOB_TIMELIMIT_MS_DEFAULT );
28  }
29 
31 
32 
33  if( !SessionModeIsZombiesGame() )
34  {
38  }
39 }
40 
41 function ‪on_localplayer_connect( localClientNum )
42 {
43  if( self != GetLocalPlayer( localClientNum ) )
44  return;
45 
46  oobModel = ‪GetOObUIModel( localClientNum );
47  SetUIModelValue( oobModel, 0 );
48 }
49 
50 function ‪on_localplayer_spawned( localClientNum )
51 {
53  self Randomfade( 0 );
54 }
55 
56 function ‪on_localplayer_shutdown( localClientNum )
57 {
58  localPlayer = self;
59  if ( isdefined( localPlayer ) )
60  {
61  ‪StopOutOfBoundsEffects( localClientNum, localPlayer );
62  }
63 }
64 
65 function ‪onOutOfBoundsChange( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
66 {
67 
68  localPlayer = GetLocalPlayer( localClientNum );
69 
70  if(!isdefined(level.oob_sound_ent))
71  {
72  level.oob_sound_ent = [];
73  }
74 
75  if( !isdefined( level.oob_sound_ent[localClientNum] ) )
76  {
77  level.oob_sound_ent[localClientNum] = ‪Spawn( localClientNum, (0,0,0), "script_origin" );
78  }
79 
80  if( newVal > 0)
81  {
82  if( !isdefined( localPlayer.oob_effect_enabled ) )
83  {
84  ‪filter::init_filter_oob( localPlayer );
86  localPlayer.oob_effect_enabled = true;
87 
88  level.oob_sound_ent[localClientNum] PlayLoopSound( "uin_out_of_bounds_loop", 0.5 );//not sure why this sound was added
89 
90  oobModel = ‪GetOObUIModel( localClientNum );
91 
92  //Logic to pause/continue the OOB time for a certain duration if the player come out/in from it.
93  if( isdefined(level.oob_timekeep_ms) && isdefined(self.oob_start_time) && isdefined(self.oob_active_duration) &&
94  ((getServerTime(0) - self.oob_end_time) < level.oob_timekeep_ms) )
95  {
96  SetUIModelValue( oobModel, getServerTime( 0, true ) + (level.oob_timelimit_ms - self.oob_active_duration) );
97  }
98  else
99  {
100  self.oob_active_duration = undefined;
101  SetUIModelValue( oobModel, getServerTime( 0, true ) + level.oob_timelimit_ms );
102  }
103 
104  self.oob_start_time = getServerTime(0, true);
105  }
106 
107  newValf = newVal / 31.0;
108 
109  localPlayer Randomfade( newValf );
110  }
111  else
112  {
113  if( isdefined(level.oob_timekeep_ms) && isdefined(self.oob_start_time))
114  {
115  self.oob_end_time = getServerTime( 0, true );
116 
117  if(!isdefined(self.oob_active_duration))
118  {
119  self.oob_active_duration = 0;
120  }
121 
122  self.oob_active_duration += self.oob_end_time - self.oob_start_time;
123  }
124 
125  ‪StopOutOfBoundsEffects( localClientNum, localPlayer );
126  }
127 }
128 
129 function ‪StopOutOfBoundsEffects( localClientNum, localPlayer )
130 {
132  localPlayer Randomfade( 0 );
133 
134  if( isDefined(level.oob_sound_ent) && isdefined( level.oob_sound_ent[localClientNum] ) )
135  {
136  level.oob_sound_ent[localClientNum] StopAllLoopSounds( 0.5 );
137  }
138 
139  oobModel = ‪GetOObUIModel( localClientNum );
140  SetUIModelValue( oobModel, 0 );
141 
142  if( isdefined( localPlayer.oob_effect_enabled ) )
143  {
144  localPlayer.oob_effect_enabled = false;
145  localPlayer.oob_effect_enabled = undefined;
146  }
147 }
148 
149 function ‪GetOObUIModel( localClientNum )
150 {
151  controllerModel = GetUIModelForController( localClientNum );
152  return CreateUIModel( controllerModel, "hudItems.outOfBoundsEndTime" );
153 }
‪onOutOfBoundsChange
‪function onOutOfBoundsChange(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _oob.csc:65
‪init_filter_oob
‪function init_filter_oob(player)
Definition: filter_shared.csc:406
‪disable_filter_oob
‪function disable_filter_oob(player, filterid)
Definition: filter_shared.csc:418
‪on_localclient_shutdown
‪function on_localclient_shutdown(func, obj)
Definition: callbacks_shared.csc:190
‪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
‪OOB_TIMEKEEP_MP
‪#define OOB_TIMEKEEP_MP
Definition: _oob.csc:16
‪GetOObUIModel
‪function GetOObUIModel(localClientNum)
Definition: _oob.csc:149
‪on_localplayer_shutdown
‪function on_localplayer_shutdown(localClientNum)
Definition: _oob.csc:56
‪__init__
‪function __init__()
Definition: _oob.csc:18
‪on_localclient_connect
‪function on_localclient_connect(localClientNum)
Definition: ctf.csc:20
‪on_localplayer_spawned
‪function on_localplayer_spawned(localClientNum)
Definition: _oob.csc:50
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪OOB_TIMELIMIT_MS_DEFAULT
‪#define OOB_TIMELIMIT_MS_DEFAULT
Definition: _oob.csc:14
‪enable_filter_oob
‪function enable_filter_oob(player, filterid)
Definition: filter_shared.csc:412
‪StopOutOfBoundsEffects
‪function StopOutOfBoundsEffects(localClientNum, localPlayer)
Definition: _oob.csc:129
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪OOB_TIMELIMIT_MS_DEFAULT_MP
‪#define OOB_TIMELIMIT_MS_DEFAULT_MP
Definition: _oob.csc:15
‪Spawn
‪function Spawn(parent, onDeathCallback)
Definition: _flak_drone.gsc:427
‪FILTER_INDEX_OOB
‪#define FILTER_INDEX_OOB
Definition: shared.gsh:481
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪on_localplayer_connect
‪function on_localplayer_connect(localClientNum)
Definition: _oob.csc:41