341{
349
351 {
354 {
357 }
358 }
359
361 {
363
364 super.CreateResultDataStructure();
365 }
366
368 {
369 super.ClearCatchingItemData();
370
375 }
376
378 {
379
380 if (item.IsRuined() || item.IsSetForDeletion())
381 return;
382
385 {
386 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
387 {
394 {
395 int key;
396 float value;
397 for (int i = 0; i < count; i++)
398 {
402 {
404 }
405 }
406 }
407 else
408 {
409 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
410 }
411 }
412 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
414 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
416 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
418 }
419 }
420
423 {
424 float ret = 1.0;
427 {
428
429 }
430
431 return ret;
432 }
433
435 {
437 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
439 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
441 else
443 }
444
446 {
447 super.Init(par);
448
450 }
451
453 {
454 #ifdef DEVELOPER
456 {
457 Print(
"********************");
458 Print(
"dbgTrapz | START");
459 Print(
"********************");
460 }
461 #endif
462
463 super.SetupInitialTypes();
464
465 #ifdef DEVELOPER
467 {
469 }
470 #endif
471 }
472
474 {
477
480 }
481
483 {
486 }
487
489 {
491 }
492
495 {
497 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
498 {
500 if (dta)
501 {
505 }
506 else
507 ErrorEx(
"failed to acquire BaitData from type: " + type);
508 }
509
510 #ifdef DEVELOPER
512 {
515 else
516 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
517 }
518 #endif
519 }
520
522 {
523 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
524 int usedType = -1;
525 float probability = -1;
526 float highestProbability = 0.0;
528 for (int i = 0; i < count; i++)
529 {
532 if (probability > highestProbability)
533 {
534 highestProbability = probability;
535 usedType = baitType;
536 }
537 }
538
540 #ifdef DEVELOPER
542 {
543
544 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
545 }
546 #endif
548
549 #ifdef DEVELOPER
551 {
552 float dbgProb;
555 }
556 #endif
557 }
558
560 {
562
563 return true;
564 }
565
567 {
570 }
571
573 {
575 {
577 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
578 else
580 }
581 }
582}
583
585{
587 {
588 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
589 }
590}
591
593{
595 {
596 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
597 }
598}
599
601{
603 {
604 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
605 }
606}
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.