actionrepairshelter.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //used for shelters (non-proxy tent objects)
  2. class ActionRepairShelter: ActionRepairTent
  3. {
  4. void ActionRepairShelter()
  5. {
  6. m_CallbackClass = ActionRepairTentCB;
  7. m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
  8. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
  9. m_FullBody = true;
  10. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
  11. }
  12. override void CreateConditionComponents()
  13. {
  14. m_ConditionItem = new CCINonRuined;
  15. m_ConditionTarget = new CCTCursor(UAMaxDistances.SMALL);
  16. }
  17. override bool IsUsingProxies()
  18. {
  19. return false;
  20. }
  21. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  22. {
  23. ShelterBase shelter = ShelterBase.Cast( target.GetObject() );
  24. if ( !shelter )
  25. return false;
  26. if ( player && shelter )
  27. {
  28. PluginRepairing module_repairing;
  29. Class.CastTo(module_repairing, GetPlugin(PluginRepairing));
  30. if (module_repairing.CanRepair(item,shelter))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. override void OnFinishProgressServer( ActionData action_data )
  38. {
  39. ShelterBase shelter = ShelterBase.Cast( action_data.m_Target.GetObject() );
  40. if ( shelter )
  41. {
  42. PluginRepairing module_repairing;
  43. Class.CastTo(module_repairing, GetPlugin(PluginRepairing));
  44. module_repairing.Repair(action_data.m_Player,action_data.m_MainItem,shelter,m_SpecialtyWeight);
  45. }
  46. }
  47. };