7 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
10 if (!controlledEntity)
11 return ENodeResult.FAIL;
16 BaseWeaponManagerComponent wpnManagerComponent;
17 CharacterControllerComponent controller;
19 CompartmentAccessComponent compAccess = CompartmentAccessComponent.Cast(controlledEntity.FindComponent(CompartmentAccessComponent));
21 return ENodeResult.FAIL;
23 BaseCompartmentSlot compartment = compAccess.GetCompartment();
26 wpnManagerComponent = BaseWeaponManagerComponent.Cast(compartment.GetOwner().FindComponent(BaseWeaponManagerComponent));
27 if (wpnManagerComponent)
30 return ENodeResult.SUCCESS;
35 controller = CharacterControllerComponent.Cast(controlledEntity.FindComponent(CharacterControllerComponent));
37 wpnManagerComponent = controller.GetWeaponManagerComponent();
40 if (!wpnManagerComponent || !controller)
41 return ENodeResult.FAIL;
45 return ENodeResult.FAIL;
48 if (wpnComponent.GetCurrentFireModeType() == m_FiremodeType)
49 return ENodeResult.SUCCESS;
55 return ENodeResult.FAIL;
60 array<BaseFireMode> fireModes = {};
61 muzzle.GetFireModesList(fireModes);
63 int fireModesCount = fireModes.Count();
64 int semiAutoId = -1, autoId = -1, burstId = -1, manualId = -1, safetyId = -1;
65 for (
int i = 0; i<fireModesCount; i++)
67 switch (fireModes[i].GetFiremodeType())
103 switch (m_FiremodeType)
110 else if (burstId != -1)
112 else if (semiAutoId != -1)
114 else if (manualId != -1)
125 else if (autoId != -1)
127 else if (semiAutoId != -1)
129 else if (manualId != -1)
138 if (semiAutoId != -1)
140 else if (manualId != -1)
142 else if (burstId != -1)
144 else if (autoId != -1)
168 IEntity weaponEntity;
170 weaponEntity = weaponSlotComp.GetWeaponEntity();
172 weaponEntity = wpnComponent.GetOwner();
176 prefabName = weaponEntity.GetPrefabData().GetPrefabName();
178 string str =
string.Format(
"SCR_AISelectFireMode: proper fire mode was not found: %1. Weapon prefab: %2",
182 Print(str, LogLevel.WARNING);
184 return ENodeResult.FAIL;
187 controller.SetFireMode(bestFm);
188 return ENodeResult.SUCCESS;
191 override protected string GetNodeMiddleText()
193 return "Selects a firemode closest to provided one.";
196 override bool VisibleInPalette() {
return true;}