352{
360
362 {
365 {
368 }
369 }
370
372 {
374
375 super.CreateResultDataStructure();
376 }
377
379 {
380 super.ClearCatchingItemData();
381
386 }
387
389 {
390
391 if (item.IsRuined() || item.IsSetForDeletion())
392 return;
393
396 {
397 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
398 {
405 {
406 int key;
407 float value;
408 for (int i = 0; i < count; i++)
409 {
413 {
415 }
416 }
417 }
418 else
419 {
420 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
421 }
422 }
423 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
425 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
427 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
429 }
430 }
431
434 {
435 float ret = 1.0;
438 {
439
440 }
441
442 return ret;
443 }
444
446 {
448 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
450 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
452 else
454 }
455
457 {
458 super.Init(par);
459
461 }
462
464 {
465 #ifdef DEVELOPER
467 {
468 Print(
"********************");
469 Print(
"dbgTrapz | START");
470 Print(
"********************");
471 }
472 #endif
473
474 super.SetupInitialTypes();
475
476 #ifdef DEVELOPER
478 {
480 }
481 #endif
482 }
483
485 {
488
491 }
492
494 {
497 }
498
500 {
502 }
503
506 {
508 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
509 {
511 if (dta)
512 {
516 }
517 else
518 ErrorEx(
"failed to acquire BaitData from type: " + type);
519 }
520
521 #ifdef DEVELOPER
523 {
526 else
527 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
528 }
529 #endif
530 }
531
533 {
534 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
535 int usedType = -1;
536 float probability = -1;
537 float highestProbability = 0.0;
539 for (int i = 0; i < count; i++)
540 {
543 if (probability > highestProbability)
544 {
545 highestProbability = probability;
546 usedType = baitType;
547 }
548 }
549
551 #ifdef DEVELOPER
553 {
554
555 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
556 }
557 #endif
559
560 #ifdef DEVELOPER
562 {
563 float dbgProb;
566 }
567 #endif
568 }
569
571 {
573
574 return true;
575 }
576
578 {
581 }
582
584 {
586 {
588 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
589 else
591 }
592 }
593}
594
596{
598 {
599 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
600 }
601}
602
604{
606 {
607 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
608 }
609}
610
612{
614 {
615 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
616 }
617}
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.