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

◆ SimplifiedCollisionInfoCheck()

bool GetInputType::SimplifiedCollisionInfoCheck ( PlayerBase player,
ActionTarget target,
ItemBase item )
protected

'ComplexBuildCollideCheckClient' not suitable for this, due to missing context (looks into wrong varinats array); returns 'true' if collision does not block action

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

354{
356 {
357 }
358
359 override void InitInfoData()
360 {
361 m_InfoData = new ActionInfoDataConstructionImpossible();
362 }
363
364 override void CreateConditionComponents()
365 {
366 m_ConditionItem = new CCINone();
368 }
369
370 override bool CanBeStarted()
371 {
372 return false;
373 }
374
375 override bool IsLocal()
376 {
377 return true;
378 }
379
380 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
381 {
382 ConstructionActionData cad = player.GetConstructionActionData();
384 if (part)
385 {
386 string overrideText = part.GetBuildTextOverride();
387 if (overrideText == string.Empty)
388 m_Text = "#build" + " " + part.GetName();
389 else
390 m_Text = overrideText;
391
392 #ifdef DIAG_DEVELOPER
393 if (DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_FULLDEBUG))
394 {
395 m_Text = "dbg " + "#build" + " " + part.GetName() + " | " + part.GetPartName();
396 }
397 #endif
398 }
399
400 }
401
402 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
403 {
404 EntityAI ent;
405 if (!Class.CastTo(ent,target.GetObject()))
406 return false;
407
408 if (player.IsPlacingLocal() || player.IsPlacingServer())
409 return false;
410
411 //Action not allowed if player has broken legs
412 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
413 return false;
414
415 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild())
416 return false;
417
418 if ((!GetGame().IsDedicatedServer()))
419 {
420 if (SimplifiedCollisionInfoCheck(player,target,item))
421 {
422 return GatherInfoData(player,target,item);
423 }
424 }
425
426 return false;
427 }
428
429 override bool ActionConditionContinue(ActionData action_data)
430 {
431 return false;
432 }
433
434 override protected bool GatherInfoData(PlayerBase player, ActionTarget target, ItemBase item)
435 {
437
438 EntityAI ent;
439 if (Class.CastTo(ent,target.GetObject()))
440 {
441 ActionInfoDataConstructionImpossible info = ActionInfoDataConstructionImpossible.Cast(m_InfoData);
442 ConstructionBase construction = ConstructionBase.Cast(ent.GetConstructionBasic());
443 ConstructionActionData cad = player.GetConstructionActionData();
445 construction.CanBuildPartEx(part.GetPartName(), item, info.m_InfoContextMask);
446 info.SetConstructionPart(part);
447 info.SetTool(item);
448
449 #ifdef DIAG_DEVELOPER
450 if (DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_FULLDEBUG) && info.m_InfoContextMask)
451 DbgPrint(construction, info, target.GetComponentIndex()); //print here for 'real' mask data..
452 #endif
453
454 info.m_InfoContextMask |= EConstructionInfoCategories.MATERIALS_PRESENCE; //material info should always be visible
455 info.m_InfoContextMask |= EConstructionInfoCategories.TOOL_PRESENCE; //tools info should always be visible
456
457 return info.CanDisplayInfo();
458 }
459
460 return false;
461 }
462
463 #ifdef DIAG_DEVELOPER
464 void DbgPrint(notnull ConstructionBase construction, ActionInfoDataConstructionBase info, int componentIdx)
465 {
466 int failureMask = info.m_InfoContextMask;
467 ConstructionPart part = info.GetConstructionPart();
468 string partName = part.GetPartName();
469
470 if (failureMask == 0)
471 {
472 ConstructionDebug.RemoveBuildPartInfoData(partName);
473 }
474 else
475 {
476 string conflictingPart;
477 if (failureMask & EConstructionInfoCategories.PART_CONFLICTED)
478 construction.HasConflictPart(partName, conflictingPart);
479
480 string missingSlot;
481 float missingQty;
482 if (failureMask & EConstructionInfoCategories.MATERIALS_PRESENCE)
483 construction.HasMaterialsEx(partName, false, missingSlot, missingQty);
484
485 ItemBase tool = info.GetTool();
486 string badToolType = "hands";
487 if ((failureMask & EConstructionInfoCategories.TOOL_PRESENCE) && tool)
488 badToolType = tool.GetType();
489
490 ActionInfoDebugData data = new ActionInfoDebugData();
491 data.partName = partName;
492 data.componentIdx = componentIdx;
493 data.failureMask = failureMask;
494 data.conflictingPart = conflictingPart;
495 data.missingSlot = missingSlot;
496 data.missingQty = missingQty;
497 data.badToolType = badToolType;
498
499 ConstructionDebug.AddBuildPartInfoData(data);
500 }
501 }
502 #endif
503
505 protected bool SimplifiedCollisionInfoCheck(PlayerBase player, ActionTarget target, ItemBase item)
506 {
507 EntityAI ent = EntityAI.Cast(target.GetObject());
508 ConstructionActionData constructionActionData = player.GetConstructionActionData();
509 constructionActionData.SetTarget(ent);
510 ConstructionPart part = constructionActionData.GetBuildPartInfoAtIndex(m_VariantID);
511 ConstructionBase construction = ConstructionBase.Cast(ent.GetConstructionBasic());
512
513 if (!part)
514 {
515 ErrorEx("no part available!");
516 constructionActionData.GetBuildPartInfoAtIndex(m_VariantID);
517 }
518 else
519 {
520 BaseBuildingBase baseBuilding = BaseBuildingBase.Cast(ent);
521 if (baseBuilding && baseBuilding.MustBeBuiltFromOutside() && baseBuilding.IsPlayerInsideEx(player, part.GetMainPartName()))
522 return false;
523
524 if (!construction.ConstructionDirectionCheck(player, part, EConstructionDirCheckType.INDOORS))
525 return false;
526 if (!construction.ConstructionInsiderBoxCheck(player, part))
527 return false;
528 if (player.GetInputController().CameraIsFreeLook())
529 return false;
530
531 if (baseBuilding)
532 {
533 bool boo;
534 if (baseBuilding.PerformRoofCheckForBase(part.GetPartName(),player,boo) && boo)
535 return false;
536 }
537
538 if (player.IsPlacingLocal() || player.IsPlacingServer())
539 return false;
540
541 CollisionCheckData checkData = new CollisionCheckData();
542 checkData.m_PartName = part.GetPartName();
543
544 return !construction.IsCollidingEx(checkData);
545 }
546
547 return false;
548 }
549}
550
551// just a duplicate to allow displaying in interact category of target widget
552class ActionConstructionPartInfoInteract: ActionConstructionPartInfoContinuous
553{
554 override typename GetInputType()
555 {
556 return ContinuousInteractActionInput;
557 }
558}
560
562{
564
565 void ActionInfoDataBase()
566 {
568 }
569
570 bool CanDisplayInfo()
571 {
572 return true;
573 }
574}
575
577class ActionInfoDataConstructionBase: ActionInfoDataBase
578{
579 protected ItemBase m_Tool;
580 protected ConstructionPart m_Part;
581
583 {
584 m_Part = part;
585 }
586
588 {
589 return m_Part;
590 }
591
592 void SetTool(ItemBase tool)
593 {
594 m_Tool = tool;
595 }
596
598 {
599 return m_Tool;
600 }
601}
602
604class ActionInfoDataConstructionPossible: ActionInfoDataConstructionBase
605{
606}
607
609class ActionInfoDataConstructionImpossible: ActionInfoDataConstructionBase
610{
611 override bool CanDisplayInfo()
612 {
613 bool forceHide = false;
614 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_CONSTRUCTED;
615 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_CONFLICTED;
616 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_MISSING_REQUIREMENT;
617 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_MISSING_SUPPORT;
618 bool show = true;
619 //show |= m_InfoContextMask & EConstructionInfoCategories.TOOL_PRESENCE;
620 //show |= m_InfoContextMask & EConstructionInfoCategories.MATERIALS_PRESENCE;
621
622 return super.CanDisplayInfo() && !forceHide && show;
623 }
624}
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.