actionpourliquid.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. class ActionPourLiquidCB : ActionContinuousBaseCB
  2. {
  3. private const float TIME_TO_REPEAT = 0.25;
  4. override void CreateActionComponent()
  5. {
  6. m_ActionData.m_ActionComponent = new CAContinuousQuantityLiquidTransfer(UAQuantityConsumed.DRAIN_LIQUID, TIME_TO_REPEAT, false);
  7. }
  8. };
  9. class ActionPourLiquid: ActionContinuousBase
  10. {
  11. void ActionPourLiquid()
  12. {
  13. m_CallbackClass = ActionPourLiquidCB;
  14. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_EMPTY_VESSEL;
  15. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_EMPTY_VESSEL;
  16. m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
  17. m_Text = "#pour_liquid";
  18. }
  19. override void CreateConditionComponents()
  20. {
  21. m_ConditionItem = new CCINonRuined;
  22. m_ConditionTarget = new CCTNonRuined(UAMaxDistances.DEFAULT);
  23. }
  24. override bool HasProneException()
  25. {
  26. return true;
  27. }
  28. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  29. {
  30. ItemBase target_item = ItemBase.Cast(target.GetObject());
  31. if ( target_item && item )
  32. {
  33. return Liquid.CanTransfer(item,target_item);;
  34. }
  35. return false;
  36. }
  37. override void OnStartAnimationLoop( ActionData action_data )
  38. {
  39. if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
  40. {
  41. Bottle_Base vessel_in_hands = Bottle_Base.Cast( action_data.m_Target.GetObject() );
  42. Param1<bool> play = new Param1<bool>( true );
  43. GetGame().RPCSingleParam( vessel_in_hands, SoundTypeBottle.POURING, play, true );
  44. }
  45. }
  46. override void OnEndAnimationLoop( ActionData action_data )
  47. {
  48. if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
  49. {
  50. Bottle_Base target_vessel = Bottle_Base.Cast( action_data.m_Target.GetObject());
  51. Param1<bool> play = new Param1<bool>( false );
  52. GetGame().RPCSingleParam( target_vessel, SoundTypeBottle.POURING, play, true );
  53. }
  54. }
  55. override void OnEnd( ActionData action_data )
  56. {
  57. if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
  58. {
  59. Bottle_Base target_vessel = Bottle_Base.Cast( action_data.m_Target.GetObject());
  60. Param1<bool> play = new Param1<bool>( false );
  61. GetGame().RPCSingleParam( target_vessel, SoundTypeBottle.POURING, play, true );
  62. }
  63. }
  64. };