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

◆ GatherInfoData()

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

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

283{
285 {
286 }
287
288 override void InitInfoData()
289 {
290 m_InfoData = new ActionInfoDataConstructionImpossible();
291 }
292
293 override void CreateConditionComponents()
294 {
295 m_ConditionItem = new CCINone();
297 }
298
299 override bool CanBeStarted()
300 {
301 return false;
302 }
303
304 override bool IsLocal()
305 {
306 return true;
307 }
308
309 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
310 {
311 ConstructionActionData cad = player.GetConstructionActionData();
313 if (part)
314 {
315 string overrideText = part.GetBuildTextOverride();
316 if (overrideText == string.Empty)
317 m_Text = "#build" + " " + part.GetName();
318 else
319 m_Text = overrideText;
320
321 #ifdef DIAG_DEVELOPER
322 if (DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_FULLDEBUG))
323 {
324 m_Text = "dbg " + "#build" + " " + part.GetName() + " | " + part.GetPartName();
325 }
326 #endif
327 }
328
329 }
330
331 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
332 {
333 EntityAI ent;
334 if (!Class.CastTo(ent,target.GetObject()))
335 return false;
336
337 if (player.IsPlacingLocal() || player.IsPlacingServer())
338 return false;
339
340 //Action not allowed if player has broken legs
341 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
342 return false;
343
344 if (!ent.CanUseConstruction() || !ent.CanUseConstructionBuild())
345 return false;
346
347 if ((!GetGame().IsDedicatedServer()))
348 {
349 if (SimplifiedCollisionInfoCheck(player,target,item))
350 {
351 return GatherInfoData(player,target,item);
352 }
353 }
354
355 return false;
356 }
357
358 override bool ActionConditionContinue(ActionData action_data)
359 {
360 return false;
361 }
362
363 override protected bool GatherInfoData(PlayerBase player, ActionTarget target, ItemBase item)
364 {
366
367 EntityAI ent;
368 if (Class.CastTo(ent,target.GetObject()))
369 {
370 ActionInfoDataConstructionImpossible info = ActionInfoDataConstructionImpossible.Cast(m_InfoData);
371 ConstructionBase construction = ConstructionBase.Cast(ent.GetConstructionBasic());
372 ConstructionActionData cad = player.GetConstructionActionData();
374 construction.CanBuildPartEx(part.GetPartName(), item, info.m_InfoContextMask);
375 info.SetConstructionPart(part);
376 info.SetTool(item);
377
378 #ifdef DIAG_DEVELOPER
379 if (DiagMenu.GetBool(DiagMenuIDs.BASEBUILDING_FULLDEBUG) && info.m_InfoContextMask)
380 DbgPrint(construction, info, target.GetComponentIndex()); //print here for 'real' mask data..
381 #endif
382
383 info.m_InfoContextMask |= EConstructionInfoCategories.MATERIALS_PRESENCE; //material info should always be visible
384 info.m_InfoContextMask |= EConstructionInfoCategories.TOOL_PRESENCE; //tools info should always be visible
385
386 return info.CanDisplayInfo();
387 }
388
389 return false;
390 }
391
392 #ifdef DIAG_DEVELOPER
393 void DbgPrint(notnull ConstructionBase construction, ActionInfoDataConstructionBase info, int componentIdx)
394 {
395 int failureMask = info.m_InfoContextMask;
396 ConstructionPart part = info.GetConstructionPart();
397 string partName = part.GetPartName();
398
399 if (failureMask == 0)
400 {
401 ConstructionDebug.RemoveBuildPartInfoData(partName);
402 }
403 else
404 {
405 string conflictingPart;
406 if (failureMask & EConstructionInfoCategories.PART_CONFLICTED)
407 construction.HasConflictPart(partName, conflictingPart);
408
409 string missingSlot;
410 float missingQty;
411 if (failureMask & EConstructionInfoCategories.MATERIALS_PRESENCE)
412 construction.HasMaterialsEx(partName, false, missingSlot, missingQty);
413
414 ItemBase tool = info.GetTool();
415 string badToolType = "hands";
416 if ((failureMask & EConstructionInfoCategories.TOOL_PRESENCE) && tool)
417 badToolType = tool.GetType();
418
419 ActionInfoDebugData data = new ActionInfoDebugData();
420 data.partName = partName;
421 data.componentIdx = componentIdx;
422 data.failureMask = failureMask;
423 data.conflictingPart = conflictingPart;
424 data.missingSlot = missingSlot;
425 data.missingQty = missingQty;
426 data.badToolType = badToolType;
427
428 ConstructionDebug.AddBuildPartInfoData(data);
429 }
430 }
431 #endif
432
434 protected bool SimplifiedCollisionInfoCheck(PlayerBase player, ActionTarget target, ItemBase item)
435 {
436 EntityAI ent = EntityAI.Cast(target.GetObject());
437 ConstructionActionData constructionActionData = player.GetConstructionActionData();
438 constructionActionData.SetTarget(ent);
439 ConstructionPart part = constructionActionData.GetBuildPartInfoAtIndex(m_VariantID);
440 ConstructionBase construction = ConstructionBase.Cast(ent.GetConstructionBasic());
441
442 if (!part)
443 {
444 ErrorEx("no part available!");
445 constructionActionData.GetBuildPartInfoAtIndex(m_VariantID);
446 }
447 else
448 {
449 BaseBuildingBase baseBuilding = BaseBuildingBase.Cast(ent);
450 if (baseBuilding && baseBuilding.MustBeBuiltFromOutside() && baseBuilding.IsPlayerInsideEx(player, part.GetMainPartName()))
451 return false;
452
453 if (!construction.ConstructionDirectionCheck(player, part, EConstructionDirCheckType.INDOORS))
454 return false;
455 if (!construction.ConstructionInsiderBoxCheck(player, part))
456 return false;
457 if (player.GetInputController().CameraIsFreeLook())
458 return false;
459
460 if (baseBuilding)
461 {
462 bool boo;
463 if (baseBuilding.PerformRoofCheckForBase(part.GetPartName(),player,boo) && boo)
464 return false;
465 }
466
467 if (player.IsPlacingLocal() || player.IsPlacingServer())
468 return false;
469
470 CollisionCheckData checkData = new CollisionCheckData();
471 checkData.m_PartName = part.GetPartName();
472
473 return !construction.IsCollidingEx(checkData);
474 }
475
476 return false;
477 }
478}
479
480// just a duplicate to allow displaying in interact category of target widget
481class ActionConstructionPartInfoInteract: ActionConstructionPartInfoContinuous
482{
483 override typename GetInputType()
484 {
485 return ContinuousInteractActionInput;
486 }
487}
489
491{
493
494 void ActionInfoDataBase()
495 {
497 }
498
499 bool CanDisplayInfo()
500 {
501 return true;
502 }
503}
504
506class ActionInfoDataConstructionBase: ActionInfoDataBase
507{
508 protected ItemBase m_Tool;
509 protected ConstructionPart m_Part;
510
512 {
513 m_Part = part;
514 }
515
517 {
518 return m_Part;
519 }
520
521 void SetTool(ItemBase tool)
522 {
523 m_Tool = tool;
524 }
525
527 {
528 return m_Tool;
529 }
530}
531
533class ActionInfoDataConstructionPossible: ActionInfoDataConstructionBase
534{
535}
536
538class ActionInfoDataConstructionImpossible: ActionInfoDataConstructionBase
539{
540 override bool CanDisplayInfo()
541 {
542 bool forceHide = false;
543 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_CONSTRUCTED;
544 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_CONFLICTED;
545 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_MISSING_REQUIREMENT;
546 forceHide |= m_InfoContextMask & EConstructionInfoCategories.PART_MISSING_SUPPORT;
547 bool show = true;
548 //show |= m_InfoContextMask & EConstructionInfoCategories.TOOL_PRESENCE;
549 //show |= m_InfoContextMask & EConstructionInfoCategories.MATERIALS_PRESENCE;
550
551 return super.CanDisplayInfo() && !forceHide && show;
552 }
553}
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.