3 static const string PORT_VEHICLE =
"VehicleIn";
5 [
Attribute(
"1", UIWidgets.CheckBox,
"Remove all vehicles used by any group member?")]
6 bool m_bRemoveAllUsedVehicles;
9 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
14 return NodeError(
this,owner,
"Node must be run on SCR_AIGroup agent!");
17 IEntity agentEntity, vehicleEntity;
19 if (GetVariableIn(PORT_VEHICLE, vehicleEntity))
21 group.RemoveUsableVehicle(vehicleEntity);
22 return ENodeResult.SUCCESS;
25 if (!m_bRemoveAllUsedVehicles)
27 return ENodeResult.FAIL;
30 ref array<AIAgent> agents = {};
31 group.GetAgents(agents);
32 CompartmentAccessComponent compartmentAccess;
33 BaseCompartmentSlot compartment;
34 ENodeResult nodeResult = ENodeResult.FAIL;
37 foreach (AIAgent agent : agents)
39 agentEntity = agent.GetControlledEntity();
42 compartmentAccess = CompartmentAccessComponent.Cast(agentEntity.FindComponent(CompartmentAccessComponent));
43 if (!compartmentAccess)
45 compartment = compartmentAccess.GetCompartment();
48 vehicleEntity = compartment.GetOwner();
51 group.RemoveUsableVehicle(vehicleEntity);
52 nodeResult = ENodeResult.SUCCESS;
61 protected static ref TStringArray s_aVarsIn = {
64 override TStringArray GetVariablesIn()
70 protected override bool VisibleInPalette()
76 protected override string GetOnHoverDescription()
78 return "Removes vehicle from the list of usable vehicles of the group. Provide either a vehicle entity or removes all vehicles used by any group member";