actionwashhandsitem.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class ActionWashHandsItem: ActionSingleUseBase
  2. {
  3. protected const float WASH_HANDS_AMOUNT = 250; //ml
  4. void ActionWashHandsItem()
  5. {
  6. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_CLEANHANDSBOTTLE;
  7. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_CLEANHANDSBOTTLE;
  8. m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
  9. m_Text = "#wash_hands";
  10. }
  11. override void CreateConditionComponents()
  12. {
  13. m_ConditionItem = new CCINotRuinedAndEmpty;
  14. m_ConditionTarget = new CCTNone;
  15. }
  16. override bool HasTarget()
  17. {
  18. return false;
  19. }
  20. override bool HasProneException()
  21. {
  22. return true;
  23. }
  24. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  25. {
  26. //Print(item.GetQuantity());
  27. if ( player.GetItemOnSlot("Gloves") )
  28. return false;
  29. return player.HasBloodyHands() && ( item.GetQuantity() >= item.GetDisinfectQuantity() );
  30. }
  31. override void OnEndServer( ActionData action_data )
  32. {
  33. super.OnEndServer(action_data);
  34. if (action_data.m_State != UA_CANCEL)
  35. {
  36. PluginLifespan module_lifespan = PluginLifespan.Cast( GetPlugin( PluginLifespan ) );
  37. module_lifespan.UpdateBloodyHandsVisibility( action_data.m_Player, false );
  38. action_data.m_Player.ClearBloodyHandsPenaltyChancePerAgent(eAgents.SALMONELLA);
  39. action_data.m_MainItem.AddQuantity( -action_data.m_MainItem.GetDisinfectQuantity(), false );
  40. }
  41. }
  42. };