DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PPEMatClassParameterBool.c
См. документацию.
2{
3 protected ref map<int,ref array<bool,int>> m_LayerInfo; //<priority,<value,operator>>
4
6 protected bool m_ValueDefault;
7
8 void PPEMatClassParameterBool(int mat_idx, int parameter_idx, PPEClassBase parent)
9 {
11 }
12
13 override void InitDefaults()
14 {
16 m_ValueDefault = m_Bool.param2;
17 }
18
19 override void InitCuttent()
20 {
21 m_CurrentValues = new Param1<bool>(m_ValueDefault);
22 }
23
24 override int GetParameterVarType()
25 {
26 return PPEConstants.VAR_TYPE_BOOL;
27 }
28
29 override void Update(float timeslice, out Param p_total, out bool setting_defaults, int order)
30 {
31 super.Update(timeslice,p_total,setting_defaults,order);
32
33 int active_request_count = 0;
34
36
37 bool setting_value_zero = false;
38
39 bool bool_value_temp = false;
40 bool bool_value_total = m_ValueDefault;
41
42 if (p_total == null)
43 {
44 p_total = new Param1<bool>(false);
45 }
46
47 if (m_RequestMap.Count() > 0)
48 {
49 m_LayerInfo.Clear();
50 }
51 else
52 {
53 //DbgPrnt("m_RequestMap.Count() is zero! Using default values. | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
55 m_Parent.ParamUpdateRemove(m_ParameterIndex);
56 return;
57 }
58
59 for ( int i = 0; i < m_RequestMap.Count(); i++ )
60 {
61 req_data = PPERequestParamDataBool.Cast(m_RequestMap.GetElement(i));
62
63 if (req_data == null)
64 {
65 Error("PPEMatClassParameterBool | req_data not found! | " + this + " | mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
66 continue;
67 }
68
69 setting_value_zero = req_data.IsSettingDefaultValues();
70
71 if (setting_value_zero && !req_data.GetUpdatingDataValues() && !req_data.IsDataActive())
72 {
73 //DbgPrnt("Is Default, not updating | idx: " + i + " | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
74 continue;
75 }
76
77 if (setting_value_zero)
78 {
79 req_data.m_BoolTarget = false;
80 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | !data.m_DefaultTargetSet | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | req_data.m_BoolTarget: " + req_data.m_BoolTarget);
81 }
82 else
83 {
84 active_request_count++;
85 }
86
87 //evaluation
88 //--------------------------------
89 req_data.m_BoolLast = req_data.m_BoolCurrent;
90
91 if (!req_data.GetUpdatingDataValues() && req_data.IsDataActive()) //set to exact value, not updating anymore
92 {
93 bool_value_temp = req_data.m_BoolCurrent;
94 PrepareLayerInfo(req_data.GetPriorityLayer(),bool_value_temp,req_data.GetInteractionMask());
95 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | !req_data.m_UpdatingData | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | not updating, addaing current value into mix: " + bool_value_temp);
96 continue;
97 }
98
99 bool_value_temp = req_data.m_BoolTarget;
100
101 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX());
102 req_data.SetUpdatingDataValues(false);
103 if (setting_value_zero)
104 {
105 req_data.SetDataActive(false);
106 //RemovePriorityInfo(req_data.GetPriorityLayer()); //redundant?
107 }
108 else
109 {
110 bool_value_temp = req_data.m_BoolTarget;
111 PrepareLayerInfo(req_data.GetPriorityLayer(),bool_value_temp,req_data.GetInteractionMask());
112 }
113
114 req_data.m_BoolCurrent = bool_value_temp;
115 }
116
117 if (active_request_count == 0)
118 {
120 }
121 else
122 {
123 //---------------------------
124 //MASK handling and calculation
125 bool value;
126 int operator;
127 bool override_active = false;
128
129 for ( i = 0; i < m_LayerInfo.Count(); i++ )
130 {
131 if ( override_active )
132 break;
133
134 value = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_VALUE);
135 operator = m_LayerInfo.Get(m_CommandLayersArray.Get(i)).Get(LAYER_INFO_OPERATOR);
136
137 switch (operator)
138 {
139 case PPOperators.LOWEST:
140 bool_value_total = Math.Min(bool_value_total,value);
141 break;
142
143 case PPOperators.HIGHEST:
144 bool_value_total = Math.Max(bool_value_total,value);
145 break;
146
147 case PPOperators.OVERRIDE:
148 bool_value_total = value;
149 break;
150
151 case PPOperators.SET:
152 bool_value_total = value;
153 break;
154
155 default:
156 Error("PPEMatClassParameterBool | Invalid operator " + operator + " in mat/par: " + m_MaterialIndex + "/" + m_ParameterIndex);
157 break;
158 }
159
160 if ( operator == PPOperators.OVERRIDE )
161 {
162 //DbgPrnt("m_LayerInfo | PPOperators.OVERRIDE at: " + i);
163 override_active = true;
164 }
165 }
166
167 m_CommandLayersArray.Clear();
168
169 Param1<bool>.Cast(p_total).param1 = bool_value_total;
170 }
171
172 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | mat/par/req: " + m_MaterialIndex + "/" + m_ParameterIndex + "/" + req_data.GetRequesterIDX() + " | parameter update end, removing from queue");
173 m_Parent.ParamUpdateRemove(m_ParameterIndex);
174
175 m_CurrentValues = p_total;
176 }
177
178 void PrepareLayerInfo(int layer, bool value, int operator)
179 {
180 m_LayerInfo.Set(layer,{value,operator});
181 AddPriorityInfo(layer);
182 }
183
185 override void SetParameterValueDefault(inout Param p_total)
186 {
187 p_total = new Param1<bool>(PPETemplateDefBool.Cast(m_Defaults).param2);
188 m_CurrentValues = p_total;
189 //DbgPrnt("PPEDebug | PPEMatClassParameterBool - UpdateParameterValues | exit 3 - zero value");
190 }
191}
map
Определения ControlsXboxNew.c:4
PPOperators
PP operators, specify operation between subsequent layers.
Определения PPEConstants.c:53
Param2 PPETemplateDefBool
void PPERequestParamDataBool(int requester_idx, int mat_id, int param_id, int data_type=0, int priority=0, int mask=PPOperators.SET, bool relative=false)
Определения PPERequestData.c:111
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения EnMath.c:7
Created once, on manager init. Script-side representation of C++ material class, separate handling.
Определения PPEMatClassesBase.c:3
void AddPriorityInfo(int priority)
Adds 'layers' to be iterated throug.
PPETemplateDefBool m_Bool
Определения PPEMatClassParameterBool.c:5
override int GetParameterVarType()
Определения PPEMatClassParameterBool.c:24
void PPEMatClassParameterBool(int mat_idx, int parameter_idx, PPEClassBase parent)
Определения PPEMatClassParameterBool.c:8
override void InitDefaults()
Определения PPEMatClassParameterBool.c:13
void PPEMatClassParameterCommandData(int mat_idx, int parameter_idx, PPEClassBase parent)
override void Update(float timeslice, out Param p_total, out bool setting_defaults, int order)
Определения PPEMatClassParameterBool.c:29
override void InitCuttent()
Определения PPEMatClassParameterBool.c:19
void PrepareLayerInfo(int layer, bool value, int operator)
Определения PPEMatClassParameterBool.c:178
ref ActiveParameterRequestsMap m_RequestMap
ref map< int, ref array< bool, int > > m_LayerInfo
Определения PPEMatClassParameterBool.c:3
override void SetParameterValueDefault(inout Param p_total)
No active requests for the mat. parameter value change, sets the value to DEFAULT.
Определения PPEMatClassParameterBool.c:185
ref array< int > m_CommandLayersArray
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.