actionswapitemtohand.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*class ActionSwapItemToHands: ActionInteractBase
  2. {
  3. string m_ItemName = "";
  4. void ActionSwapItemToHands()
  5. {
  6. m_MessageSuccess = "";
  7. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
  8. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS;
  9. m_HUDCursorIcon = CursorIcons.LootCorpse;
  10. }
  11. override void CreateConditionComponents()
  12. {
  13. m_ConditionItem = new CCINone;
  14. m_ConditionTarget = new CCTDummy();
  15. }
  16. override bool HasProneException()
  17. {
  18. return true;
  19. }
  20. override int GetType()
  21. {
  22. return AT_SWAP_ITEM_TO_HANDS;
  23. }
  24. override string GetText()
  25. {
  26. return "#swap_to_hands";
  27. }
  28. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  29. {
  30. EntityAI entity;
  31. ItemBase ih = player.GetItemInHands();
  32. if ( ih && item && Class.CastTo(entity, target.GetObject()) )
  33. {
  34. bool canAdd = player.GetInventory().CanAddEntityIntoHands(entity);
  35. if ( entity && !player.GetInventory().CanAddEntityIntoInventory(entity) && entity.CanPutIntoHands(player) && !canAdd && entity.GetHierarchyRootPlayer() != player )
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. override void OnExecuteServer( ActionData action_data )
  43. {
  44. EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
  45. action_data.m_Player.LocalSwapEntities(ntarget, action_data.m_Player.GetItemInHands());
  46. }
  47. override void OnExecuteClient( ActionData action_data )
  48. {
  49. EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
  50. action_data.m_Player.LocalSwapEntities(ntarget, action_data.m_Player.GetItemInHands());
  51. }
  52. };*/