Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
DecoratorScripted_IsEqual.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
2 class DecoratorScripted_IsEqual : DecoratorScripted
3 {
4  protected override bool TestFunction(AIAgent owner)
5  {
6  if (GetVariableType(true, "value1") == GetVariableType(true, "value2"))
7  {
8  if (GetVariableType(true, "value1") == int)
9  {
10  int value1 = 0;
11  int value2 = 0;
12  GetVariableIn("value1", value1);
13  GetVariableIn("value2", value2);
14 
15  return value1 == value2;
16  }
17  else if (GetVariableType(true, "value1") == float)
18  {
19  float val1 = 0;
20  float val2 = 0;
21  GetVariableIn("value1", val1);
22  GetVariableIn("value2", val2);
23 
24  return float.AlmostEqual(val1, val2);
25  }
26  else if (GetVariableType(true, "value1").IsInherited(Managed))
27  {
28  Managed val1 = null;
29  Managed val2 = null;
30  GetVariableIn("value1", val1);
31  GetVariableIn("value2", val2);
32 
33  return val1 == val2;
34  }
35  else if (GetVariableType(true, "value1") == bool)
36  {
37  bool val1;
38  bool val2;
39  GetVariableIn("value1", val1);
40  GetVariableIn("value2", val2);
41 
42  return val1 == val2;
43  }
44  }
45 
46  return false;
47  }
48 
49  protected override bool VisibleInPalette()
50  {
51  return true;
52  }
53 
54  protected override string GetOnHoverDescription()
55  {
56  return "DecoratorScripted_IsEqual: Compares whether the given variables are equal. Supports int-int, float-float, bool - bool and children of Managed comparison";
57  }
58 
59  protected static ref TStringArray s_aVarsIn = {
60  "value1",
61  "value2"
62  };
63  protected override TStringArray GetVariablesIn()
64  {
65  return s_aVarsIn;
66  }
67 };
IsInherited
bool IsInherited(string factionKey)
Definition: SCR_Faction.c:227
DecoratorScripted_IsEqual
Definition: DecoratorScripted_IsEqual.c:2