3 [
Attribute(defvalue:
"0", uiwidget:
UIWidgets.CheckBox,
desc:
"Test vehicles that are not registered inside the group?")]
6 [
Attribute(defvalue:
"-1", uiwidget:
UIWidgets.EditBox,
desc:
"Limit search for replacement by this distance [m]?")]
13 static const string NODE_NAME =
"SCR_AIOccupyDriversInUsedVehicles";
58 float currentTime_ms =
GetGame().GetWorld().GetWorldTime();
97 CompartmentAccessComponent compAcc = chChar.GetCompartmentAccessComponent();
100 bool inTransition = compAcc.IsGettingIn() || compAcc.IsGettingOut();
110 if (!
char || !
char.IsInVehicle())
112 CompartmentAccessComponent acc =
char.GetCompartmentAccessComponent();
115 IEntity vehicleEntity = acc.GetVehicleIn(
char);
117 m_Utility.AddUsableVehicle(vehicleUsageComp);
130 if (groupVehicle.IsStatic() || (vehicleUsage && !vehicleUsage.
CanBePiloted()))
136 if (!groupVehicle.DriverIsConscious())
142 if (willTryToReoccupy)
160 AIAgent agentToUseAsDriver;
161 int vehicleHandleId = groupVehicle.GetSubgroupHandleId();
162 array<AIAgent> agentsOfHandler = {};
164 m_Utility.m_GroupMovementComponent.GetAgentsInHandler(agentsOfHandler, vehicleHandleId);
167 if (!agentToUseAsDriver)
169 m_Utility.m_GroupMovementComponent.GetAgentsInHandler(agentsOfHandler, AIGroupMovementComponent.DEFAULT_HANDLER_ID);
173 if (!agentToUseAsDriver)
177 if (agentToUseAsDriver)
179 AICommunicationComponent myComms =
m_Utility.m_Owner.GetCommunicationComponent();
180 SCR_AIMessageHandling.SendGetInMessage(agentToUseAsDriver, groupVehicle.GetEntity(),
EAICompartmentType.Pilot, null, myComms,
NODE_NAME);
211 bool canOccupyVehicles = vehiclesToOccupy == 0 ||
m_aInformedAgents.Count() == vehiclesToOccupy;
212 bool canUseVehicles = haveUsableVehicles && canOccupyVehicles;
222 AICommunicationComponent myComms =
m_Utility.m_Owner.GetCommunicationComponent();
266 protected AIAgent
GetAgentThatIsConscious(notnull array<AIAgent> agents, array<AIAgent> restrictedAgents,
bool excludeDrivers =
false,
float excludeDistance = -1,
vector locationOfAccident =
vector.Zero)
268 foreach (AIAgent agent : agents)
276 IEntity agentEntity = agent.GetControlledEntity();
277 if (SCR_AIDamageHandling.IsConscious(agentEntity) && restrictedAgents.Find(agent) == -1)
279 if (excludeDistance > 0)
281 vector agentPos = agent.GetControlledEntity().GetOrigin();
282 if (
vector.Distance(agentPos,locationOfAccident) > excludeDistance)
306 return "OccupyDriversInUsedVehicles: goes over the array of known vehicles and tries to occupy the drivers with alive group members. Is running while seats are not occupied.\nReturns bool if we can occupy (at least one) driver.";
ArmaReforgerScripted GetGame()
void SCR_AgentMustBeAIGroup(Node node, AIAgent owner)
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto void SetVariableOut(string name, void val)
This class is used for keeping track of vehicles assigned to group.
bool HasUnitState(EUnitState state)
static override bool VisibleInPalette()
ref array< ref SCR_AIGroupVehicle > m_aUsedVehicles
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
SCR_AIGroupUtilityComponent m_Utility
void OnAgentLifeStateChanged(AIAgent incapacitatedAgent, SCR_AIInfoComponent infoIncap, IEntity vehicle, ECharacterLifeState lifeState)
override void OnEnter(AIAgent owner)
float m_fUpdateInterval_ms
ENodeResult SendingMessages_State()
static int STATE_TESTING_STATE
static const string NODE_NAME
ref array< ref SCR_AIGroupVehicle > m_aVehiclesToOccupy
override void OnAbort(AIAgent owner, Node nodeCausingAbort)
static override string GetOnHoverDescription()
static const string PORT_CAN_USE_VEHICLE
static int STATE_FINISHED
ENodeResult Testing_State(bool isScheduled)
ref array< AIAgent > m_aAgents
override TStringArray GetVariablesOut()
AIAgent GetAgentThatIsConscious(notnull array< AIAgent > agents, array< AIAgent > restrictedAgents, bool excludeDrivers=false, float excludeDistance=-1, vector locationOfAccident=vector.Zero)
static ref TStringArray s_aVarsOut
ENodeResult Waiting_State()
ENodeResult Finished_State()
int m_iNumberOfUnpilotableVehicles
ref array< AIAgent > m_aInformedAgents
static int STATE_SENDING_SIGNALS
float m_fMaxDistanceOfSearch_m
static override bool CanReturnRunning()
bool CanBePiloted()
AI can use the pilot compartments on this vehicle.
static SCR_AIVehicleUsageComponent FindOnNearestParent(notnull IEntity ent, out IEntity componentOwner)
SCR_FieldOfViewSettings Attribute
array< string > TStringArray