380{
388
390 {
393 {
396 }
397 }
398
400 {
402
403 super.CreateResultDataStructure();
404 }
405
407 {
408 super.ClearCatchingItemData();
409
414 }
415
417 {
418
419 if (item.IsRuined() || item.IsSetForDeletion())
420 return;
421
424 {
425 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
426 {
433 {
434 int key;
435 float value;
436 for (int i = 0; i < count; i++)
437 {
441 {
443 }
444 }
445 }
446 else
447 {
448 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
449 }
450 }
451 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
453 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
455 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
457 }
458 }
459
462 {
463 float ret = 1.0;
466 {
467
468 }
469
470 return ret;
471 }
472
474 {
476 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
478 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
480 else
482 }
483
485 {
486 super.Init(par);
487
489 }
490
492 {
493 #ifdef DEVELOPER
495 {
496 Print(
"********************");
497 Print(
"dbgTrapz | START");
498 Print(
"********************");
499 }
500 #endif
501
502 super.SetupInitialTypes();
503
504 #ifdef DEVELOPER
506 {
508 }
509 #endif
510 }
511
513 {
516
519 }
520
522 {
525 }
526
528 {
530 }
531
534 {
536 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
537 {
539 if (dta)
540 {
544 }
545 else
546 ErrorEx(
"failed to acquire BaitData from type: " + type);
547 }
548
549 #ifdef DEVELOPER
551 {
554 else
555 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
556 }
557 #endif
558 }
559
561 {
562 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
563 int usedType = -1;
564 float probability = -1;
565 float highestProbability = 0.0;
567 for (int i = 0; i < count; i++)
568 {
571 if (probability > highestProbability)
572 {
573 highestProbability = probability;
574 usedType = baitType;
575 }
576 }
577
579 #ifdef DEVELOPER
581 {
582
583 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
584 }
585 #endif
587
588 #ifdef DEVELOPER
590 {
591 float dbgProb;
594 }
595 #endif
596 }
597
599 {
601
602 return true;
603 }
604
606 {
609 }
610
612 {
614 {
616 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
617 else
619 }
620 }
621}
622
624{
626 {
627 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
628 }
629}
630
632{
634 {
635 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
636 }
637}
638
640{
642 {
643 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
644 }
645}
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.