actiondrink.c 907 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. class ActionDrinkCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousQuantityEdible(UAQuantityConsumed.DRINK,UATimeSpent.DEFAULT);
  6. }
  7. };
  8. class ActionDrink: ActionConsume
  9. {
  10. void ActionDrink()
  11. {
  12. m_CallbackClass = ActionDrinkCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_DRINK;
  14. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_DRINK;
  15. m_Text = "#drink";
  16. }
  17. override void CreateConditionComponents()
  18. {
  19. m_ConditionItem = new CCINotRuinedAndEmpty;
  20. m_ConditionTarget = new CCTSelf;
  21. }
  22. override bool IsDrink()
  23. {
  24. return true;
  25. }
  26. override bool HasTarget()
  27. {
  28. return false;
  29. }
  30. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  31. {
  32. if (!super.ActionCondition(player, target, item))
  33. return false;
  34. return player.CanEatAndDrink() && !item.GetIsFrozen();
  35. }
  36. };