actionwashhandswell.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. class ActionWashHandsWellCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousRepeat(UATimeSpent.WASH_HANDS);
  6. }
  7. }
  8. class ActionWashHandsWell: ActionContinuousBase
  9. {
  10. void ActionWashHandsWell()
  11. {
  12. m_CallbackClass = ActionWashHandsWellCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_WASHHANDSWELL;
  14. m_FullBody = true;
  15. m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
  16. m_Text = "#wash_hands";
  17. }
  18. override typename GetInputType()
  19. {
  20. return ContinuousInteractActionInput;
  21. }
  22. override void CreateConditionComponents()
  23. {
  24. m_ConditionItem = new CCINone();
  25. m_ConditionTarget = new CCTObject(UAMaxDistances.DEFAULT);
  26. }
  27. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  28. {
  29. return player.HasBloodyHands() && !player.GetItemInHands() && target.GetObject() && (target.GetObject().GetWaterSourceObjectType() != EWaterSourceObjectType.NONE || target.GetObject().IsWell()) && !player.GetItemOnSlot("Gloves");
  30. }
  31. override void OnFinishProgressServer(ActionData action_data)
  32. {
  33. PluginLifespan moduleLifespan = PluginLifespan.Cast(GetPlugin(PluginLifespan));
  34. moduleLifespan.UpdateBloodyHandsVisibility(action_data.m_Player, false);
  35. action_data.m_Player.ClearBloodyHandsPenaltyChancePerAgent(eAgents.SALMONELLA);
  36. }
  37. override bool IsLockTargetOnUse()
  38. {
  39. return false;
  40. }
  41. }