actionunfoldentity.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. class ActionUnfoldEntity : ActionSingleUseBase
  2. {
  3. void ActionUnfoldEntity ()
  4. {
  5. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
  6. }
  7. override void CreateConditionComponents ()
  8. {
  9. m_ConditionItem = new CCINonRuined;
  10. m_ConditionTarget = new CCTNone;
  11. }
  12. override bool HasTarget () { return false; }
  13. override bool ActionCondition ( PlayerBase player, ActionTarget target, ItemBase item )
  14. {
  15. if (item)
  16. return true;
  17. return false;
  18. }
  19. override bool ActionConditionContinue ( ActionData action_data ) { return true; }
  20. override void OnExecuteClient ( ActionData action_data )
  21. {
  22. ClearInventoryReservationEx(action_data);
  23. }
  24. override void OnExecuteServer ( ActionData action_data )
  25. {
  26. if ( !GetGame().IsMultiplayer() )
  27. ClearInventoryReservationEx(action_data);
  28. ItemBase old_item = action_data.m_MainItem;
  29. if (old_item.ConfigIsExisting("ChangeIntoOnDetach"))
  30. {
  31. string str = old_item.ChangeIntoOnDetach();
  32. if (str != "")
  33. {
  34. UnfoldEntityLambda lambda = new UnfoldEntityLambda(action_data.m_MainItem, str, action_data.m_Player);
  35. lambda.SetTransferParams(true, true, true, false, 1);
  36. action_data.m_Player.ServerReplaceItemInHandsWithNew(lambda);
  37. }
  38. }
  39. }
  40. };
  41. class UnfoldEntityLambda : TurnItemIntoItemLambda
  42. {
  43. void UnfoldEntityLambda (EntityAI old_item, string new_item_type, PlayerBase player)
  44. {
  45. }
  46. };