actionwashhandsitemcontinuous.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. class ActionWashHandsItemContinuousCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.WASH_HANDS);
  6. }
  7. };
  8. class ActionWashHandsItemContinuous: ActionContinuousBase
  9. {
  10. void ActionWashHandsItemContinuous()
  11. {
  12. m_CallbackClass = ActionWashHandsItemContinuousCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_CLEANHANDSBOTTLE;
  14. m_FullBody = false;
  15. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_CLEANHANDSBOTTLE;
  16. m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
  17. m_Text = "#wash_hands";
  18. }
  19. override bool HasProneException()
  20. {
  21. return true;
  22. }
  23. override void CreateConditionComponents()
  24. {
  25. m_ConditionItem = new CCINotRuinedAndEmpty;
  26. m_ConditionTarget = new CCTSelf;
  27. }
  28. override bool HasTarget()
  29. {
  30. return false;
  31. }
  32. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  33. {
  34. if ( player.GetItemOnSlot("Gloves") )
  35. return false;
  36. bool result = player.HasBloodyHands() && ( item.GetQuantity() >= item.GetDisinfectQuantity() && !item.GetIsFrozen());
  37. return result;
  38. }
  39. override void OnFinishProgressServer(ActionData action_data)
  40. {
  41. PluginLifespan module_lifespan = PluginLifespan.Cast( GetPlugin( PluginLifespan ) );
  42. module_lifespan.UpdateBloodyHandsVisibility( action_data.m_Player, false );
  43. action_data.m_Player.ClearBloodyHandsPenaltyChancePerAgent(eAgents.SALMONELLA);
  44. action_data.m_MainItem.AddQuantity( -action_data.m_MainItem.GetDisinfectQuantity(), false );
  45. }
  46. };