473{
481
483 {
486 {
489 }
490 }
491
493 {
495
496 super.CreateResultDataStructure();
497 }
498
500 {
501 super.ClearCatchingItemData();
502
507 }
508
510 {
511
512 if (item.IsRuined() || item.IsSetForDeletion())
513 return;
514
517 {
518 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
519 {
526 {
527 int key;
528 float value;
529 for (int i = 0; i < count; i++)
530 {
534 {
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"))
546 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
548 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
550 }
551 }
552
555 {
556 float ret = 1.0;
559 {
560
561 }
562
563 return ret;
564 }
565
567 {
569 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
571 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
573 else
575 }
576
578 {
579 super.Init(par);
580
582 }
583
585 {
586 #ifdef DEVELOPER
588 {
589 Print(
"********************");
590 Print(
"dbgTrapz | START");
591 Print(
"********************");
592 }
593 #endif
594
595 super.SetupInitialTypes();
596
597 #ifdef DEVELOPER
599 {
601 }
602 #endif
603 }
604
606 {
609
612 }
613
615 {
618 }
619
621 {
623 }
624
627 {
629 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
630 {
632 if (dta)
633 {
637 }
638 else
639 ErrorEx(
"failed to acquire BaitData from type: " + type);
640 }
641
642 #ifdef DEVELOPER
644 {
647 else
648 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
649 }
650 #endif
651 }
652
654 {
655 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
656 int usedType = -1;
657 float probability = -1;
658 float highestProbability = 0.0;
660 for (int i = 0; i < count; i++)
661 {
664 if (probability > highestProbability)
665 {
666 highestProbability = probability;
667 usedType = baitType;
668 }
669 }
670
672 #ifdef DEVELOPER
674 {
675
676 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
677 }
678 #endif
680
681 #ifdef DEVELOPER
683 {
684 float dbgProb;
687 }
688 #endif
689 }
690
692 {
694
695 return true;
696 }
697
699 {
702 }
703
705 {
707 {
709 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
710 else
712 }
713 }
714}
715
717{
719 {
720 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
721 }
722}
723
725{
727 {
728 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
729 }
730}
731
733{
735 {
736 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
737 }
738}
ref map< int, ref BaitData > m_BaitCompatibilityMap
class BaitData m_MainItem
ref CatchingResultBasic m_Result
float m_QualityDispersionMinMod
void InitCatchingItemData()
void CatchingContextBase(Param par)
float m_QualityDispersionMaxMod
void SetupProbabilityArray()
void InitItemValues(EntityAI item)
override to init context-specific values
float AdjustBaitItemChance(EntityAI item)
Allows for adjustment of all catch probabilities from item qualities (damage, qty....
void SetTrapEnviroMask(int value)
CatchingContextTrapsBase CatchingContextBase InitCatchMethodMask()
int UpdateTrapEnviroMask()
void UpdateDataAndMasks()
void UpdateUsedBait(ECatchingBaitCategories type)
if non-empty bait type is used, some 'Bait' attachment is picked as an active bait (currently no dire...
void ClearCatchingItemData()
void InitCatchEnviroMask()
void CreateResultDataStructure()
void DeserializeData(Param par)
override bool ModifySignalProbability(inout float probability)
void ReduceBaitQty(float qtyNorm)
float m_CumulativeTrappingSuccess
after N attempts, the chance to catch should be this. Only highest one applies. @NOTE: Take care,...
override void UpdateBaseProbability(YieldItemBase yItem)
updates base probability when catching the specific item (some context subclasses only)
static const int MASK_ENVIRO_POND
static const int MASK_ENVIRO_LAND_ALL
static const int MASK_ENVIRO_SEA
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
static ref TFloatArray ARRAY_FLOAT
void InitCatchMethodMask()
Super root of all classes in Enforce script.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
float GetBaitTypeSensitivity(ECatchingBaitCategories type)
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
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.
proto native bool IsCLIParam(string param)
Returns if command line argument is present.