3 static const string PORT_COMPARTMENT =
"CompartmentOut";
4 static const string PORT_VEHICLE =
"VehicleOut";
5 static const string ERROR_LOG =
"Node is not run on SCR_AIGroup agent or owner is not member of SCR_AIGroup!";
8 protected int m_indexOfLastCompartment = -1;
9 protected bool m_searchStarted =
false;
11 [
Attribute(
"-1",uiwidget: UIWidgets.ComboBox,
"Restrict to specific compartment?",
"", ParamEnumArray.FromEnum(
EAICompartmentType))]
15 override bool VisibleInPalette() {
return true;}
18 override void OnInit(AIAgent owner)
23 m_groupOwner =
SCR_AIGroup.Cast(owner.GetParentGroup());
30 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
34 ref array<BaseCompartmentSlot> compartments = {};
35 m_groupOwner.GetAllocatedCompartments(compartments);
36 BaseCompartmentSlot compartmentOut;
41 m_indexOfLastCompartment = compartments.Count() - 1;
42 m_searchStarted =
true;
47 if (compartments[
index] && IsCompartmentOfSameType(compartments[
index].Type(), m_eCompartmentType))
49 compartmentOut = compartments[
index];
50 vehicleOut = compartments[
index].GetVehicle();
51 m_indexOfLastCompartment =
index - 1 ;
58 SetVariableOut(PORT_COMPARTMENT, compartmentOut);
59 SetVariableOut(PORT_VEHICLE, vehicleOut);
60 return ENodeResult.SUCCESS;
62 return ENodeResult.FAIL;
65 override void OnAbort(AIAgent owner, Node nodeCausingAbort)
67 m_searchStarted =
false;
71 bool IsCompartmentOfSameType(
typename compartmentType,
EAICompartmentType AICompartmentType)
73 switch (AICompartmentType)
96 protected static ref TStringArray s_aVarsOut = {
100 override TStringArray GetVariablesOut()
106 override string GetOnHoverDescription() {
return "Gets allocated compartments of group to distribute (and eventually occupy) along group members. \nOne can restrict which compartment types to allocate None means any"; };