395{
403
405 {
408 {
411 }
412 }
413
415 {
417
418 super.CreateResultDataStructure();
419 }
420
422 {
423 super.ClearCatchingItemData();
424
429 }
430
432 {
433
434 if (item.IsRuined() || item.IsSetForDeletion())
435 return;
436
439 {
440 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
441 {
448 {
449 int key;
450 float value;
451 for (int i = 0; i < count; i++)
452 {
456 {
458 }
459 }
460 }
461 else
462 {
463 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
464 }
465 }
466 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
468 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
470 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
472 }
473 }
474
477 {
478 float ret = 1.0;
481 {
482
483 }
484
485 return ret;
486 }
487
489 {
491 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
493 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
495 else
497 }
498
500 {
501 super.Init(par);
502
504 }
505
507 {
508 #ifdef DEVELOPER
510 {
511 Print(
"********************");
512 Print(
"dbgTrapz | START");
513 Print(
"********************");
514 }
515 #endif
516
517 super.SetupInitialTypes();
518
519 #ifdef DEVELOPER
521 {
523 }
524 #endif
525 }
526
528 {
531
534 }
535
537 {
540 }
541
543 {
545 }
546
549 {
551 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
552 {
554 if (dta)
555 {
559 }
560 else
561 ErrorEx(
"failed to acquire BaitData from type: " + type);
562 }
563
564 #ifdef DEVELOPER
566 {
569 else
570 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
571 }
572 #endif
573 }
574
576 {
577 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
578 int usedType = -1;
579 float probability = -1;
580 float highestProbability = 0.0;
582 for (int i = 0; i < count; i++)
583 {
586 if (probability > highestProbability)
587 {
588 highestProbability = probability;
589 usedType = baitType;
590 }
591 }
592
594 #ifdef DEVELOPER
596 {
597
598 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
599 }
600 #endif
602
603 #ifdef DEVELOPER
605 {
606 float dbgProb;
609 }
610 #endif
611 }
612
614 {
616
617 return true;
618 }
619
621 {
624 }
625
627 {
629 {
631 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
632 else
634 }
635 }
636}
637
639{
641 {
642 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
643 }
644}
645
647{
649 {
650 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
651 }
652}
653
655{
657 {
658 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
659 }
660}
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.