‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_pack_a_punch_util.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\array_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\flag_shared;
6 #using scripts\shared\util_shared;
7 
8 #insert scripts\shared\shared.gsh;
9 #insert scripts\shared\version.gsh;
10 
11 #using scripts\zm\_util;
12 #using scripts\zm\_zm;
13 #using scripts\zm\_zm_weapons;
14 
15 #insert scripts\zm\_zm_perks.gsh;
16 #insert scripts\zm\_zm_utility.gsh;
17 
18 #namespace zm_pap_util;
19 
21 {
22  if ( !isdefined( level.pack_a_punch ) )
23  {
24  level.pack_a_punch = SpawnStruct();
25  level.pack_a_punch.timeout = 15;
26  level.pack_a_punch.interaction_height = 35;
27  level.pack_a_punch.move_in_func = &‪pap_weapon_move_in;
28  level.pack_a_punch.move_out_func = &‪pap_weapon_move_out;
29  level.pack_a_punch.grabbable_by_anyone = false;
30  level.pack_a_punch.swap_attachments_on_reuse = false;
31  level.pack_a_punch.triggers = [];
32  }
33 }
34 
35 function ‪set_timeout( n_timeout_s )
36 {
38  level.pack_a_punch.timeout = n_timeout_s;
39 }
40 
41 function ‪set_interaction_height( n_height )
42 {
44  level.pack_a_punch.interaction_height = n_height;
45 }
46 
47 function ‪set_interaction_trigger_radius( n_radius ) //You cannot create a trigger with a radius smaller than 40
48 {
50  level.pack_a_punch.interaction_trigger_radius = n_radius;
51 }
52 
54 {
56  level.pack_a_punch.set_interaction_trigger_height = n_height;
57 }
58 
59 function ‪set_move_in_func( fn_move_weapon_in )
60 {
62  level.pack_a_punch.move_in_func = fn_move_weapon_in;
63 }
64 
65 function ‪set_move_out_func( fn_move_weapon_out )
66 {
68  level.pack_a_punch.move_out_func = fn_move_weapon_out;
69 }
70 
72 {
74  level.pack_a_punch.grabbable_by_anyone = true;
75 }
76 
77 function ‪get_triggers()
78 {
80  return level.pack_a_punch.triggers;
81 }
82 
84 {
85  return isdefined( self.script_noteworthy ) && self.script_noteworthy == "pack_a_punch";
86 }
87 
89 {
91  level.pack_a_punch.swap_attachments_on_reuse = true;
92 }
93 
95 {
96  if( !isdefined(level.pack_a_punch) )
97  return false;
98  return level.pack_a_punch.swap_attachments_on_reuse;
99 }
100 
101 // If player is holding an upgraded weapon, display AAT reroll
102 // self == PaP trigger
103 function ‪update_hint_string( player )
104 {
105  // if PaP machine is offering a gun, set to weapon grab string
106  if ( self ‪flag::get( "pap_offering_gun" ) )
107  {
108  self SetHintString( &"ZOMBIE_GET_UPGRADED_FILL" );
109  return;
110  }
111 
112  // Checks to see if player is holding an upgraded weapon
113  w_curr_player_weapon = player GetCurrentWeapon();
114 
115  if ( ‪zm_weapons::is_weapon_upgraded( w_curr_player_weapon ) )
116  {
117  self SetHintString( &"ZOMBIE_PERK_PACKAPUNCH_AAT", self.aat_cost );
118  }
119  // If not, display string to pack non-upgraded weapon
120  else
121  {
122  self SetHintString( &"ZOMBIE_PERK_PACKAPUNCH", self.cost );
123  }
124 }
125 
126 function private ‪pap_weapon_move_in( player, trigger, origin_offset, angles_offset )
127 {
128  level endon("Pack_A_Punch_off");
129  trigger endon("pap_player_disconnected");
130 }
131 
132 function private ‪pap_weapon_move_out( player, trigger, origin_offset, interact_offset)
133 {
134  level endon("Pack_A_Punch_off");
135  trigger endon("pap_player_disconnected");
136 }
‪set_move_out_func
‪function set_move_out_func(fn_move_weapon_out)
Definition: _zm_pack_a_punch_util.gsc:65
‪get_triggers
‪function get_triggers()
Definition: _zm_pack_a_punch_util.gsc:77
‪set_interaction_height
‪function set_interaction_height(n_height)
Definition: _zm_pack_a_punch_util.gsc:41
‪pap_weapon_move_out
‪function private pap_weapon_move_out(player, trigger, origin_offset, interact_offset)
Definition: _zm_pack_a_punch_util.gsc:132
‪is_weapon_upgraded
‪function is_weapon_upgraded(weapon)
Definition: _zm_weapons.csc:155
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪update_hint_string
‪function update_hint_string(player)
Definition: _zm_pack_a_punch_util.gsc:103
‪enable_swap_attachments
‪function enable_swap_attachments()
Definition: _zm_pack_a_punch_util.gsc:88
‪can_swap_attachments
‪function can_swap_attachments()
Definition: _zm_pack_a_punch_util.gsc:94
‪set_interaction_trigger_height
‪function set_interaction_trigger_height(n_height)
Definition: _zm_pack_a_punch_util.gsc:53
‪set_move_in_func
‪function set_move_in_func(fn_move_weapon_in)
Definition: _zm_pack_a_punch_util.gsc:59
‪pap_weapon_move_in
‪function private pap_weapon_move_in(player, trigger, origin_offset, angles_offset)
Definition: _zm_pack_a_punch_util.gsc:126
‪init_parameters
‪function init_parameters()
Definition: _zm_pack_a_punch_util.gsc:20
‪set_interaction_trigger_radius
‪function set_interaction_trigger_radius(n_radius)
Definition: _zm_pack_a_punch_util.gsc:47
‪set_grabbable_by_anyone
‪function set_grabbable_by_anyone()
Definition: _zm_pack_a_punch_util.gsc:71
‪set_timeout
‪function set_timeout(n_timeout_s)
Definition: _zm_pack_a_punch_util.gsc:35
‪is_pap_trigger
‪function is_pap_trigger()
Definition: _zm_pack_a_punch_util.gsc:83