actionattachwheels.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //!DEPRECATED
  2. class ActionAttachWheels: ActionAttach
  3. {
  4. int m_wheel_hub;
  5. void ActionAttachWheels()
  6. {
  7. m_wheel_hub = -1;
  8. m_Text = "#attach";
  9. }
  10. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  11. {
  12. Object targetObject = target.GetObject();
  13. string test = player.GetDisplayName();
  14. string test2 = item.GetType();
  15. string test3 = targetObject.GetDisplayName();
  16. if ( player && targetObject && item )
  17. {
  18. int componentIndex = target.GetComponentIndex();
  19. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_1_1") )
  20. {
  21. Print( "Predni leve" );
  22. m_wheel_hub = 0;
  23. return true;
  24. }
  25. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_1_2") )
  26. {
  27. Print( "zadni leve" );
  28. m_wheel_hub = 1;
  29. return true;
  30. }
  31. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_1_3") )
  32. {
  33. Print( "prostredni leve" );
  34. m_wheel_hub = 2;
  35. return true;
  36. }
  37. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_1_4") )
  38. {
  39. Print( "druhe predni leve" );
  40. m_wheel_hub = 3;
  41. return true;
  42. }
  43. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_2_1") )
  44. {
  45. Print( "Predni prave" );
  46. m_wheel_hub = 4;
  47. return true;
  48. }
  49. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_2_2") )
  50. {
  51. Print( "zadni prave" );
  52. m_wheel_hub = 5;
  53. return true;
  54. }
  55. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_2_3") )
  56. {
  57. Print( "prostredni prave" );
  58. m_wheel_hub = 6;
  59. return true;
  60. }
  61. if( targetObject.IsActionComponentPartOfSelection(componentIndex, "wheel_2_4") )
  62. {
  63. Print( "druhe predni prave" );
  64. m_wheel_hub = 7;
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. override void OnExecuteServer( ActionData action_data )
  71. {
  72. EntityAI target_entity;
  73. Class.CastTo(target_entity, action_data.m_Target.GetObject() ); // cast to ItemBase
  74. int slot_index = action_data.m_MainItem.GetInventory().GetSlotId(0);
  75. int test = m_wheel_hub;
  76. if (!target_entity.LocalTakeEntityAsAttachmentEx( action_data.m_MainItem, slot_index ))
  77. target_entity.LocalTakeEntityAsAttachment( action_data.m_MainItem );
  78. }
  79. override void OnExecuteClient( ActionData action_data )
  80. {
  81. EntityAI target_entity;
  82. Class.CastTo(target_entity, action_data.m_Target.GetObject() ); // cast to ItemBase
  83. int slot_index = action_data.m_MainItem.GetInventory().GetSlotId(0);
  84. int test = m_wheel_hub;
  85. if (!target_entity.LocalTakeEntityAsAttachmentEx( action_data.m_MainItem, slot_index ))
  86. target_entity.LocalTakeEntityAsAttachment( action_data.m_MainItem );
  87. }
  88. };