389{
397
399 {
402 {
405 }
406 }
407
409 {
411
412 super.CreateResultDataStructure();
413 }
414
416 {
417 super.ClearCatchingItemData();
418
423 }
424
426 {
427
428 if (item.IsRuined() || item.IsSetForDeletion())
429 return;
430
433 {
434 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
435 {
442 {
443 int key;
444 float value;
445 for (int i = 0; i < count; i++)
446 {
450 {
452 }
453 }
454 }
455 else
456 {
457 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
458 }
459 }
460 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
462 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
464 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
466 }
467 }
468
471 {
472 float ret = 1.0;
475 {
476
477 }
478
479 return ret;
480 }
481
483 {
485 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
487 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
489 else
491 }
492
494 {
495 super.Init(par);
496
498 }
499
501 {
502 #ifdef DEVELOPER
504 {
505 Print(
"********************");
506 Print(
"dbgTrapz | START");
507 Print(
"********************");
508 }
509 #endif
510
511 super.SetupInitialTypes();
512
513 #ifdef DEVELOPER
515 {
517 }
518 #endif
519 }
520
522 {
525
528 }
529
531 {
534 }
535
537 {
539 }
540
543 {
545 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
546 {
548 if (dta)
549 {
553 }
554 else
555 ErrorEx(
"failed to acquire BaitData from type: " + type);
556 }
557
558 #ifdef DEVELOPER
560 {
563 else
564 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
565 }
566 #endif
567 }
568
570 {
571 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
572 int usedType = -1;
573 float probability = -1;
574 float highestProbability = 0.0;
576 for (int i = 0; i < count; i++)
577 {
580 if (probability > highestProbability)
581 {
582 highestProbability = probability;
583 usedType = baitType;
584 }
585 }
586
588 #ifdef DEVELOPER
590 {
591
592 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
593 }
594 #endif
596
597 #ifdef DEVELOPER
599 {
600 float dbgProb;
603 }
604 #endif
605 }
606
608 {
610
611 return true;
612 }
613
615 {
618 }
619
621 {
623 {
625 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
626 else
628 }
629 }
630}
631
633{
635 {
636 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
637 }
638}
639
641{
643 {
644 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
645 }
646}
647
649{
651 {
652 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
653 }
654}
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.