actiondestroycombinationlock.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. class ActionDestroyCombinationLockCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousRepeat(6.0);
  6. }
  7. };
  8. //!DEPRECATED
  9. class ActionDestroyCombinationLock: ActionContinuousBase
  10. {
  11. static int CYCLES = 5;
  12. void ActionDestroyCombinationLock()
  13. {
  14. m_CallbackClass = ActionDestroyCombinationLockCB;
  15. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DISASSEMBLE;
  16. m_FullBody = true;
  17. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
  18. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_MEDIUM;
  19. m_Text = "#destroy_combination_lock";
  20. }
  21. override void CreateConditionComponents()
  22. {
  23. m_ConditionTarget = new CCTNonRuined(UAMaxDistances.DEFAULT);
  24. m_ConditionItem = new CCINonRuined;
  25. }
  26. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  27. {
  28. Object target_object = target.GetObject();
  29. string selection = target_object.GetActionComponentName( target.GetComponentIndex() );
  30. Fence fence = Fence.Cast( target_object );
  31. if ( fence && fence.IsLocked() && selection == "wall_interact" )
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. override void OnFinishProgressServer( ActionData action_data )
  38. {
  39. Fence fence = Fence.Cast( action_data.m_Target.GetObject() );
  40. if ( fence )
  41. {
  42. CombinationLock combination_lock = fence.GetCombinationLock();
  43. if ( combination_lock )
  44. {
  45. combination_lock.AddHealth("","",-(combination_lock.GetMaxHealth("","")/CYCLES));
  46. if ( combination_lock.IsDamageDestroyed() )
  47. {
  48. combination_lock.UnlockServer( action_data.m_Player, fence );
  49. GetGame().GetCallQueue( CALL_CATEGORY_GAMEPLAY ).CallLater( combination_lock.DestroyLock, 200, false );
  50. }
  51. }
  52. }
  53. action_data.m_MainItem.DecreaseHealth( UADamageApplied.SAW_LOCK, false );
  54. }
  55. override string GetAdminLogMessage(ActionData action_data)
  56. {
  57. return " destroyed combination lock with " + action_data.m_MainItem.GetDisplayName();
  58. }
  59. };