actionburybody.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. class ActionBuryBodyCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.BURY_BODY);
  6. }
  7. };
  8. class ActionBuryBody: ActionContinuousBase
  9. {
  10. void ActionBuryBody()
  11. {
  12. m_CallbackClass = ActionBuryBodyCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGMANIPULATE;
  14. m_FullBody = true;
  15. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
  16. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_LOW;
  17. m_Text = "#bury";
  18. }
  19. override void CreateConditionComponents()
  20. {
  21. m_ConditionTarget = new CCTDummy();
  22. m_ConditionItem = new CCINonRuined();
  23. }
  24. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  25. {
  26. if (player.IsPlacingLocal())
  27. {
  28. return false;
  29. }
  30. EntityAI bodyEAI;
  31. Class.CastTo(bodyEAI, target.GetObject());
  32. if (bodyEAI && (bodyEAI.IsCorpse() || (!bodyEAI.IsAlive() && (bodyEAI.IsInherited(DayZCreature) || bodyEAI.IsInherited(Man)))) && !bodyEAI.GetParent())
  33. {
  34. int liquidType;
  35. string surfaceType;
  36. GetGame().SurfaceUnderObject(bodyEAI, surfaceType, liquidType);
  37. if (GetGame().IsSurfaceDigable(surfaceType))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. override bool Can(PlayerBase player, ActionTarget target, ItemBase item, int condition_mask)
  45. {
  46. if (!super.Can(player, target, item, condition_mask))
  47. return false;
  48. return player.CheckFreeSpace(vector.Forward, 1.0, false);
  49. }
  50. override void OnFinishProgressServer(ActionData action_data)
  51. {
  52. Object targetObject = action_data.m_Target.GetObject();
  53. g_Game.ObjectDelete(targetObject);
  54. MiscGameplayFunctions.DealEvinronmentAdjustedDmg(action_data.m_MainItem, action_data.m_Player, 4);
  55. }
  56. };