284{
292
294 {
297 {
300 }
301 }
302
304 {
306
307 super.CreateResultDataStructure();
308 }
309
311 {
312 super.ClearCatchingItemData();
313
318 }
319
321 {
322
323 if (item.IsRuined() || item.IsSetForDeletion())
324 return;
325
328 {
329 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
330 {
337 {
338 int key;
339 float value;
340 for (int i = 0; i < count; i++)
341 {
345 {
347 }
348 }
349 }
350 else
351 {
352 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
353 }
354 }
355 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
357 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
359 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
361 }
362 }
363
366 {
367 float ret = 1.0;
370 {
371
372 }
373
374 return ret;
375 }
376
378 {
380 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
382 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
384 else
386 }
387
389 {
390 super.Init(par);
391
393 }
394
396 {
397 #ifdef DEVELOPER
399 {
400 Print(
"********************");
401 Print(
"dbgTrapz | START");
402 Print(
"********************");
403 }
404 #endif
405
406 super.SetupInitialTypes();
407
408 #ifdef DEVELOPER
410 {
412 }
413 #endif
414 }
415
417 {
420
423 }
424
426 {
429 }
430
432 {
434 }
435
438 {
440 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
441 {
443 if (dta)
444 {
448 }
449 else
450 ErrorEx(
"failed to acquire BaitData from type: " + type);
451 }
452
453 #ifdef DEVELOPER
455 {
458 else
459 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
460 }
461 #endif
462 }
463
465 {
466 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
467 int usedType = -1;
468 float probability = -1;
469 float highestProbability = 0.0;
471 for (int i = 0; i < count; i++)
472 {
475 if (probability > highestProbability)
476 {
477 highestProbability = probability;
478 usedType = baitType;
479 }
480 }
481
483 #ifdef DEVELOPER
485 {
486
487 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
488 }
489 #endif
491
492 #ifdef DEVELOPER
494 {
495 float dbgProb;
498 }
499 #endif
500 }
501
503 {
505
506 return true;
507 }
508
510 {
513 }
514
516 {
518 {
520 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
521 else
523 }
524 }
525}
526
528{
530 {
531 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
532 }
533}
534
536{
538 {
539 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
540 }
541}
542
544{
546 {
547 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
548 }
549}
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.