148 {
149 if (player && !player.IsPlacingLocal() && !player.IsPlacingServer())
150 {
152 if (Class.CastTo(targetEntity,target.GetObject()) && targetEntity.CanUseConstruction())
153 {
154 if (targetEntity.FindAttachmentBySlotName("Material_FPole_Flag"))
155 return false;
156
159 string partName;
161
162 array<string> compNames = new array<string>();
163 targetEntity.GetActionComponentNameList(target.GetComponentIndex(), compNames);
164 int count = compNames.Count();
165 for (int i = 0; i < count; ++i)
166 {
167 partName = compNames[i];
168 constructionPart = construction.GetConstructionPartToDismantle(partName, item);
169 if (constructionPart)
170 break;
171 }
172
173 if (constructionPart)
174 {
175
176 if (baseBuilding && constructionPart.
IsGate() && baseBuilding.
IsOpened())
177 return false;
178
180 {
183 {
185 if (attachment)
186 {
187 #ifdef DIAG_DEVELOPER
188 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
189 {
190 DbgPrintFailure(constructionPart,
"essential attachment " + attachment.GetType() +
" attached in slot: " +
slotName);
191 }
192 #endif
193 return false;
194 }
195 }
196 }
197
198
199 bool checked = false;
200
201 if (constructionPart.
IsBase())
202 checked = true;
203
204 if (!checked && targetEntity.IsPlayerInsideEx(player, partName))
205 {
206
207 if (camera_check)
208 {
210 {
211 if (targetEntity.IsFacingCamera(partName))
212 {
213 #ifdef DIAG_DEVELOPER
214 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
215 {
216 DbgPrintFailure(constructionPart, "!IsFacingCamera");
217 }
218 #endif
219 return false;
220 }
221 }
222 }
223
224 checked = true;
225 }
226
227
228 if (!construction.ConstructionDirectionCheck(player, constructionPart, EConstructionDirCheckType.INDOORS))
229 {
230 #ifdef DIAG_DEVELOPER
231 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
232 {
233 DbgPrintFailure(constructionPart, "ConstructionDirectionCheck failing, type: EConstructionDirCheckType.INDOORS");
234 }
235 #endif
236 return false;
237 }
238
239
240 if (constructionPart.
IsReversible() && (constructionPart.
IsReversedLocal() != construction.ConstructionDirectionCheck(player, constructionPart, EConstructionDirCheckType.REFERENCE_DIRECTION)))
241 {
242 #ifdef DIAG_DEVELOPER
243 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
244 {
245 DbgPrintFailure(constructionPart, "ConstructionDirectionCheck failing, type: EConstructionDirCheckType.REFERENCE_DIRECTION");
246 }
247 #endif
248 return false;
249 }
250
251 if (!construction.ConstructionInsiderBoxCheck(player, constructionPart))
252 {
253 #ifdef DIAG_DEVELOPER
254 if (DiagMenu.GetBool(
DiagMenuIDs.BASEBUILDING_FULLDEBUG))
255 {
256 DbgPrintFailure(constructionPart, "ConstructionInsiderBoxCheck failing");
257
258 }
259 #endif
260 return false;
261 }
262
263 if (checked)
264 {
265 ConstructionActionData constructionActionData = player.GetConstructionActionData();
267
268 return true;
269 }
270 }
271 }
272 }
273
274 return false;
275 }
PlayerSpawnPreset slotName
void ConstructionBase(EntityAI parent)
void ConstructionPart(string name, string part_name, string main_part_name, int id, bool is_built, bool is_base, bool is_gate, array< string > required_parts)
void SetTargetPart(ConstructionPart target_part)
bool HasEssentialAttachmentSlots()
array< string > GetEssentialAttachmentSlots()