479{
487
489 {
492 {
495 }
496 }
497
499 {
501
502 super.CreateResultDataStructure();
503 }
504
506 {
507 super.ClearCatchingItemData();
508
513 }
514
516 {
517
518 if (item.IsRuined() || item.IsSetForDeletion())
519 return;
520
523 {
524 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
525 {
532 {
533 int key;
534 float value;
535 for (int i = 0; i < count; i++)
536 {
540 {
542 }
543 }
544 }
545 else
546 {
547 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
548 }
549 }
550 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
552 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
554 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
556 }
557 }
558
561 {
562 float ret = 1.0;
565 {
566
567 }
568
569 return ret;
570 }
571
573 {
575 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
577 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
579 else
581 }
582
584 {
585 super.Init(par);
586
588 }
589
591 {
592 #ifdef DEVELOPER
594 {
595 Print(
"********************");
596 Print(
"dbgTrapz | START");
597 Print(
"********************");
598 }
599 #endif
600
601 super.SetupInitialTypes();
602
603 #ifdef DEVELOPER
605 {
607 }
608 #endif
609 }
610
612 {
615
618 }
619
621 {
624 }
625
627 {
629 }
630
633 {
635 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
636 {
638 if (dta)
639 {
643 }
644 else
645 ErrorEx(
"failed to acquire BaitData from type: " + type);
646 }
647
648 #ifdef DEVELOPER
650 {
653 else
654 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
655 }
656 #endif
657 }
658
660 {
661 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
662 int usedType = -1;
663 float probability = -1;
664 float highestProbability = 0.0;
666 for (int i = 0; i < count; i++)
667 {
670 if (probability > highestProbability)
671 {
672 highestProbability = probability;
673 usedType = baitType;
674 }
675 }
676
678 #ifdef DEVELOPER
680 {
681
682 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
683 }
684 #endif
686
687 #ifdef DEVELOPER
689 {
690 float dbgProb;
693 }
694 #endif
695 }
696
698 {
700
701 return true;
702 }
703
705 {
708 }
709
711 {
713 {
715 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
716 else
718 }
719 }
720}
721
723{
725 {
726 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
727 }
728}
729
731{
733 {
734 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
735 }
736}
737
739{
741 {
742 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
743 }
744}
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.