466{
474
476 {
479 {
482 }
483 }
484
486 {
488
489 super.CreateResultDataStructure();
490 }
491
493 {
494 super.ClearCatchingItemData();
495
500 }
501
503 {
504
505 if (item.IsRuined() || item.IsSetForDeletion())
506 return;
507
510 {
511 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
512 {
519 {
520 int key;
521 float value;
522 for (int i = 0; i < count; i++)
523 {
527 {
529 }
530 }
531 }
532 else
533 {
534 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
535 }
536 }
537 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
539 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
541 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
543 }
544 }
545
548 {
549 float ret = 1.0;
552 {
553
554 }
555
556 return ret;
557 }
558
560 {
562 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
564 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
566 else
568 }
569
571 {
572 super.Init(par);
573
575 }
576
578 {
579 #ifdef DEVELOPER
581 {
582 Print(
"********************");
583 Print(
"dbgTrapz | START");
584 Print(
"********************");
585 }
586 #endif
587
588 super.SetupInitialTypes();
589
590 #ifdef DEVELOPER
592 {
594 }
595 #endif
596 }
597
599 {
602
605 }
606
608 {
611 }
612
614 {
616 }
617
620 {
622 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
623 {
625 if (dta)
626 {
630 }
631 else
632 ErrorEx(
"failed to acquire BaitData from type: " + type);
633 }
634
635 #ifdef DEVELOPER
637 {
640 else
641 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
642 }
643 #endif
644 }
645
647 {
648 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
649 int usedType = -1;
650 float probability = -1;
651 float highestProbability = 0.0;
653 for (int i = 0; i < count; i++)
654 {
657 if (probability > highestProbability)
658 {
659 highestProbability = probability;
660 usedType = baitType;
661 }
662 }
663
665 #ifdef DEVELOPER
667 {
668
669 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
670 }
671 #endif
673
674 #ifdef DEVELOPER
676 {
677 float dbgProb;
680 }
681 #endif
682 }
683
685 {
687
688 return true;
689 }
690
692 {
695 }
696
698 {
700 {
702 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
703 else
705 }
706 }
707}
708
710{
712 {
713 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
714 }
715}
716
718{
720 {
721 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
722 }
723}
724
726{
728 {
729 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
730 }
731}
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.