401{
409
411 {
414 {
417 }
418 }
419
421 {
423
424 super.CreateResultDataStructure();
425 }
426
428 {
429 super.ClearCatchingItemData();
430
435 }
436
438 {
439
440 if (item.IsRuined() || item.IsSetForDeletion())
441 return;
442
445 {
446 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
447 {
454 {
455 int key;
456 float value;
457 for (int i = 0; i < count; i++)
458 {
462 {
464 }
465 }
466 }
467 else
468 {
469 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
470 }
471 }
472 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
474 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
476 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
478 }
479 }
480
483 {
484 float ret = 1.0;
487 {
488
489 }
490
491 return ret;
492 }
493
495 {
497 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
499 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
501 else
503 }
504
506 {
507 super.Init(par);
508
510 }
511
513 {
514 #ifdef DEVELOPER
516 {
517 Print(
"********************");
518 Print(
"dbgTrapz | START");
519 Print(
"********************");
520 }
521 #endif
522
523 super.SetupInitialTypes();
524
525 #ifdef DEVELOPER
527 {
529 }
530 #endif
531 }
532
534 {
537
540 }
541
543 {
546 }
547
549 {
551 }
552
555 {
557 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
558 {
560 if (dta)
561 {
565 }
566 else
567 ErrorEx(
"failed to acquire BaitData from type: " + type);
568 }
569
570 #ifdef DEVELOPER
572 {
575 else
576 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
577 }
578 #endif
579 }
580
582 {
583 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
584 int usedType = -1;
585 float probability = -1;
586 float highestProbability = 0.0;
588 for (int i = 0; i < count; i++)
589 {
592 if (probability > highestProbability)
593 {
594 highestProbability = probability;
595 usedType = baitType;
596 }
597 }
598
600 #ifdef DEVELOPER
602 {
603
604 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
605 }
606 #endif
608
609 #ifdef DEVELOPER
611 {
612 float dbgProb;
615 }
616 #endif
617 }
618
620 {
622
623 return true;
624 }
625
627 {
630 }
631
633 {
635 {
637 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
638 else
640 }
641 }
642}
643
645{
647 {
648 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
649 }
650}
651
653{
655 {
656 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
657 }
658}
659
661{
663 {
664 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
665 }
666}
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.