Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
DecoratorScripted_IsEqual.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 static const string PORT_VALUE1 = "value1";
5 static const string PORT_VALUE2 = "value2";
6
7
8 protected override bool TestFunction(AIAgent owner)
9 {
10 if (GetVariableType(true, PORT_VALUE1) == GetVariableType(true, PORT_VALUE2))
11 {
12 if (GetVariableType(true, PORT_VALUE1) == int)
13 {
14 int value1 = 0;
15 int value2 = 0;
16 GetVariableIn(PORT_VALUE1, value1);
17 GetVariableIn(PORT_VALUE2, value2);
18
19 return value1 == value2;
20 }
21 else if (GetVariableType(true, PORT_VALUE1) == float)
22 {
23 float val1 = 0;
24 float val2 = 0;
25 GetVariableIn(PORT_VALUE1, val1);
26 GetVariableIn(PORT_VALUE2, val2);
27
28 return float.AlmostEqual(val1, val2);
29 }
30 else if (GetVariableType(true, PORT_VALUE1) == bool)
31 {
32 bool val1;
33 bool val2;
34 GetVariableIn(PORT_VALUE1, val1);
35 GetVariableIn(PORT_VALUE2, val2);
36
37 return val1 == val2;
38 }
39 else if (GetVariableType(true, PORT_VALUE1).IsInherited(IEntity))
40 {
41 IEntity val1 = null;
42 IEntity val2 = null;
43 GetVariableIn(PORT_VALUE1, val1);
44 GetVariableIn(PORT_VALUE2, val2);
45
46 return val1 == val2;
47 }
48 else if (GetVariableType(true, PORT_VALUE1).IsInherited(Managed))
49 {
50 Managed val1 = null;
51 Managed val2 = null;
52 GetVariableIn(PORT_VALUE1, val1);
53 GetVariableIn(PORT_VALUE2, val2);
54
55 return val1 == val2;
56 }
57 }
58
59 return false;
60 }
61
62 protected static override bool VisibleInPalette()
63 {
64 return true;
65 }
66
67 protected static override string GetOnHoverDescription()
68 {
69 return "DecoratorScripted_IsEqual: Compares whether the given variables are equal. Supports int-int, float-float, bool - bool, IEntity - IEntity and children of Managed comparison";
70 }
71
72 protected static ref TStringArray s_aVarsIn = {
73 PORT_VALUE1,
74 PORT_VALUE2
75 };
76 protected override TStringArray GetVariablesIn()
77 {
78 return s_aVarsIn;
79 }
80};
proto native external bool IsInherited(typename type)
static override bool VisibleInPalette()
override TStringArray GetVariablesIn()
static ref TStringArray s_aVarsIn
static override string GetOnHoverDescription()
override bool TestFunction(AIAgent owner)
proto bool GetVariableIn(string name, out void val)
proto external GetVariableType(bool inputPort, string name)
array< string > TStringArray
Definition Types.c:385