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

◆ RemoveBait()

void InitCatchMethodMask::RemoveBait ( )
protected

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

473{
478 protected float m_CumulativeTrappingSuccess;
479 protected int m_AttemptsCount;
480 protected ItemBase m_Bait;
481
482 override protected void DeserializeData(Param par)
483 {
485 if (Class.CastTo(p,par))
486 {
487 m_MainItem = p.param1;
488 m_AttemptsCount = p.param2;
489 }
490 }
491
492 override protected void CreateResultDataStructure()
493 {
495
496 super.CreateResultDataStructure();
497 }
498
499 override protected void ClearCatchingItemData()
500 {
501 super.ClearCatchingItemData();
502
504 m_QualityBaseMod = 0.0;
507 }
508
509 override protected void InitItemValues(EntityAI item)
510 {
511 //skip ruined or deleted items entirely
512 if (item.IsRuined() || item.IsSetForDeletion())
513 return;
514
515 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
516 if (GetGame().ConfigIsExisting(path))
517 {
518 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
519 {
524 int count = CachedObjectsArrays.ARRAY_INT.Count();
525 if (count == CachedObjectsArrays.ARRAY_FLOAT.Count())
526 {
527 int key;
528 float value;
529 for (int i = 0; i < count; i++)
530 {
533 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
534 {
535 m_BaitCompatibilityMap.Set(key,new BaitData(value,item));
536 }
537 }
538 }
539 else
540 {
541 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
542 }
543 }
544 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
545 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
546 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
547 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
548 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
549 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
550 }
551 }
552
555 {
556 float ret = 1.0;
557 ItemBase ib;
558 if (Class.CastTo(ib,item))
559 {
560 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
561 }
562
563 return ret;
564 }
565
566 override protected void InitCatchEnviroMask()
567 {
568 vector pos = m_MainItem.GetPosition();
569 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
571 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
573 else
575 }
576
577 override protected void Init(Param par)
578 {
579 super.Init(par);
580
582 }
583
584 override protected void SetupInitialTypes()
585 {
586 #ifdef DEVELOPER
587 if (IsCLIParam("catchingLogs"))
588 {
589 Print("********************"); //just for debug purposes to track the start
590 Print("dbgTrapz | START");
591 Print("********************");
592 }
593 #endif
594
595 super.SetupInitialTypes();
596
597 #ifdef DEVELOPER
598 if (IsCLIParam("catchingLogs"))
599 {
600 Print("***"); //just for debug purposes to track the start
601 }
602 #endif
603 }
604
605 void UpdateDataAndMasks()
606 {
608 InitCatchMethodMask(); //bait check
609 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
612 }
613
615 {
617 return GetCatchEnviroMask();
618 }
619
620 void SetTrapEnviroMask(int value)
621 {
622 m_EnviroMask = value;
623 }
624
626 void UpdateUsedBait(ECatchingBaitCategories type)
627 {
628 m_Bait = null;
629 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
630 {
631 BaitData dta = m_BaitCompatibilityMap.Get(type);
632 if (dta)
633 {
634 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
635 if (potentialBait != m_MainItem)
636 m_Bait = potentialBait;
637 }
638 else
639 ErrorEx("failed to acquire BaitData from type: " + type);
640 }
641
642 #ifdef DEVELOPER
643 if (IsCLIParam("catchingLogs"))
644 {
645 if (m_Bait)
646 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
647 else
648 Print("dbgTrapz | UpdateUsedBait to 'null'!");
649 }
650 #endif
651 }
652
653 override void UpdateBaseProbability(YieldItemBase yItem)
654 {
655 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
656 int usedType = -1;
657 float probability = -1;
658 float highestProbability = 0.0;
659 int count = m_BaitCompatibilityMap.Count();
660 for (int i = 0; i < count; i++)
661 {
662 baitType = m_BaitCompatibilityMap.GetKey(i);
663 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
664 if (probability > highestProbability)
665 {
666 highestProbability = probability;
667 usedType = baitType;
668 }
669 }
670
671 m_CumulativeTrappingSuccess = Math.Clamp(highestProbability,0,1);
672 #ifdef DEVELOPER
673 if (IsCLIParam("catchingLogs"))
674 {
675 //Print("********************");
676 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
677 }
678 #endif
679 UpdateUsedBait(usedType);
680
681 #ifdef DEVELOPER
682 if (IsCLIParam("catchingLogs"))
683 {
684 float dbgProb;
686 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
687 }
688 #endif
689 }
690
691 override bool ModifySignalProbability(inout float probability)
692 {
693 probability = 1 - Math.Pow((1 - m_CumulativeTrappingSuccess),(1/m_AttemptsCount));
694
695 return true;
696 }
697
698 void RemoveBait()
699 {
700 if (m_Bait)
701 m_Bait.DeleteSafe();
702 }
703
704 void ReduceBaitQty(float qtyNorm)
705 {
706 if (m_Bait)
707 {
708 if (m_Bait.HasQuantity() && !m_Bait.IsSplitable())
709 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
710 else
711 m_Bait.DeleteSafe();
712 }
713 }
714}
715
716class CatchingContextTrapFishSmall : CatchingContextTrapsBase
717{
718 override protected void InitCatchMethodMask()
719 {
720 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
721 }
722}
723
725{
726 override protected void InitCatchMethodMask()
727 {
728 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
729 }
730}
731
732class CatchingContextTrapLandSnare : CatchingContextTrapsBase
733{
734 override protected void InitCatchMethodMask()
735 {
736 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
737 }
738}
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.