‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_armor.gsc
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\math_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 
9 #precache( "lui_menu_data", "hudItems.armorPercent" );
10 
11 #namespace armor;
12 
13 function ‪setLightArmorHP( newValue )
14 {
15  if ( IsDefined( newValue ) )
16  {
17  self.lightArmorHP = newValue;
18  if( IsPlayer( self ) && IsDefined( self.maxLightArmorHP ) && self.maxLightArmorHP > 0 )
19  {
20  lightArmorPercent = ‪math::clamp( self.lightArmorHP / self.maxLightArmorHP, 0, 1 );
21  self SetControllerUIModelValue( "hudItems.armorPercent", lightArmorPercent );
22  }
23  }
24  else
25  {
26  self.lightArmorHP = undefined;
27  self.maxLightArmorHP = undefined;
28  self SetControllerUIModelValue( "hudItems.armorPercent", 0 );
29  }
30 }
31 
33 // ARMOR: give a health boost
34 function ‪setLightArmor( optionalArmorValue )
35 {
36  self notify( "give_light_armor" );
37 
38  if( IsDefined( self.lightArmorHP ) )
40 
41  self thread ‪removeLightArmorOnDeath();
42  self thread ‪removeLightArmorOnMatchEnd();
43 
44  if( IsDefined( optionalArmorValue ) )
45  self.maxLightArmorHP = optionalArmorValue;
46  else
47  self.maxLightArmorHP = 150;
48 
49  self ‪setLightArmorHP( self.maxLightArmorHP );
50 }
51 
53 {
54  self endon ( "disconnect" );
55  self endon( "give_light_armor" );
56  self endon( "remove_light_armor" );
57 
58  self waittill ( "death" );
60 }
61 
63 {
64  self ‪setLightArmorHP( undefined );
65 
66  self notify( "remove_light_armor" );
67 }
68 
70 {
71  self endon ( "disconnect" );
72  self endon ( "remove_light_armor" );
73 
74  level waittill( "game_ended" );
75 
76  self thread ‪unsetLightArmor();
77 }
78 
79 function ‪hasLightArmor()
80 {
81  return ( IsDefined( self.lightArmorHP ) && self.lightArmorHP > 0 );
82 }
83 
84 function ‪getArmor()
85 {
86  if( IsDefined( self.lightArmorHP ) )
87  {
88  return self.lightArmorHP;
89  }
90  return 0;
91 }
‪unsetLightArmor
‪function unsetLightArmor()
Definition: _armor.gsc:62
‪removeLightArmorOnDeath
‪function removeLightArmorOnDeath()
Definition: _armor.gsc:52
‪getArmor
‪function getArmor()
Definition: _armor.gsc:84
‪hasLightArmor
‪function hasLightArmor()
Definition: _armor.gsc:79
‪removeLightArmorOnMatchEnd
‪function removeLightArmorOnMatchEnd()
Definition: _armor.gsc:69
‪clamp
‪function clamp(val, val_min, val_max)
Definition: math_shared.csc:16
‪setLightArmorHP
‪function setLightArmorHP(newValue)
Definition: _armor.gsc:13
‪setLightArmor
‪function setLightArmor(optionalArmorValue)
Definition: _armor.gsc:34