actionburyashes.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. class ActionBuryAshesCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.BURY_ASHES);
  6. }
  7. }
  8. class ActionBuryAshes: ActionContinuousBase
  9. {
  10. void ActionBuryAshes()
  11. {
  12. m_CallbackClass = ActionBuryAshesCB;
  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 CCTNonRuined(UAMaxDistances.DEFAULT);
  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. //Action not allowed if player has broken legs
  31. if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
  32. {
  33. return false;
  34. }
  35. Fireplace fireplaceTarget = Fireplace.Cast(target.GetObject());
  36. if (fireplaceTarget)
  37. {
  38. if (fireplaceTarget.HasAshes() && !fireplaceTarget.IsBurning() && fireplaceTarget.IsEmpty())
  39. {
  40. int liquidType;
  41. string surfaceType;
  42. GetGame().SurfaceUnderObject(fireplaceTarget, surfaceType, liquidType);
  43. if (GetGame().IsSurfaceDigable(surfaceType))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. override void OnFinishProgressServer(ActionData action_data)
  52. {
  53. //destroy fireplace with ashes
  54. GetGame().ObjectDelete(action_data.m_Target.GetObject());
  55. MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 4);
  56. }
  57. }