updates base probability when catching the specific item (some context subclasses only)
428{
436
438 {
441 {
444 }
445 }
446
448 {
450
451 super.CreateResultDataStructure();
452 }
453
455 {
456 super.ClearCatchingItemData();
457
462 }
463
465 {
466
467 if (item.IsRuined() || item.IsSetForDeletion())
468 return;
469
472 {
473 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
474 {
481 {
482 int key;
483 float value;
484 for (int i = 0; i < count; i++)
485 {
489 {
491 }
492 }
493 }
494 else
495 {
496 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
497 }
498 }
499 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
501 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
503 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
505 }
506 }
507
510 {
511 float ret = 1.0;
514 {
515
516 }
517
518 return ret;
519 }
520
522 {
524 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
526 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
528 else
530 }
531
533 {
534 super.Init(par);
535
537 }
538
540 {
541 #ifdef DEVELOPER
543 {
544 Print(
"********************");
545 Print(
"dbgTrapz | START");
546 Print(
"********************");
547 }
548 #endif
549
550 super.SetupInitialTypes();
551
552 #ifdef DEVELOPER
554 {
556 }
557 #endif
558 }
559
561 {
564
567 }
568
570 {
573 }
574
576 {
578 }
579
582 {
584 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
585 {
587 if (dta)
588 {
592 }
593 else
594 ErrorEx(
"failed to acquire BaitData from type: " + type);
595 }
596
597 #ifdef DEVELOPER
599 {
602 else
603 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
604 }
605 #endif
606 }
607
609 {
610 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
611 int usedType = -1;
612 float probability = -1;
613 float highestProbability = 0.0;
615 for (int i = 0; i < count; i++)
616 {
619 if (probability > highestProbability)
620 {
621 highestProbability = probability;
622 usedType = baitType;
623 }
624 }
625
627 #ifdef DEVELOPER
629 {
630
631 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
632 }
633 #endif
635
636 #ifdef DEVELOPER
638 {
639 float dbgProb;
642 }
643 #endif
644 }
645
647 {
649
650 return true;
651 }
652
654 {
657 }
658
660 {
662 {
664 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
665 else
667 }
668 }
669}
670
672{
674 {
675 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
676 }
677}
678
680{
682 {
683 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
684 }
685}
686
688{
690 {
691 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
692 }
693}
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.