3 protected IEntity m_TruckBed;
4 protected SCR_CampaignMobileAssemblyComponent m_AssemblyComponent;
7 static const float MAX_TERRAIN_HEIGHT = 0.5;
8 static const float TERRAIN_SLOPE_THRESHOLD = 0.9;
11 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
13 m_TruckBed = pOwnerEntity;
18 m_AssemblyComponent = SCR_CampaignMobileAssemblyComponent.Cast(m_TruckBed.FindComponent(SCR_CampaignMobileAssemblyComponent));
30 IEntity truck = m_TruckBed.GetParent();
41 override bool CanBeShownScript(IEntity user)
44 if (
SCR_WorldTools.IsObjectUnderwater(
GetOwner(), vector.Zero, -1, depth) && depth > SCR_CampaignMobileAssemblyComponent.MAX_WATER_DEPTH)
47 if (!m_AssemblyComponent)
55 if (f != m_AssemblyComponent.GetParentFaction())
58 if (GetDamageManagerComponent() && GetDamageManagerComponent().
GetState() ==
EDamageState.DESTROYED)
63 IEntity truck = m_TruckBed.GetParent();
67 Physics physicsComponent = truck.GetPhysics();
68 vector vel = physicsComponent.GetVelocity();
71 if (physicsComponent && vel.LengthSq() > 0.01)
76 return !m_AssemblyComponent.IsDeployed();
80 override bool CanBePerformedScript(IEntity user)
82 if (!m_AssemblyComponent)
95 if (f.GetMobileAssembly())
97 SetCannotPerformReason(
"#AR-Campaign_Action_AnotherAssemblyActive-UC");
101 SCR_CampaignFeedbackComponent feedbackComponent = SCR_CampaignFeedbackComponent.GetInstance();
103 if (!feedbackComponent)
106 if (feedbackComponent.GetBaseWithPlayer())
108 SetCannotPerformReason(
"#AR-Campaign_Action_AnotherHQNearby-UC");
112 bool isInRange = m_AssemblyComponent.IsInRadioRange();
115 SetCannotPerformReason(
"#AR-Campaign_Action_NoSignal-UC");
117 IEntity truck = m_TruckBed.GetParent();
121 vector pos = truck.GetOrigin();
125 SetCannotPerformReason(
"#AR-Campaign_Action_UnevenTerrain-UC");
140 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
142 PlayerController playerController =
GetGame().GetPlayerController();
144 if (!playerController)
147 SCR_CampaignNetworkComponent campaignNetworkComponent = SCR_CampaignNetworkComponent.Cast(playerController.FindComponent(SCR_CampaignNetworkComponent));
149 if (!campaignNetworkComponent)
152 campaignNetworkComponent.DeployMobileAsembly(m_AssemblyComponent,
true);
156 override bool HasLocalEffectOnlyScript()