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

◆ SetTrapEnviroMask()

void InitCatchMethodMask::SetTrapEnviroMask ( int value)
protected

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

395{
400 protected float m_CumulativeTrappingSuccess;
401 protected int m_AttemptsCount;
402 protected ItemBase m_Bait;
403
404 override protected void DeserializeData(Param par)
405 {
407 if (Class.CastTo(p,par))
408 {
409 m_MainItem = p.param1;
410 m_AttemptsCount = p.param2;
411 }
412 }
413
414 override protected void CreateResultDataStructure()
415 {
417
418 super.CreateResultDataStructure();
419 }
420
421 override protected void ClearCatchingItemData()
422 {
423 super.ClearCatchingItemData();
424
426 m_QualityBaseMod = 0.0;
429 }
430
431 override protected void InitItemValues(EntityAI item)
432 {
433 //skip ruined or deleted items entirely
434 if (item.IsRuined() || item.IsSetForDeletion())
435 return;
436
437 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
438 if (GetGame().ConfigIsExisting(path))
439 {
440 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
441 {
446 int count = CachedObjectsArrays.ARRAY_INT.Count();
447 if (count == CachedObjectsArrays.ARRAY_FLOAT.Count())
448 {
449 int key;
450 float value;
451 for (int i = 0; i < count; i++)
452 {
455 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
456 {
457 m_BaitCompatibilityMap.Set(key,new BaitData(value,item));
458 }
459 }
460 }
461 else
462 {
463 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
464 }
465 }
466 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
467 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
468 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
469 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
470 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
471 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
472 }
473 }
474
477 {
478 float ret = 1.0;
479 ItemBase ib;
480 if (Class.CastTo(ib,item))
481 {
482 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
483 }
484
485 return ret;
486 }
487
488 override protected void InitCatchEnviroMask()
489 {
490 vector pos = m_MainItem.GetPosition();
491 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
493 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
495 else
497 }
498
499 override protected void Init(Param par)
500 {
501 super.Init(par);
502
504 }
505
506 override protected void SetupInitialTypes()
507 {
508 #ifdef DEVELOPER
509 if (IsCLIParam("catchingLogs"))
510 {
511 Print("********************"); //just for debug purposes to track the start
512 Print("dbgTrapz | START");
513 Print("********************");
514 }
515 #endif
516
517 super.SetupInitialTypes();
518
519 #ifdef DEVELOPER
520 if (IsCLIParam("catchingLogs"))
521 {
522 Print("***"); //just for debug purposes to track the start
523 }
524 #endif
525 }
526
527 void UpdateDataAndMasks()
528 {
530 InitCatchMethodMask(); //bait check
531 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
534 }
535
537 {
539 return GetCatchEnviroMask();
540 }
541
542 void SetTrapEnviroMask(int value)
543 {
544 m_EnviroMask = value;
545 }
546
548 void UpdateUsedBait(ECatchingBaitCategories type)
549 {
550 m_Bait = null;
551 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
552 {
553 BaitData dta = m_BaitCompatibilityMap.Get(type);
554 if (dta)
555 {
556 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
557 if (potentialBait != m_MainItem)
558 m_Bait = potentialBait;
559 }
560 else
561 ErrorEx("failed to acquire BaitData from type: " + type);
562 }
563
564 #ifdef DEVELOPER
565 if (IsCLIParam("catchingLogs"))
566 {
567 if (m_Bait)
568 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
569 else
570 Print("dbgTrapz | UpdateUsedBait to 'null'!");
571 }
572 #endif
573 }
574
575 override void UpdateBaseProbability(YieldItemBase yItem)
576 {
577 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
578 int usedType = -1;
579 float probability = -1;
580 float highestProbability = 0.0;
581 int count = m_BaitCompatibilityMap.Count();
582 for (int i = 0; i < count; i++)
583 {
584 baitType = m_BaitCompatibilityMap.GetKey(i);
585 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
586 if (probability > highestProbability)
587 {
588 highestProbability = probability;
589 usedType = baitType;
590 }
591 }
592
593 m_CumulativeTrappingSuccess = Math.Clamp(highestProbability,0,1);
594 #ifdef DEVELOPER
595 if (IsCLIParam("catchingLogs"))
596 {
597 //Print("********************");
598 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
599 }
600 #endif
601 UpdateUsedBait(usedType);
602
603 #ifdef DEVELOPER
604 if (IsCLIParam("catchingLogs"))
605 {
606 float dbgProb;
608 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
609 }
610 #endif
611 }
612
613 override bool ModifySignalProbability(inout float probability)
614 {
615 probability = 1 - Math.Pow((1 - m_CumulativeTrappingSuccess),(1/m_AttemptsCount));
616
617 return true;
618 }
619
620 void RemoveBait()
621 {
622 if (m_Bait)
623 m_Bait.DeleteSafe();
624 }
625
626 void ReduceBaitQty(float qtyNorm)
627 {
628 if (m_Bait)
629 {
630 if (m_Bait.HasQuantity() && !m_Bait.IsSplitable())
631 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
632 else
633 m_Bait.DeleteSafe();
634 }
635 }
636}
637
638class CatchingContextTrapFishSmall : CatchingContextTrapsBase
639{
640 override protected void InitCatchMethodMask()
641 {
642 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
643 }
644}
645
647{
648 override protected void InitCatchMethodMask()
649 {
650 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
651 }
652}
653
654class CatchingContextTrapLandSnare : CatchingContextTrapsBase
655{
656 override protected void InitCatchMethodMask()
657 {
658 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
659 }
660}
ItemBase m_Bait
Определения ActionFishingNew.c:57
int GetCatchEnviroMask()
Определения CatchingContextBase.c:164
float m_QualityBaseMod
Определения CatchingContextBase.c:20
ref map< int, ref BaitData > m_BaitCompatibilityMap
Определения CatchingContextBase.c:23
class BaitData m_MainItem
Определения ActionBase.c:36
ref CatchingResultBasic m_Result
Определения CatchingContextBase.c:27
void GenerateResult()
Определения CatchingContextBase.c:257
int m_MethodMask
Определения CatchingContextBase.c:18
float m_QualityDispersionMinMod
Определения CatchingContextBase.c:21
void InitCatchingItemData()
Определения CatchingContextBase.c:217
void CatchingContextBase(Param par)
Определения CatchingContextBase.c:29
float m_QualityDispersionMaxMod
Определения CatchingContextBase.c:22
int m_EnviroMask
Определения CatchingContextBase.c:19
void SetupProbabilityArray()
Определения CatchingContextBase.c:97
void SetupInitialTypes()
Определения CatchingContextTraps.c:358
void InitItemValues(EntityAI item)
override to init context-specific values
Определения CatchingContextTraps.c:283
void RemoveBait()
Определения CatchingContextTraps.c:472
float AdjustBaitItemChance(EntityAI item)
Allows for adjustment of all catch probabilities from item qualities (damage, qty....
Определения CatchingContextTraps.c:328
void SetTrapEnviroMask(int value)
Определения CatchingContextTraps.c:394
CatchingContextTrapsBase CatchingContextBase InitCatchMethodMask()
Определения CatchingContextTraps.c:247
int UpdateTrapEnviroMask()
Определения CatchingContextTraps.c:388
void UpdateDataAndMasks()
Определения CatchingContextTraps.c:379
void UpdateUsedBait(ECatchingBaitCategories type)
if non-empty bait type is used, some 'Bait' attachment is picked as an active bait (currently no dire...
Определения CatchingContextTraps.c:400
void ClearCatchingItemData()
Определения CatchingContextTraps.c:273
void InitCatchEnviroMask()
Определения CatchingContextTraps.c:340
void CreateResultDataStructure()
Определения CatchingContextTraps.c:266
void DeserializeData(Param par)
Определения CatchingContextTraps.c:256
override bool ModifySignalProbability(inout float probability)
Определения CatchingContextTraps.c:465
void ReduceBaitQty(float qtyNorm)
Определения CatchingContextTraps.c:478
int m_AttemptsCount
Определения CatchingContextTraps.c:253
float m_CumulativeTrappingSuccess
after N attempts, the chance to catch should be this. Only highest one applies. @NOTE: Take care,...
Определения CatchingContextTraps.c:252
override void UpdateBaseProbability(YieldItemBase yItem)
updates base probability when catching the specific item (some context subclasses only)
Определения CatchingContextTraps.c:427
override Widget Init()
Определения DayZGame.c:127
string path
Определения OptionSelectorMultistate.c:142
static const int MASK_ENVIRO_POND
Определения CatchingConstants.c:11
static const int MASK_ENVIRO_LAND_ALL
Определения CatchingConstants.c:16
static const int MASK_ENVIRO_SEA
Определения CatchingConstants.c:12
EntityAI m_Owner
Определения CatchingContextBase.c:4
Определения CatchingContextBase.c:2
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native void ConfigGetIntArray(string path, out TIntArray values)
Get array of integers from config on path.
proto native void ConfigGetFloatArray(string path, out TFloatArray values)
Get array of floats from config on path.
static ref TIntArray ARRAY_INT
Определения UtilityClasses.c:51
static ref TFloatArray ARRAY_FLOAT
Определения UtilityClasses.c:50
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения Building.c:6
Определения InventoryItem.c:731
Определения EnMath.c:7
Определения PPEConstants.c:68
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
float GetBaitTypeSensitivity(ECatchingBaitCategories type)
Определения CatchYieldItemBase.c:53
Определения EnConvert.c:106
proto native CGame GetGame()
ErrorExSeverity
Определения EnDebug.c:62
proto void Print(void var)
Prints content of variable to console/log.
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Pow(float v, float power)
Return power of v ^ power.
const string CFG_VEHICLESPATH
Определения constants.c:220
proto native bool IsCLIParam(string param)
Returns if command line argument is present.

Используется в ItemBase::SetActive().