actiondismantlegardenplot.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. class ActionDismantleGardenPlotCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousTime( UATimeSpent.DIG_GARDEN );
  6. }
  7. };
  8. class ActionDismantleGardenPlot: ActionContinuousBase
  9. {
  10. //GardenPlot m_GardenPlot;
  11. override void CreateConditionComponents()
  12. {
  13. m_ConditionItem = new CCINonRuined;//new CCINone;
  14. m_ConditionTarget = new CCTCursorNoRuinCheck;
  15. }
  16. void ActionDismantleGardenPlot()
  17. {
  18. m_CallbackClass = ActionDismantleGardenPlotCB;
  19. m_FullBody = true;
  20. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
  21. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_LOW;
  22. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIGMANIPULATE;
  23. m_Text = "#remove_garden_plot";
  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. if (!CfgGameplayHandler.GetDisableColdAreaPlacementCheck() && player.GetInColdArea())
  31. return false;
  32. GardenPlot targetPlot = GardenPlot.Cast( target.GetObject() );
  33. if ( targetPlot && !player.IsPlacingLocal() )
  34. return true;
  35. else
  36. return false;
  37. }
  38. void SetupAnimation( ItemBase item )
  39. {
  40. if ( item )
  41. {
  42. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
  43. }
  44. }
  45. override void OnFinishProgressServer( ActionData action_data )
  46. {
  47. GardenPlot targetPlot = GardenPlot.Cast( action_data.m_Target.GetObject() );
  48. targetPlot.Delete();
  49. if ( GetGame().IsServer() )
  50. MiscGameplayFunctions.DealAbsoluteDmg( action_data.m_MainItem, 10 );
  51. }
  52. };