DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ActionConditionContinue()

override bool GetInputType::ActionConditionContinue ( ActionData action_data)

См. определение в файле ActionPartInfo.c строка 277

278{
280 {
281 }
282
283 override void InitInfoData()
284 {
285 m_InfoData = new ActionInfoDataConstructionImpossible();
286 }
287
288 override void CreateConditionComponents()
289 {
290 m_ConditionItem = new CCINone();
292 }
293
294 override bool CanBeStarted()
295 {
296 return false;
297 }
298
299 override bool IsLocal()
300 {
301 return true;
302 }
303
304 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
305 {
306 ConstructionActionData cad = player.GetConstructionActionData();
308 if (part)
309 {
310 string overrideText = part.GetBuildTextOverride();
311 if (overrideText == string.Empty)
312 m_Text = "#build" + " " + part.GetName();
313 else
314 m_Text = overrideText;
315
316 #ifdef DIAG_DEVELOPER
317 if (DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_FULLDEBUG))
318 {
319 m_Text = "dbg " + "#build" + " " + part.GetName() + " | " + part.GetPartName();
320 }
321 #endif
322 }
323
324 }
325
326 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
327 {
328 EntityAI ent;
329 if (!Class.CastTo(ent,target.GetObject()))
330 return false;
331
332 if (player.IsPlacingLocal() || player.IsPlacingServer())
333 return false;
334
335 //Action not allowed if player has broken legs
336 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
337 return false;
338
339 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild())
340 return false;
341
342 if ((!GetGame().IsDedicatedServer()))
343 {
344 if (SimplifiedCollisionInfoCheck(player,target,item))
345 {
346 return GatherInfoData(player,target,item);
347 }
348 }
349
350 return false;
351 }
352
353 override bool ActionConditionContinue(ActionData action_data)
354 {
355 return false;
356 }
357
358 override protected bool GatherInfoData(PlayerBase player, ActionTarget target, ItemBase item)
359 {
361
362 EntityAI ent;
363 if (Class.CastTo(ent,target.GetObject()))
364 {
365 ActionInfoDataConstructionImpossible info = ActionInfoDataConstructionImpossible.Cast(m_InfoData);
366 ConstructionBase construction = ConstructionBase.Cast(ent.GetConstructionBasic());
367 ConstructionActionData cad = player.GetConstructionActionData();
369 construction.CanBuildPartEx(part.GetPartName(), item, info.m_InfoContextMask);
370 info.SetConstructionPart(part);
371 info.SetTool(item);
372
373 #ifdef DIAG_DEVELOPER
374 if (DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_FULLDEBUG) && info.m_InfoContextMask)
375 DbgPrint(construction, info, target.GetComponentIndex()); //print here for 'real' mask data..
376 #endif
377
378 info.m_InfoContextMask |= EConstructionInfoCategories.MATERIALS_PRESENCE; //material info should always be visible
379 info.m_InfoContextMask |= EConstructionInfoCategories.TOOL_PRESENCE; //tools info should always be visible
380
381 return info.CanDisplayInfo();
382 }
383
384 return false;
385 }
386
387 #ifdef DIAG_DEVELOPER
388 void DbgPrint(notnull ConstructionBase construction, ActionInfoDataConstructionBase info, int componentIdx)
389 {
390 int failureMask = info.m_InfoContextMask;
391 ConstructionPart part = info.GetConstructionPart();
392 string partName = part.GetPartName();
393
394 if (failureMask == 0)
395 {
396 ConstructionDebug.RemoveBuildPartInfoData(partName);
397 }
398 else
399 {
400 string conflictingPart;
401 if (failureMask & EConstructionInfoCategories.PART_CONFLICTED)
402 construction.HasConflictPart(partName, conflictingPart);
403
404 string missingSlot;
405 float missingQty;
406 if (failureMask & EConstructionInfoCategories.MATERIALS_PRESENCE)
407 construction.HasMaterialsEx(partName, false, missingSlot, missingQty);
408
409 ItemBase tool = info.GetTool();
410 string badToolType = "hands";
411 if ((failureMask & EConstructionInfoCategories.TOOL_PRESENCE) && tool)
412 badToolType = tool.GetType();
413
414 ActionInfoDebugData data = new ActionInfoDebugData();
415 data.partName = partName;
416 data.componentIdx = componentIdx;
417 data.failureMask = failureMask;
418 data.conflictingPart = conflictingPart;
419 data.missingSlot = missingSlot;
420 data.missingQty = missingQty;
421 data.badToolType = badToolType;
422
423 ConstructionDebug.AddBuildPartInfoData(data);
424 }
425 }
426 #endif
427
429 protected bool SimplifiedCollisionInfoCheck(PlayerBase player, ActionTarget target, ItemBase item)
430 {
431 EntityAI ent = EntityAI.Cast(target.GetObject());
432 ConstructionActionData constructionActionData = player.GetConstructionActionData();
433 constructionActionData.SetTarget(ent);
434 ConstructionPart part = constructionActionData.GetBuildPartInfoAtIndex(m_VariantID);
435 ConstructionBase construction = ConstructionBase.Cast(ent.GetConstructionBasic());
436
437 if (!part)
438 {
439 ErrorEx("no part available!");
440 constructionActionData.GetBuildPartInfoAtIndex(m_VariantID);
441 }
442 else
443 {
444 BaseBuildingBase baseBuilding = BaseBuildingBase.Cast(ent);
445 if (baseBuilding && baseBuilding.MustBeBuiltFromOutside() && baseBuilding.IsPlayerInsideEx(player, part.GetMainPartName()))
446 return false;
447
448 if (!construction.ConstructionDirectionCheck(player, part, EConstructionDirCheckType.INDOORS))
449 return false;
450 if (!construction.ConstructionInsiderBoxCheck(player, part))
451 return false;
452 if (player.GetInputController().CameraIsFreeLook())
453 return false;
454
455 if (baseBuilding)
456 {
457 bool boo;
458 if (baseBuilding.PerformRoofCheckForBase(part.GetPartName(),player,boo) && boo)
459 return false;
460 }
461
462 if (player.IsPlacingLocal() || player.IsPlacingServer())
463 return false;
464
465 CollisionCheckData checkData = new CollisionCheckData();
466 checkData.m_PartName = part.GetPartName();
467
468 return !construction.IsCollidingEx(checkData);
469 }
470
471 return false;
472 }
473}
474
475// just a duplicate to allow displaying in interact category of target widget
476class ActionConstructionPartInfoInteract: ActionConstructionPartInfoContinuous
477{
478 override typename GetInputType()
479 {
480 return ContinuousInteractActionInput;
481 }
482}
484
486{
488
489 void ActionInfoDataBase()
490 {
492 }
493
494 bool CanDisplayInfo()
495 {
496 return true;
497 }
498}
499
501class ActionInfoDataConstructionBase: ActionInfoDataBase
502{
503 protected ItemBase m_Tool;
504 protected ConstructionPart m_Part;
505
507 {
508 m_Part = part;
509 }
510
512 {
513 return m_Part;
514 }
515
516 void SetTool(ItemBase tool)
517 {
518 m_Tool = tool;
519 }
520
522 {
523 return m_Tool;
524 }
525}
526
528class ActionInfoDataConstructionPossible: ActionInfoDataConstructionBase
529{
530}
531
533class ActionInfoDataConstructionImpossible: ActionInfoDataConstructionBase
534{
535 override bool CanDisplayInfo()
536 {
537 bool forceHide = false;
538 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_CONSTRUCTED;
539 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_CONFLICTED;
540 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_MISSING_REQUIREMENT;
541 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_MISSING_SUPPORT;
542 bool show = true;
543 //show |= m_InfoContextMask & EConstructionInfoCategories.TOOL_PRESENCE;
544 //show |= m_InfoContextMask & EConstructionInfoCategories.MATERIALS_PRESENCE;
545
546 return super.CanDisplayInfo() && !forceHide && show;
547 }
548}
string m_Text
Определения ActionBase.c:57
ref ActionInfoDataBase m_InfoData
Определения ActionBase.c:70
int m_VariantID
Определения ActionBase.c:67
ref CCIBase m_ConditionItem
Определения ActionBase.c:63
ref CCTBase m_ConditionTarget
Определения ActionBase.c:64
void ClearInfoData()
Определения ActionBuildPart.c:657
void SetConstructionPart(ConstructionPart part)
Определения ActionPartInfo.c:230
ActionInfoDataConstructionPossible ActionInfoDataConstructionBase CanDisplayInfo()
visible only under specific conditions
Определения ActionPartInfo.c:259
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionPartInfo.c:250
ItemBase GetTool()
Определения ActionPartInfo.c:245
class ActionInfoDataBase m_Tool
not intended for direct use
override bool ActionConditionContinue(ActionData action_data)
Определения ActionPartInfo.c:277
override bool IsLocal()
Определения ActionPartInfo.c:223
void SetTool(ItemBase tool)
Определения ActionPartInfo.c:240
override bool CanBeStarted()
Определения ActionPartInfo.c:218
bool GatherInfoData(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionPartInfo.c:282
override void CreateConditionComponents()
Определения ActionPartInfo.c:212
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionPartInfo.c:228
bool SimplifiedCollisionInfoCheck(PlayerBase player, ActionTarget target, ItemBase item)
'ComplexBuildCollideCheckClient' not suitable for this, due to missing context (looks into wrong vari...
Определения ActionPartInfo.c:353
override void InitInfoData()
Определения ActionPartInfo.c:207
ConstructionPart GetConstructionPart()
Определения ActionPartInfo.c:235
void ActionConstructionPartInfoContinuous()
Определения ActionPartInfo.c:203
ConstructionPart m_Part
Определения ActionPartInfo.c:228
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
void ConstructionBase(EntityAI parent)
Определения ConstructionBase.c:58
void CollisionCheckData()
Определения ConstructionBase.c:1923
EConstructionInfoCategories
Определения ConstructionConstants.c:2
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)
Определения ConstructionPart.c:531
eBrokenLegs
Определения EBrokenLegs.c:2
DiagMenuIDs
Определения EDiagMenuIDs.c:2
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
override GetInputType()
Определения ActionContinuousBase.c:179
Определения ActionBase.c:22
bool CanDisplayInfo()
Определения ActionPartInfo.c:218
void ActionInfoDataBase()
Определения ActionPartInfo.c:213
int m_InfoContextMask
Определения ActionPartInfo.c:211
always visible
Определения ActionPartInfo.c:253
override bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
Определения Watchtower.c:138
override bool MustBeBuiltFromOutside()
Определения ShelterSite.c:80
Определения Fence.c:2
Определения CCINone.c:2
Определения CCTCursor.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
ConstructionPart GetBuildPartInfoAtIndex(int idx)
Определения ConstructionActionData.c:373
void SetTarget(Object target)
Определения ConstructionActionData.c:111
string GetPartName()
Определения ConstructionPart.c:198
string GetBuildTextOverride()
Определения ConstructionPart.c:315
string GetName()
Определения ConstructionPart.c:193
string GetMainPartName()
Определения ConstructionPart.c:203
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Определения ConstructionPart.c:4
Определения EnDebug.c:241
Определения PlayerBaseClient.c:2
DayZGame GetGame()
Определения gameplay.c:636
enum ShapeType ErrorEx
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.