1 #define ENABLE_BASE_DESTRUCTION
5 #ifdef ENABLE_BASE_DESTRUCTION
6 SCR_CampaignServiceEntityComponent m_ServiceEntityComp;
7 SCR_DestructionMultiPhaseComponent m_DestructionMultiphaseComp;
12 protected const int SLOT_SEARCH_DISTANCE = 5;
13 protected IEntity m_Owner;
16 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
22 void CompositionInit()
59 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
64 if (!m_ServiceEntityComp)
68 if (!destructionManager)
72 if (!compositionParent)
75 RplComponent rplComp = RplComponent.Cast(compositionParent.FindComponent(RplComponent));
79 RplId destructibleID = rplComp.Id();
80 if (!destructibleID.IsValid())
83 PlayerController playerController =
GetGame().GetPlayerController();
84 if (!playerController)
87 SCR_CampaignNetworkComponent campaignNetworkComponent = SCR_CampaignNetworkComponent.Cast(playerController.FindComponent(SCR_CampaignNetworkComponent));
88 if (!campaignNetworkComponent)
92 campaignNetworkComponent.RepairComposition(destructionManager.FindDynamicallySpawnedDestructibleIndex(destructibleID, m_DestructionMultiphaseComp), m_ServiceEntityComp.GetRepairCost(), destructibleID,
m_Slot, m_CampaignBase);
96 override bool HasLocalEffectOnlyScript()
102 override bool CanBePerformedScript(IEntity user)
104 if (m_ServiceEntityComp.GetRepairCost() > m_CampaignBase.GetSupplies())
106 SetCannotPerformReason(
"#AR-Campaign_Repair_Composition-UC");
113 override bool CanBeShownScript(IEntity user)
115 if (!m_DestructionMultiphaseComp)
118 if (!m_ServiceEntityComp)
128 if (m_DestructionMultiphaseComp && m_DestructionMultiphaseComp.GetDamagePhase() == 0)
136 protected bool GetNearestSlot(IEntity ent)
147 override bool GetActionNameScript(out
string outName)
152 int availableSupplies = m_CampaignBase.GetSupplies();
154 ActionNameParams[0] = m_ServiceEntityComp.GetRepairCost().ToString();
155 ActionNameParams[1] = availableSupplies.ToString();
157 outName = (
"#AR-Campaign_Action_ServiceRepair-UC");