coughstate.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. class CoughSymptom extends SymptomBase
  2. {
  3. const int COUGH_BLOOD_LOSS = 50;
  4. //this is just for the Symptom parameters set-up and is called even if the Symptom doesn't execute, don't put any gameplay code in here
  5. override void OnInit()
  6. {
  7. m_SymptomType = SymptomTypes.PRIMARY;
  8. m_Priority = 100;
  9. m_ID = SymptomIDs.SYMPTOM_COUGH;
  10. m_DestroyOnAnimFinish = true;
  11. m_SyncToClient = false;
  12. }
  13. bool IsContaminationActive()
  14. {
  15. return m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_CONTAMINATION2) || m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_CONTAMINATION3);
  16. }
  17. //!gets called every frame
  18. override void OnUpdateServer(PlayerBase player, float deltatime)
  19. {
  20. }
  21. override void OnUpdateClient(PlayerBase player, float deltatime)
  22. {
  23. }
  24. override void OnAnimationStart()
  25. {
  26. if ( IsContaminationActive() )
  27. {
  28. PluginLifespan module_lifespan = PluginLifespan.Cast( GetPlugin( PluginLifespan ) );
  29. module_lifespan.UpdateBloodyHandsVisibilityEx( m_Player, eBloodyHandsTypes.JUST_BLOOD );
  30. }
  31. }
  32. override SmptAnimMetaBase SpawnAnimMetaObject()
  33. {
  34. return new SmptAnimMetaADD();
  35. }
  36. //!gets called once on an Symptom which is being activated
  37. override void OnGetActivatedServer(PlayerBase player)
  38. {
  39. if( m_Manager.GetCurrentCommandID() == DayZPlayerConstants.COMMANDID_MOVE && !player.IsRaised() && player.GetCommand_Move() && player.GetCommand_Move() && !player.GetCommand_Move().IsOnBack())
  40. {
  41. PlayAnimationADD(1);
  42. }
  43. else
  44. {
  45. PlaySound(EPlayerSoundEventID.SYMPTOM_COUGH);
  46. }
  47. player.SpreadAgentsEx(3);
  48. if ( IsContaminationActive() )
  49. player.AddHealth("","Blood", -COUGH_BLOOD_LOSS);
  50. }
  51. //!gets called once on a Symptom which is being activated
  52. override void OnGetActivatedClient(PlayerBase player)
  53. {
  54. //if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetActivated", m_Player.ToString());
  55. }
  56. //!only gets called once on an active Symptom that is being deactivated
  57. override void OnGetDeactivatedServer(PlayerBase player)
  58. {
  59. //if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
  60. }
  61. //!only gets called once on an active Symptom that is being deactivated
  62. override void OnGetDeactivatedClient(PlayerBase player)
  63. {
  64. //if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
  65. }
  66. }