3 static const string PORT_MAGAZINE_WELL =
"MagazineWell";
5 ref map<string, string> m_mTypenameToResourceName;
7 [
Attribute(
"", UIWidgets.EditBox,
"Name of magazine well" )]
8 protected string m_sMagazineWellType;
10 [
Attribute(
"4", UIWidgets.Slider,
"Amount of magazines",
"0 10 1" )]
11 protected int m_iMagazineCount;
13 private typename m_oMagazineWell;
15 protected static ref TStringArray s_aVarsIn = {
18 override TStringArray GetVariablesIn()
23 override void OnInit(AIAgent owner)
25 m_mTypenameToResourceName =
new map<string, string>;
26 m_mTypenameToResourceName.Insert(
"MagazineWellAK545",
"{E5912E45754CD421}Prefabs/Weapons/Magazines/Magazine_545x39_AK_30rnd_Tracer.et");
27 m_mTypenameToResourceName.Insert(
"MagazineWellStanag556",
"{A9A385FE1F7BF4BD}Prefabs/Weapons/Magazines/Magazine_556x45_STANAG_30rnd_Tracer.et");
28 m_mTypenameToResourceName.Insert(
"MagazineWellPKM",
"{BEEA49E27174B224}Prefabs/Weapons/Magazines/Box_762x54_PK_100rnd_Tracer.et");
29 m_mTypenameToResourceName.Insert(
"MagazineWellM60",
"{AD8AB93729348C3E}Prefabs/Weapons/Magazines/Box_762x51_M60_100rnd_Tracer.et");
30 m_mTypenameToResourceName.Insert(
"MagazineWellM14",
"{6D18CC33708EE712}Prefabs/Weapons/Magazines/Magazine_762x51_M14_20rnd_Base.et");
31 m_mTypenameToResourceName.Insert(
"MagazineWellSVD",
"{9CCB46C6EE632C1A}Prefabs/Weapons/Magazines/Magazine_762x54_SVD_10rnd_Sniper.et");
32 m_mTypenameToResourceName.Insert(
"MagazineWellVZ58_762",
"{FAFA0D71E75CEBE2}Prefabs/Weapons/Magazines/Vz58/Magazine_762x39_Vz58_30rnd_Tracer.et");
33 m_mTypenameToResourceName.Insert(
"MagazineWellM9Beretta",
"{9C05543A503DB80E}Prefabs/Weapons/Magazines/Magazine_9x19_M9_15rnd_Ball.et");
34 m_mTypenameToResourceName.Insert(
"MagazineWellMakarovPM",
"{8B853CDD11BA916E}Prefabs/Weapons/Magazines/Magazine_9x18_PM_8rnd_Ball.et");
35 m_mTypenameToResourceName.Insert(
"MagazineWellM249",
"{06D722FC2666EB83}Prefabs/Weapons/Magazines/Box_556x45_M249_200rnd_4Ball_1Tracer.et");
36 m_mTypenameToResourceName.Insert(
"MagazineWellRPG7",
"{32E12D322E107F1C}Prefabs/Weapons/Ammo/Ammo_Rocket_PG7VM.et");
39 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
41 if (!GetVariableIn(PORT_MAGAZINE_WELL,m_oMagazineWell))
42 m_oMagazineWell = m_sMagazineWellType.ToType();
44 ResourceName resourceName;
45 if (m_mTypenameToResourceName.Find(m_oMagazineWell.ToString(),resourceName))
47 EntitySpawnParams
params = EntitySpawnParams();
48 params.TransformMode = ETransformMode.WORLD;
49 params.Transform[3] = owner.GetControlledEntity().GetOrigin();
50 Resource res = Resource.Load(resourceName);
52 for (
int i = 0; i < m_iMagazineCount; i++)
54 return ENodeResult.SUCCESS;
56 return ENodeResult.FAIL;
59 protected override bool VisibleInPalette()
64 protected override string GetOnHoverDescription()
66 return "AI task that picks up all magazines of provided MagazineWell type in the vicinity of its inventory.";