actioncraftboneknifeenv.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. class ActionCraftBoneKnifeEnvCB : ActionContinuousBaseCB
  2. {
  3. private const float TIME_TO_CRAFT_KNIFE = 5;
  4. override void CreateActionComponent()
  5. {
  6. m_ActionData.m_ActionComponent = new CAContinuousTime(TIME_TO_CRAFT_KNIFE);
  7. }
  8. };
  9. class ActionCraftBoneKnifeEnv: ActionContinuousBase
  10. {
  11. void ActionCraftBoneKnifeEnv()
  12. {
  13. m_CallbackClass = ActionCraftBoneKnifeEnvCB;
  14. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
  15. m_FullBody = true;
  16. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
  17. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_HIGH;
  18. m_Text = "#STR_CraftBoneKnife0";
  19. }
  20. override void CreateConditionComponents()
  21. {
  22. m_ConditionTarget = new CCTCursor(UAMaxDistances.DEFAULT);
  23. m_ConditionItem = new CCINonRuined;
  24. }
  25. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  26. {
  27. //Action not allowed if player has broken legs
  28. if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
  29. return false;
  30. Object targetObject = target.GetObject();
  31. if ( targetObject.IsRock() )
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. override void OnFinishProgressServer( ActionData action_data )
  38. {
  39. EntityAI item_ingredient = action_data.m_MainItem;
  40. EntityAI knife;
  41. knife = action_data.m_Player.SpawnEntityOnGroundPos("BoneKnife", action_data.m_Player.GetPosition());
  42. action_data.m_MainItem.AddQuantity(-1);
  43. MiscGameplayFunctions.TransferItemProperties(item_ingredient, knife);
  44. }
  45. override string GetSoundCategory(ActionData action_data)
  46. {
  47. return "BoneKnife_stone";
  48. }
  49. };