Advertisement
NachosEater

_deathicons

Nov 19th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. #include maps\mp\_utility;
  2.  
  3. init()
  4. {
  5. if (!level.teambased)
  6. return;
  7.  
  8. precacheShader("headicon_dead");
  9.  
  10. level thread onPlayerConnect();
  11. }
  12.  
  13. onPlayerConnect()
  14. {
  15. for(;;)
  16. {
  17. level waittill("connected", player);
  18.  
  19. player.selfDeathIcons = []; // icons that other people see which point to this player when he's dead
  20. }
  21. }
  22.  
  23. updateDeathIconsEnabled()
  24. {
  25. //if (!self.enableDeathIcons)
  26. // self removeOtherDeathIcons();
  27. }
  28.  
  29. addDeathIcon( entity, dyingplayer, team, timeout )
  30. {
  31. if ( !level.teambased )
  32. return;
  33.  
  34. iconOrg = entity.origin;
  35.  
  36. dyingplayer endon("spawned_player");
  37. dyingplayer endon("disconnect");
  38.  
  39. wait .05;
  40. WaitTillSlowProcessAllowed();
  41.  
  42. assert(team == "allies" || team == "axis");
  43.  
  44. if ( getDvar( "ui_hud_showdeathicons" ) == "0" )
  45. return;
  46. if ( level.hardcoreMode )
  47. return;
  48.  
  49. if ( isdefined( self.lastDeathIcon ) )
  50. self.lastDeathIcon destroy();
  51.  
  52. newdeathicon = newTeamHudElem( team );
  53. newdeathicon.x = iconOrg[0];
  54. newdeathicon.y = iconOrg[1];
  55. newdeathicon.z = iconOrg[2] + 54;
  56. newdeathicon.alpha = .61;
  57. newdeathicon.archived = true;
  58. if ( level.splitscreen )
  59. newdeathicon setShader("headicon_dead", 14, 14);
  60. else
  61. newdeathicon setShader("headicon_dead", 7, 7);
  62. newdeathicon setwaypoint( false );
  63.  
  64. self.lastDeathIcon = newdeathicon;
  65.  
  66. newdeathicon thread destroySlowly ( timeout );
  67. }
  68.  
  69. destroySlowly( timeout )
  70. {
  71. self endon("death");
  72.  
  73. wait timeout;
  74.  
  75. self fadeOverTime(1.0);
  76. self.alpha = 0;
  77.  
  78. wait 1.0;
  79. self destroy();
  80. }
  81.  
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement