actionforcefeed.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. class ActionForceFeedCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousQuantityEdible(UAQuantityConsumed.EAT_NORMAL, UATimeSpent.DEFAULT);
  6. }
  7. }
  8. class ActionForceFeed: ActionForceConsume
  9. {
  10. void ActionForceFeed()
  11. {
  12. m_CallbackClass = ActionForceFeedCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FORCEFEED;
  14. m_FullBody = true;
  15. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
  16. m_Text = "#feed";
  17. }
  18. override void CreateConditionComponents()
  19. {
  20. m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT);
  21. m_ConditionItem = new CCINonRuined();
  22. }
  23. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  24. {
  25. if (!super.ActionCondition(player, target, item))
  26. return false;
  27. PlayerBase targetPlayer = PlayerBase.Cast(target.GetObject());
  28. if (!targetPlayer)
  29. return false;
  30. return targetPlayer.CanEatAndDrink();
  31. }
  32. override void OnEndServer(ActionData action_data)
  33. {
  34. super.OnEndServer(action_data);
  35. if (action_data.m_Player.HasBloodyHands() && !action_data.m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES))
  36. {
  37. Object targetPlayer = action_data.m_Target.GetObject();
  38. PlayerBase target = PlayerBase.Cast(targetPlayer);
  39. if (target)
  40. {
  41. target.SetBloodyHandsPenalty();
  42. }
  43. }
  44. }
  45. };
  46. //-----------------SMALL BITES VARIANT-------------------
  47. class ActionForceFeedSmallCB : ActionContinuousBaseCB
  48. {
  49. override void CreateActionComponent()
  50. {
  51. m_ActionData.m_ActionComponent = new CAContinuousQuantityEdible(UAQuantityConsumed.EAT_NORMAL,UATimeSpent.DEFAULT);
  52. }
  53. };
  54. class ActionForceFeedSmall: ActionForceConsume
  55. {
  56. void ActionForceFeed()
  57. {
  58. m_CallbackClass = ActionForceFeedSmallCB;
  59. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FORCEFEED;
  60. m_FullBody = true;
  61. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
  62. }
  63. override void CreateConditionComponents()
  64. {
  65. m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT);
  66. m_ConditionItem = new CCINonRuined();
  67. }
  68. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  69. {
  70. if (!super.ActionCondition(player, target, item))
  71. return false;
  72. PlayerBase targetPlayer = PlayerBase.Cast(target.GetObject());
  73. return targetPlayer && targetPlayer.CanEatAndDrink();
  74. }
  75. override string GetText()
  76. {
  77. return "#feed";
  78. }
  79. }