‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_deathicons.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\gameobjects_shared;
5 #using scripts\shared\system_shared;
6 #using scripts\shared\util_shared;
7 
8 #insert scripts\shared\shared.gsh;
9 
10 #using scripts\mp\gametypes\_globallogic_utils;
11 
12 #precache( "objective", "headicon_dead" );
13 
14 #namespace deathicons;
15 
16 ‪REGISTER_SYSTEM( "deathicons", &‪__init__, undefined )
17 
18 function ‪__init__()
19 {
22 }
23 
24 function ‪init()
25 {
26  if ( !isdefined( level.ragdoll_override ) )
27  {
28  level.ragdoll_override = &‪ragdoll_override;
29  }
30  if (!level.teambased)
31  return;
32 }
33 
35 {
36  self.selfDeathIcons = []; // icons that other people see which point to this player when he's dead
37 }
38 
40 {
41 }
42 
43 function ‪add( entity, dyingplayer, team, ‪timeout )
44 {
45  if ( !level.teambased )
46  return;
47 
48  iconOrg = entity.origin;
49 
50  dyingplayer endon("spawned_player");
51  dyingplayer endon("disconnect");
52 
53  wait .05;
55 
56  assert(isdefined( level.teams[team] ));
57  assert(isdefined( level.teamIndex[team] ));
58 
59  if ( GetDvarString( "ui_hud_showdeathicons" ) == "0" )
60  return;
61 
62  if ( level.hardcoreMode )
63  return;
64 
65  deathIconObjId = ‪gameobjects::get_next_obj_id();
66  objective_add( deathIconObjId, "active", iconOrg, &"headicon_dead" );
67  objective_team( deathIconObjId, team );
68 
69  level thread ‪destroy_slowly( ‪timeout, deathIconObjId );
70 }
71 
72 function ‪destroy_slowly( ‪timeout, deathIconObjId )
73 {
74  wait ‪timeout;
75 
76  objective_state( deathIconObjId, "done" );
77 
78  wait 1.0;
79 
80  objective_delete( deathIconObjId );
81  ‪gameobjects::release_obj_id( deathIconObjId );
82 }
83 
84 
85 function ‪ragdoll_override( iDamage, sMeansOfDeath, sWeapon, sHitLoc, vDir, vAttackerOrigin, deathAnimDuration, eInflictor, ragdoll_jib, body )
86 {
87  if ( sMeansOfDeath == "MOD_FALLING" && self IsOnGround() == true )
88  {
89  body startRagDoll();
90 
91  if ( !isDefined( self.switching_teams ) )
92  thread ‪add( body, self, self.team, 5.0 );
93  return true;
94  }
95  return false;
96 }
97 
‪timeout
‪function timeout(n_time, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.csc:762
‪init
‪function init()
Definition: _deathicons.gsc:24
‪update_enabled
‪function update_enabled()
Definition: _deathicons.gsc:39
‪on_start_gametype
‪function on_start_gametype(func, obj)
Definition: callbacks_shared.csc:285
‪destroy_slowly
‪function destroy_slowly(timeout, deathIconObjId)
Definition: _deathicons.gsc:72
‪add
‪function add(entity, dyingplayer, team, timeout)
Definition: _deathicons.gsc:43
‪get_next_obj_id
‪function get_next_obj_id()
Definition: gameobjects_shared.gsc:4132
‪release_obj_id
‪function release_obj_id(objID)
Definition: gameobjects_shared.gsc:4166
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪__init__
‪function __init__()
Definition: _deathicons.gsc:18
‪ragdoll_override
‪function ragdoll_override(iDamage, sMeansOfDeath, sWeapon, sHitLoc, vDir, vAttackerOrigin, deathAnimDuration, eInflictor, ragdoll_jib, body)
Definition: _deathicons.gsc:85
‪on_player_connect
‪function on_player_connect()
Definition: _deathicons.gsc:34
‪on_connect
‪function on_connect()
Definition: _arena.gsc:20
‪WaitTillSlowProcessAllowed
‪function WaitTillSlowProcessAllowed()
Definition: util_shared.gsc:2536