274{
282
284 {
287 {
290 }
291 }
292
294 {
296
297 super.CreateResultDataStructure();
298 }
299
301 {
302 super.ClearCatchingItemData();
303
308 }
309
311 {
312
313 if (item.IsRuined() || item.IsSetForDeletion())
314 return;
315
318 {
319 if (
GetGame().ConfigIsExisting(
path +
" baitTypes") &&
GetGame().ConfigIsExisting(
path +
" baitTypeChances"))
320 {
327 {
328 int key;
329 float value;
330 for (int i = 0; i < count; i++)
331 {
335 {
337 }
338 }
339 }
340 else
341 {
342 ErrorEx(
"'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() +
" do not match!",
ErrorExSeverity.INFO);
343 }
344 }
345 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityBaseMod"))
347 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMin"))
349 if (
GetGame().ConfigIsExisting(
path +
" resultQuantityDispersionMax"))
351 }
352 }
353
356 {
357 float ret = 1.0;
360 {
361
362 }
363
364 return ret;
365 }
366
368 {
370 if (
GetGame().SurfaceIsSea(pos[0], pos[2]))
372 else if (
GetGame().SurfaceIsPond( pos[0], pos[2]))
374 else
376 }
377
379 {
380 super.Init(par);
381
383 }
384
386 {
387 #ifdef DEVELOPER
389 {
390 Print(
"********************");
391 Print(
"dbgTrapz | START");
392 Print(
"********************");
393 }
394 #endif
395
396 super.SetupInitialTypes();
397
398 #ifdef DEVELOPER
400 {
402 }
403 #endif
404 }
405
407 {
410
413 }
414
416 {
419 }
420
422 {
424 }
425
428 {
430 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
431 {
433 if (dta)
434 {
438 }
439 else
440 ErrorEx(
"failed to acquire BaitData from type: " + type);
441 }
442
443 #ifdef DEVELOPER
445 {
448 else
449 Print(
"dbgTrapz | UpdateUsedBait to 'null'!");
450 }
451 #endif
452 }
453
455 {
456 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
457 int usedType = -1;
458 float probability = -1;
459 float highestProbability = 0.0;
461 for (int i = 0; i < count; i++)
462 {
465 if (probability > highestProbability)
466 {
467 highestProbability = probability;
468 usedType = baitType;
469 }
470 }
471
473 #ifdef DEVELOPER
475 {
476
477 Print(
"dbgTrapz | using bait type: " + baitType +
" to catch: " + yItem);
478 }
479 #endif
481
482 #ifdef DEVELOPER
484 {
485 float dbgProb;
488 }
489 #endif
490 }
491
493 {
495
496 return true;
497 }
498
500 {
503 }
504
506 {
508 {
510 m_Bait.SetQuantityNormalized((
m_Bait.GetQuantityNormalized() - qtyNorm));
511 else
513 }
514 }
515}
516
518{
520 {
521 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_SMALL;
522 }
523}
524
526{
528 {
529 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_FISHTRAP_LARGE;
530 }
531}
532
534{
536 {
537 m_MethodMask = AnimalCatchingConstants.MASK_METHOD_LANDTRAP_SNARE;
538 }
539}
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.