Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIRemoveVehicleFromGroup.c
Go to the documentation of this file.
2{
3 static const string PORT_VEHICLE = "VehicleIn";
4
5 [Attribute("1", UIWidgets.CheckBox, "Remove all vehicles used by any group member?")]
6 bool m_bRemoveAllUsedVehicles;
7
8 //------------------------------------------------------------------------------------------------
9 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
10 {
11 SCR_AIGroup group = SCR_AIGroup.Cast(owner);
12 if (!group)
13 return NodeError(this,owner, "Node must be run on SCR_AIGroup agent!");
14
16
17 IEntity agentEntity, vehicleEntity;
18
19 if (GetVariableIn(PORT_VEHICLE, vehicleEntity))
20 {
21 SCR_AIVehicleUsageComponent vehicleUsageComp = SCR_AIVehicleUsageComponent.FindOnNearestParent(vehicleEntity, vehicleEntity);
22 if (!vehicleUsageComp)
23 return ENodeResult.FAIL;
24
25 vehicleMgr.RemoveVehicle(vehicleUsageComp);
26 return ENodeResult.SUCCESS;
27 };
28
29 if (!m_bRemoveAllUsedVehicles)
30 {
31 return ENodeResult.FAIL;
32 };
33
34 array<ref SCR_AIGroupVehicle> groupVehicles = {};
35 vehicleMgr.GetAllVehicles(groupVehicles);
36
37 foreach (ref SCR_AIGroupVehicle vehicle : groupVehicles)
38 vehicleMgr.RemoveVehicle(vehicle.GetVehicleUsageComponent());
39
40 return ENodeResult.SUCCESS;
41 }
42
43 //------------------------------------------------------------------------------------------------
44 protected static ref TStringArray s_aVarsIn = {
45 PORT_VEHICLE
46 };
48 {
49 return s_aVarsIn;
50 }
51
52 //------------------------------------------------------------------------------------------------
53 protected static override bool VisibleInPalette()
54 {
55 return true;
56 }
57
58 //------------------------------------------------------------------------------------------------
59 protected static override string GetOnHoverDescription()
60 {
61 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";
62 }
63
64};
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition NodeError.c:3
proto bool GetVariableIn(string name, out void val)
SCR_AIGroupUtilityComponent GetGroupUtilityComponent()
ref SCR_AIGroupVehicleManager m_VehicleMgr
This class is used for keeping track of vehicles assigned to group.
void GetAllVehicles(array< ref SCR_AIGroupVehicle > outAllVehicles)
bool RemoveVehicle(notnull SCR_AIVehicleUsageComponent vehicleUsageComp)
static override string GetOnHoverDescription()
static SCR_AIVehicleUsageComponent FindOnNearestParent(notnull IEntity ent, out IEntity componentOwner)
ENodeResult
Definition ENodeResult.c:13
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
Definition Types.c:385