DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл CatchingContextTraps.c

См. исходные тексты.

Структуры данных

class  CatchingContextTrapsBase
 
class  CatchingContextTrapFishLarge
 

Функции

CatchingContextTrapsBase CatchingContextBase InitCatchMethodMask ()
 
void DeserializeData (Param par)
 
void CreateResultDataStructure ()
 
void ClearCatchingItemData ()
 
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 InitCatchEnviroMask ()
 
void Init (Param par)
 
void SetupInitialTypes ()
 
void UpdateDataAndMasks ()
 
int UpdateTrapEnviroMask ()
 
void SetTrapEnviroMask (int value)
 
void UpdateUsedBait (ECatchingBaitCategories type)
 if non-empty bait type is used, some 'Bait' attachment is picked as an active bait (currently no direct link between item and sensitivity-weighted target probability)
 
override void UpdateBaseProbability (YieldItemBase yItem)
 updates base probability when catching the specific item (some context subclasses only)
 
override bool ModifySignalProbability (inout float probability)
 
void RemoveBait ()
 
void ReduceBaitQty (float qtyNorm)
 

Переменные

float m_CumulativeTrappingSuccess
 after N attempts, the chance to catch should be this. Only highest one applies. @NOTE: Take care, only way to achieve guaranteed 1.0 chance at the end is to have EVERY chance at 1.0.
 
int m_AttemptsCount
 
ItemBase m_Bait
 

Функции

◆ AdjustBaitItemChance()

float AdjustBaitItemChance ( EntityAI item)
protected

Allows for adjustment of all catch probabilities from item qualities (damage, qty...)

328 : CatchingContextBase
329{
333
334 protected float m_CumulativeTrappingSuccess;
335 protected int m_AttemptsCount;
336 protected ItemBase m_Bait;
337
338 override protected void DeserializeData(Param par)
339 {
341 if (Class.CastTo(p,par))
342 {
343 m_MainItem = p.param1;
344 m_AttemptsCount = p.param2;
345 }
346 }
347
348 override protected void CreateResultDataStructure()
349 {
351
352 super.CreateResultDataStructure();
353 }
354
355 override protected void ClearCatchingItemData()
356 {
357 super.ClearCatchingItemData();
358
360 m_QualityBaseMod = 0.0;
363 }
364
365 override protected void InitItemValues(EntityAI item)
366 {
367 //skip ruined or deleted items entirely
368 if (item.IsRuined() || item.IsSetForDeletion())
369 return;
370
371 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
372 if (GetGame().ConfigIsExisting(path))
373 {
374 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
375 {
378 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
379 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
380 int count = CachedObjectsArrays.ARRAY_INT.Count();
382 {
383 int key;
384 float value;
385 for (int i = 0; i < count; i++)
386 {
389 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
390 {
392 }
393 }
394 }
395 else
396 {
397 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
398 }
399 }
400 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
401 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
402 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
403 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
404 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
405 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
406 }
407 }
408
411 {
412 float ret = 1.0;
413 ItemBase ib;
414 if (Class.CastTo(ib,item))
415 {
416 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
417 }
418
419 return ret;
420 }
421
422 override protected void InitCatchEnviroMask()
423 {
424 vector pos = m_MainItem.GetPosition();
425 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
427 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
429 else
431 }
432
433 override protected void Init(Param par)
434 {
435 super.Init(par);
436
438 }
439
440 override protected void SetupInitialTypes()
441 {
442 #ifdef DEVELOPER
443 if (IsCLIParam("catchingLogs"))
444 {
445 Print("********************"); //just for debug purposes to track the start
446 Print("dbgTrapz | START");
447 Print("********************");
448 }
449 #endif
450
451 super.SetupInitialTypes();
452
453 #ifdef DEVELOPER
454 if (IsCLIParam("catchingLogs"))
455 {
456 Print("***"); //just for debug purposes to track the start
457 }
458 #endif
459 }
460
461 void UpdateDataAndMasks()
462 {
464 InitCatchMethodMask(); //bait check
465 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
468 }
469
471 {
473 return GetCatchEnviroMask();
474 }
475
476 void SetTrapEnviroMask(int value)
477 {
479 }
480
483 {
484 m_Bait = null;
485 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
486 {
488 if (dta)
489 {
490 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
493 }
494 else
495 ErrorEx("failed to acquire BaitData from type: " + type);
496 }
497
498 #ifdef DEVELOPER
499 if (IsCLIParam("catchingLogs"))
500 {
501 if (m_Bait)
502 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
503 else
504 Print("dbgTrapz | UpdateUsedBait to 'null'!");
505 }
506 #endif
507 }
508
510 {
511 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
512 int usedType = -1;
513 float probability = -1;
514 float highestProbability = 0.0;
515 int count = m_BaitCompatibilityMap.Count();
516 for (int i = 0; i < count; i++)
517 {
519 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
521 {
524 }
525 }
526
528 #ifdef DEVELOPER
529 if (IsCLIParam("catchingLogs"))
530 {
531 //Print("********************");
532 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
533 }
534 #endif
536
537 #ifdef DEVELOPER
538 if (IsCLIParam("catchingLogs"))
539 {
540 float dbgProb;
542 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
543 }
544 #endif
545 }
546
547 override bool ModifySignalProbability(inout float probability)
548 {
550
551 return true;
552 }
553
554 void RemoveBait()
555 {
556 if (m_Bait)
557 m_Bait.DeleteSafe();
558 }
559
560 void ReduceBaitQty(float qtyNorm)
561 {
562 if (m_Bait)
563 {
564 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
565 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
566 else
567 m_Bait.DeleteSafe();
568 }
569 }
570}
571
573{
574 override protected void InitCatchMethodMask()
575 {
577 }
578}
579
581{
582 override protected void InitCatchMethodMask()
583 {
585 }
586}
587
589{
590 override protected void InitCatchMethodMask()
591 {
593 }
594}
int GetCatchEnviroMask()
Definition CatchingContextBase.c:164
float m_QualityBaseMod
Definition CatchingContextBase.c:20
void InitCatchMethodMask()
Definition CatchingContextBase.c:148
ref map< int, ref BaitData > m_BaitCompatibilityMap
Definition CatchingContextBase.c:23
class BaitData m_MainItem
Definition ActionBase.c:36
ref CatchingResultBasic m_Result
Definition CatchingContextBase.c:27
void GenerateResult()
Definition CatchingContextBase.c:257
int m_MethodMask
Definition CatchingContextBase.c:18
float m_QualityDispersionMinMod
Definition CatchingContextBase.c:21
void InitCatchingItemData()
Definition CatchingContextBase.c:217
float m_QualityDispersionMaxMod
Definition CatchingContextBase.c:22
int m_EnviroMask
Definition CatchingContextBase.c:19
void SetupProbabilityArray()
Definition CatchingContextBase.c:97
void SetupInitialTypes()
Definition CatchingContextTraps.c:358
void ClearCatchingItemData()
Definition CatchingContextTraps.c:273
ItemBase m_Bait
Definition CatchingContextTraps.c:254
void DeserializeData(Param par)
Definition CatchingContextTraps.c:256
override bool ModifySignalProbability(inout float probability)
Definition CatchingContextTraps.c:465
int UpdateTrapEnviroMask()
Definition CatchingContextTraps.c:388
CatchingContextTrapsBase CatchingContextBase InitCatchMethodMask()
Definition CatchingContextTraps.c:247
void UpdateUsedBait(ECatchingBaitCategories type)
if non-empty bait type is used, some 'Bait' attachment is picked as an active bait (currently no dire...
Definition CatchingContextTraps.c:400
void InitItemValues(EntityAI item)
override to init context-specific values
Definition CatchingContextTraps.c:283
float m_CumulativeTrappingSuccess
after N attempts, the chance to catch should be this. Only highest one applies. @NOTE: Take care,...
Definition CatchingContextTraps.c:252
void UpdateDataAndMasks()
Definition CatchingContextTraps.c:379
void ReduceBaitQty(float qtyNorm)
Definition CatchingContextTraps.c:478
void CreateResultDataStructure()
Definition CatchingContextTraps.c:266
override void UpdateBaseProbability(YieldItemBase yItem)
updates base probability when catching the specific item (some context subclasses only)
Definition CatchingContextTraps.c:427
int m_AttemptsCount
Definition CatchingContextTraps.c:253
void InitCatchEnviroMask()
Definition CatchingContextTraps.c:340
float AdjustBaitItemChance(EntityAI item)
Allows for adjustment of all catch probabilities from item qualities (damage, qty....
Definition CatchingContextTraps.c:328
void RemoveBait()
Definition CatchingContextTraps.c:472
void SetTrapEnviroMask(int value)
Definition CatchingContextTraps.c:394
override Widget Init()
Definition DayZGame.c:122
string path
Definition OptionSelectorMultistate.c:142
Definition CatchingConstants.c:2
static const int MASK_ENVIRO_LAND_ALL
Definition CatchingConstants.c:16
static const int MASK_METHOD_FISHTRAP_LARGE
Definition CatchingConstants.c:20
static const int MASK_METHOD_LANDTRAP_SNARE
Definition CatchingConstants.c:22
static const int MASK_ENVIRO_SEA
Definition CatchingConstants.c:12
static const int MASK_ENVIRO_POND
Definition CatchingConstants.c:11
static const int MASK_METHOD_FISHTRAP_SMALL
Definition CatchingConstants.c:21
Definition CatchingContextBase.c:2
Definition UtilityClasses.c:41
static ref TIntArray ARRAY_INT
Definition UtilityClasses.c:51
static ref TFloatArray ARRAY_FLOAT
Definition UtilityClasses.c:50
Definition CatchingContextTraps.c:254
void InitCatchMethodMask()
Definition CatchingContextTraps.c:255
Definition CatchingContextTraps.c:2
Definition CarchingResultTrapBase.c:2
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Building.c:6
Definition InventoryItem.c:731
override bool CanBeSplit()
Definition Rag.c:34
Definition EnMath.c:7
Definition EntityAI.c:95
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Definition CatchYieldItemBase.c:2
Definition EnConvert.c:106
proto native CGame GetGame()
ErrorExSeverity
Definition EnDebug.c:62
proto void Print(void var)
Prints content of variable to console/log.
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Pow(float v, float power)
Return power of v ^ power.
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'.
const string CFG_VEHICLESPATH
Definition constants.c:217
proto native bool IsCLIParam(string param)
Returns if command line argument is present.

◆ ClearCatchingItemData()

void ClearCatchingItemData ( )
protected
273 : CatchingContextBase
274{
278
279 protected float m_CumulativeTrappingSuccess;
280 protected int m_AttemptsCount;
281 protected ItemBase m_Bait;
282
283 override protected void DeserializeData(Param par)
284 {
286 if (Class.CastTo(p,par))
287 {
288 m_MainItem = p.param1;
289 m_AttemptsCount = p.param2;
290 }
291 }
292
293 override protected void CreateResultDataStructure()
294 {
296
297 super.CreateResultDataStructure();
298 }
299
300 override protected void ClearCatchingItemData()
301 {
302 super.ClearCatchingItemData();
303
305 m_QualityBaseMod = 0.0;
308 }
309
310 override protected void InitItemValues(EntityAI item)
311 {
312 //skip ruined or deleted items entirely
313 if (item.IsRuined() || item.IsSetForDeletion())
314 return;
315
316 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
317 if (GetGame().ConfigIsExisting(path))
318 {
319 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
320 {
323 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
324 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
325 int count = CachedObjectsArrays.ARRAY_INT.Count();
327 {
328 int key;
329 float value;
330 for (int i = 0; i < count; i++)
331 {
334 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
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"))
346 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
347 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
348 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
349 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
350 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
351 }
352 }
353
356 {
357 float ret = 1.0;
358 ItemBase ib;
359 if (Class.CastTo(ib,item))
360 {
361 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
362 }
363
364 return ret;
365 }
366
367 override protected void InitCatchEnviroMask()
368 {
369 vector pos = m_MainItem.GetPosition();
370 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
372 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
374 else
376 }
377
378 override protected void Init(Param par)
379 {
380 super.Init(par);
381
383 }
384
385 override protected void SetupInitialTypes()
386 {
387 #ifdef DEVELOPER
388 if (IsCLIParam("catchingLogs"))
389 {
390 Print("********************"); //just for debug purposes to track the start
391 Print("dbgTrapz | START");
392 Print("********************");
393 }
394 #endif
395
396 super.SetupInitialTypes();
397
398 #ifdef DEVELOPER
399 if (IsCLIParam("catchingLogs"))
400 {
401 Print("***"); //just for debug purposes to track the start
402 }
403 #endif
404 }
405
406 void UpdateDataAndMasks()
407 {
409 InitCatchMethodMask(); //bait check
410 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
413 }
414
416 {
418 return GetCatchEnviroMask();
419 }
420
421 void SetTrapEnviroMask(int value)
422 {
424 }
425
428 {
429 m_Bait = null;
430 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
431 {
433 if (dta)
434 {
435 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
438 }
439 else
440 ErrorEx("failed to acquire BaitData from type: " + type);
441 }
442
443 #ifdef DEVELOPER
444 if (IsCLIParam("catchingLogs"))
445 {
446 if (m_Bait)
447 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
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;
460 int count = m_BaitCompatibilityMap.Count();
461 for (int i = 0; i < count; i++)
462 {
464 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
466 {
469 }
470 }
471
473 #ifdef DEVELOPER
474 if (IsCLIParam("catchingLogs"))
475 {
476 //Print("********************");
477 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
478 }
479 #endif
481
482 #ifdef DEVELOPER
483 if (IsCLIParam("catchingLogs"))
484 {
485 float dbgProb;
487 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
488 }
489 #endif
490 }
491
492 override bool ModifySignalProbability(inout float probability)
493 {
495
496 return true;
497 }
498
499 void RemoveBait()
500 {
501 if (m_Bait)
502 m_Bait.DeleteSafe();
503 }
504
505 void ReduceBaitQty(float qtyNorm)
506 {
507 if (m_Bait)
508 {
509 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
510 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
511 else
512 m_Bait.DeleteSafe();
513 }
514 }
515}
516
518{
519 override protected void InitCatchMethodMask()
520 {
522 }
523}
524
526{
527 override protected void InitCatchMethodMask()
528 {
530 }
531}
532
534{
535 override protected void InitCatchMethodMask()
536 {
538 }
539}

◆ CreateResultDataStructure()

void CreateResultDataStructure ( )
protected

◆ DeserializeData()

void DeserializeData ( Param par)
protected

Перекрестные ссылки m_MethodMask и AnimalCatchingConstants::MASK_METHOD_FISHTRAP_LARGE.

Используется в Init().

◆ Init()

void Init ( Param par)
protected
351 : CatchingContextBase
352{
356
357 protected float m_CumulativeTrappingSuccess;
358 protected int m_AttemptsCount;
359 protected ItemBase m_Bait;
360
361 override protected void DeserializeData(Param par)
362 {
364 if (Class.CastTo(p,par))
365 {
366 m_MainItem = p.param1;
367 m_AttemptsCount = p.param2;
368 }
369 }
370
371 override protected void CreateResultDataStructure()
372 {
374
375 super.CreateResultDataStructure();
376 }
377
378 override protected void ClearCatchingItemData()
379 {
380 super.ClearCatchingItemData();
381
383 m_QualityBaseMod = 0.0;
386 }
387
388 override protected void InitItemValues(EntityAI item)
389 {
390 //skip ruined or deleted items entirely
391 if (item.IsRuined() || item.IsSetForDeletion())
392 return;
393
394 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
395 if (GetGame().ConfigIsExisting(path))
396 {
397 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
398 {
401 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
402 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
403 int count = CachedObjectsArrays.ARRAY_INT.Count();
405 {
406 int key;
407 float value;
408 for (int i = 0; i < count; i++)
409 {
412 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
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"))
424 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
425 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
426 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
427 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
428 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
429 }
430 }
431
434 {
435 float ret = 1.0;
436 ItemBase ib;
437 if (Class.CastTo(ib,item))
438 {
439 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
440 }
441
442 return ret;
443 }
444
445 override protected void InitCatchEnviroMask()
446 {
447 vector pos = m_MainItem.GetPosition();
448 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
450 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
452 else
454 }
455
456 override protected void Init(Param par)
457 {
458 super.Init(par);
459
461 }
462
463 override protected void SetupInitialTypes()
464 {
465 #ifdef DEVELOPER
466 if (IsCLIParam("catchingLogs"))
467 {
468 Print("********************"); //just for debug purposes to track the start
469 Print("dbgTrapz | START");
470 Print("********************");
471 }
472 #endif
473
474 super.SetupInitialTypes();
475
476 #ifdef DEVELOPER
477 if (IsCLIParam("catchingLogs"))
478 {
479 Print("***"); //just for debug purposes to track the start
480 }
481 #endif
482 }
483
484 void UpdateDataAndMasks()
485 {
487 InitCatchMethodMask(); //bait check
488 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
491 }
492
494 {
496 return GetCatchEnviroMask();
497 }
498
499 void SetTrapEnviroMask(int value)
500 {
502 }
503
506 {
507 m_Bait = null;
508 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
509 {
511 if (dta)
512 {
513 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
516 }
517 else
518 ErrorEx("failed to acquire BaitData from type: " + type);
519 }
520
521 #ifdef DEVELOPER
522 if (IsCLIParam("catchingLogs"))
523 {
524 if (m_Bait)
525 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
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;
538 int count = m_BaitCompatibilityMap.Count();
539 for (int i = 0; i < count; i++)
540 {
542 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
544 {
547 }
548 }
549
551 #ifdef DEVELOPER
552 if (IsCLIParam("catchingLogs"))
553 {
554 //Print("********************");
555 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
556 }
557 #endif
559
560 #ifdef DEVELOPER
561 if (IsCLIParam("catchingLogs"))
562 {
563 float dbgProb;
565 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
566 }
567 #endif
568 }
569
570 override bool ModifySignalProbability(inout float probability)
571 {
573
574 return true;
575 }
576
577 void RemoveBait()
578 {
579 if (m_Bait)
580 m_Bait.DeleteSafe();
581 }
582
583 void ReduceBaitQty(float qtyNorm)
584 {
585 if (m_Bait)
586 {
587 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
588 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
589 else
590 m_Bait.DeleteSafe();
591 }
592 }
593}
594
596{
597 override protected void InitCatchMethodMask()
598 {
600 }
601}
602
604{
605 override protected void InitCatchMethodMask()
606 {
608 }
609}
610
612{
613 override protected void InitCatchMethodMask()
614 {
616 }
617}

◆ InitCatchEnviroMask()

void InitCatchEnviroMask ( )
protected
340 : CatchingContextBase
341{
345
346 protected float m_CumulativeTrappingSuccess;
347 protected int m_AttemptsCount;
348 protected ItemBase m_Bait;
349
350 override protected void DeserializeData(Param par)
351 {
353 if (Class.CastTo(p,par))
354 {
355 m_MainItem = p.param1;
356 m_AttemptsCount = p.param2;
357 }
358 }
359
360 override protected void CreateResultDataStructure()
361 {
363
364 super.CreateResultDataStructure();
365 }
366
367 override protected void ClearCatchingItemData()
368 {
369 super.ClearCatchingItemData();
370
372 m_QualityBaseMod = 0.0;
375 }
376
377 override protected void InitItemValues(EntityAI item)
378 {
379 //skip ruined or deleted items entirely
380 if (item.IsRuined() || item.IsSetForDeletion())
381 return;
382
383 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
384 if (GetGame().ConfigIsExisting(path))
385 {
386 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
387 {
390 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
391 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
392 int count = CachedObjectsArrays.ARRAY_INT.Count();
394 {
395 int key;
396 float value;
397 for (int i = 0; i < count; i++)
398 {
401 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
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"))
413 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
414 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
415 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
416 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
417 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
418 }
419 }
420
423 {
424 float ret = 1.0;
425 ItemBase ib;
426 if (Class.CastTo(ib,item))
427 {
428 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
429 }
430
431 return ret;
432 }
433
434 override protected void InitCatchEnviroMask()
435 {
436 vector pos = m_MainItem.GetPosition();
437 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
439 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
441 else
443 }
444
445 override protected void Init(Param par)
446 {
447 super.Init(par);
448
450 }
451
452 override protected void SetupInitialTypes()
453 {
454 #ifdef DEVELOPER
455 if (IsCLIParam("catchingLogs"))
456 {
457 Print("********************"); //just for debug purposes to track the start
458 Print("dbgTrapz | START");
459 Print("********************");
460 }
461 #endif
462
463 super.SetupInitialTypes();
464
465 #ifdef DEVELOPER
466 if (IsCLIParam("catchingLogs"))
467 {
468 Print("***"); //just for debug purposes to track the start
469 }
470 #endif
471 }
472
473 void UpdateDataAndMasks()
474 {
476 InitCatchMethodMask(); //bait check
477 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
480 }
481
483 {
485 return GetCatchEnviroMask();
486 }
487
488 void SetTrapEnviroMask(int value)
489 {
491 }
492
495 {
496 m_Bait = null;
497 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
498 {
500 if (dta)
501 {
502 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
505 }
506 else
507 ErrorEx("failed to acquire BaitData from type: " + type);
508 }
509
510 #ifdef DEVELOPER
511 if (IsCLIParam("catchingLogs"))
512 {
513 if (m_Bait)
514 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
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;
527 int count = m_BaitCompatibilityMap.Count();
528 for (int i = 0; i < count; i++)
529 {
531 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
533 {
536 }
537 }
538
540 #ifdef DEVELOPER
541 if (IsCLIParam("catchingLogs"))
542 {
543 //Print("********************");
544 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
545 }
546 #endif
548
549 #ifdef DEVELOPER
550 if (IsCLIParam("catchingLogs"))
551 {
552 float dbgProb;
554 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
555 }
556 #endif
557 }
558
559 override bool ModifySignalProbability(inout float probability)
560 {
562
563 return true;
564 }
565
566 void RemoveBait()
567 {
568 if (m_Bait)
569 m_Bait.DeleteSafe();
570 }
571
572 void ReduceBaitQty(float qtyNorm)
573 {
574 if (m_Bait)
575 {
576 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
577 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
578 else
579 m_Bait.DeleteSafe();
580 }
581 }
582}
583
585{
586 override protected void InitCatchMethodMask()
587 {
589 }
590}
591
593{
594 override protected void InitCatchMethodMask()
595 {
597 }
598}
599
601{
602 override protected void InitCatchMethodMask()
603 {
605 }
606}

◆ InitCatchMethodMask()

◆ InitItemValues()

void InitItemValues ( EntityAI item)
protected

override to init context-specific values

283 : CatchingContextBase
284{
288
289 protected float m_CumulativeTrappingSuccess;
290 protected int m_AttemptsCount;
291 protected ItemBase m_Bait;
292
293 override protected void DeserializeData(Param par)
294 {
296 if (Class.CastTo(p,par))
297 {
298 m_MainItem = p.param1;
299 m_AttemptsCount = p.param2;
300 }
301 }
302
303 override protected void CreateResultDataStructure()
304 {
306
307 super.CreateResultDataStructure();
308 }
309
310 override protected void ClearCatchingItemData()
311 {
312 super.ClearCatchingItemData();
313
315 m_QualityBaseMod = 0.0;
318 }
319
320 override protected void InitItemValues(EntityAI item)
321 {
322 //skip ruined or deleted items entirely
323 if (item.IsRuined() || item.IsSetForDeletion())
324 return;
325
326 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
327 if (GetGame().ConfigIsExisting(path))
328 {
329 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
330 {
333 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
334 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
335 int count = CachedObjectsArrays.ARRAY_INT.Count();
337 {
338 int key;
339 float value;
340 for (int i = 0; i < count; i++)
341 {
344 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
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"))
356 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
357 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
358 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
359 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
360 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
361 }
362 }
363
366 {
367 float ret = 1.0;
368 ItemBase ib;
369 if (Class.CastTo(ib,item))
370 {
371 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
372 }
373
374 return ret;
375 }
376
377 override protected void InitCatchEnviroMask()
378 {
379 vector pos = m_MainItem.GetPosition();
380 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
382 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
384 else
386 }
387
388 override protected void Init(Param par)
389 {
390 super.Init(par);
391
393 }
394
395 override protected void SetupInitialTypes()
396 {
397 #ifdef DEVELOPER
398 if (IsCLIParam("catchingLogs"))
399 {
400 Print("********************"); //just for debug purposes to track the start
401 Print("dbgTrapz | START");
402 Print("********************");
403 }
404 #endif
405
406 super.SetupInitialTypes();
407
408 #ifdef DEVELOPER
409 if (IsCLIParam("catchingLogs"))
410 {
411 Print("***"); //just for debug purposes to track the start
412 }
413 #endif
414 }
415
416 void UpdateDataAndMasks()
417 {
419 InitCatchMethodMask(); //bait check
420 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
423 }
424
426 {
428 return GetCatchEnviroMask();
429 }
430
431 void SetTrapEnviroMask(int value)
432 {
434 }
435
438 {
439 m_Bait = null;
440 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
441 {
443 if (dta)
444 {
445 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
448 }
449 else
450 ErrorEx("failed to acquire BaitData from type: " + type);
451 }
452
453 #ifdef DEVELOPER
454 if (IsCLIParam("catchingLogs"))
455 {
456 if (m_Bait)
457 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
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;
470 int count = m_BaitCompatibilityMap.Count();
471 for (int i = 0; i < count; i++)
472 {
474 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
476 {
479 }
480 }
481
483 #ifdef DEVELOPER
484 if (IsCLIParam("catchingLogs"))
485 {
486 //Print("********************");
487 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
488 }
489 #endif
491
492 #ifdef DEVELOPER
493 if (IsCLIParam("catchingLogs"))
494 {
495 float dbgProb;
497 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
498 }
499 #endif
500 }
501
502 override bool ModifySignalProbability(inout float probability)
503 {
505
506 return true;
507 }
508
509 void RemoveBait()
510 {
511 if (m_Bait)
512 m_Bait.DeleteSafe();
513 }
514
515 void ReduceBaitQty(float qtyNorm)
516 {
517 if (m_Bait)
518 {
519 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
520 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
521 else
522 m_Bait.DeleteSafe();
523 }
524 }
525}
526
528{
529 override protected void InitCatchMethodMask()
530 {
532 }
533}
534
536{
537 override protected void InitCatchMethodMask()
538 {
540 }
541}
542
544{
545 override protected void InitCatchMethodMask()
546 {
548 }
549}

Используется в InitCatchingItemData().

◆ ModifySignalProbability()

override bool ModifySignalProbability ( inout float probability)
protected
465 : CatchingContextBase
466{
470
471 protected float m_CumulativeTrappingSuccess;
472 protected int m_AttemptsCount;
473 protected ItemBase m_Bait;
474
475 override protected void DeserializeData(Param par)
476 {
478 if (Class.CastTo(p,par))
479 {
480 m_MainItem = p.param1;
481 m_AttemptsCount = p.param2;
482 }
483 }
484
485 override protected void CreateResultDataStructure()
486 {
488
489 super.CreateResultDataStructure();
490 }
491
492 override protected void ClearCatchingItemData()
493 {
494 super.ClearCatchingItemData();
495
497 m_QualityBaseMod = 0.0;
500 }
501
502 override protected void InitItemValues(EntityAI item)
503 {
504 //skip ruined or deleted items entirely
505 if (item.IsRuined() || item.IsSetForDeletion())
506 return;
507
508 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
509 if (GetGame().ConfigIsExisting(path))
510 {
511 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
512 {
515 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
516 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
517 int count = CachedObjectsArrays.ARRAY_INT.Count();
519 {
520 int key;
521 float value;
522 for (int i = 0; i < count; i++)
523 {
526 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
527 {
529 }
530 }
531 }
532 else
533 {
534 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
535 }
536 }
537 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
538 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
539 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
540 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
541 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
542 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
543 }
544 }
545
548 {
549 float ret = 1.0;
550 ItemBase ib;
551 if (Class.CastTo(ib,item))
552 {
553 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
554 }
555
556 return ret;
557 }
558
559 override protected void InitCatchEnviroMask()
560 {
561 vector pos = m_MainItem.GetPosition();
562 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
564 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
566 else
568 }
569
570 override protected void Init(Param par)
571 {
572 super.Init(par);
573
575 }
576
577 override protected void SetupInitialTypes()
578 {
579 #ifdef DEVELOPER
580 if (IsCLIParam("catchingLogs"))
581 {
582 Print("********************"); //just for debug purposes to track the start
583 Print("dbgTrapz | START");
584 Print("********************");
585 }
586 #endif
587
588 super.SetupInitialTypes();
589
590 #ifdef DEVELOPER
591 if (IsCLIParam("catchingLogs"))
592 {
593 Print("***"); //just for debug purposes to track the start
594 }
595 #endif
596 }
597
598 void UpdateDataAndMasks()
599 {
601 InitCatchMethodMask(); //bait check
602 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
605 }
606
608 {
610 return GetCatchEnviroMask();
611 }
612
613 void SetTrapEnviroMask(int value)
614 {
616 }
617
620 {
621 m_Bait = null;
622 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
623 {
625 if (dta)
626 {
627 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
630 }
631 else
632 ErrorEx("failed to acquire BaitData from type: " + type);
633 }
634
635 #ifdef DEVELOPER
636 if (IsCLIParam("catchingLogs"))
637 {
638 if (m_Bait)
639 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
640 else
641 Print("dbgTrapz | UpdateUsedBait to 'null'!");
642 }
643 #endif
644 }
645
647 {
648 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
649 int usedType = -1;
650 float probability = -1;
651 float highestProbability = 0.0;
652 int count = m_BaitCompatibilityMap.Count();
653 for (int i = 0; i < count; i++)
654 {
656 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
658 {
661 }
662 }
663
665 #ifdef DEVELOPER
666 if (IsCLIParam("catchingLogs"))
667 {
668 //Print("********************");
669 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
670 }
671 #endif
673
674 #ifdef DEVELOPER
675 if (IsCLIParam("catchingLogs"))
676 {
677 float dbgProb;
679 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
680 }
681 #endif
682 }
683
684 override bool ModifySignalProbability(inout float probability)
685 {
687
688 return true;
689 }
690
691 void RemoveBait()
692 {
693 if (m_Bait)
694 m_Bait.DeleteSafe();
695 }
696
697 void ReduceBaitQty(float qtyNorm)
698 {
699 if (m_Bait)
700 {
701 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
702 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
703 else
704 m_Bait.DeleteSafe();
705 }
706 }
707}
708
710{
711 override protected void InitCatchMethodMask()
712 {
714 }
715}
716
718{
719 override protected void InitCatchMethodMask()
720 {
722 }
723}
724
726{
727 override protected void InitCatchMethodMask()
728 {
730 }
731}

◆ ReduceBaitQty()

void ReduceBaitQty ( float qtyNorm)
protected
478 : CatchingContextBase
479{
483
484 protected float m_CumulativeTrappingSuccess;
485 protected int m_AttemptsCount;
486 protected ItemBase m_Bait;
487
488 override protected void DeserializeData(Param par)
489 {
491 if (Class.CastTo(p,par))
492 {
493 m_MainItem = p.param1;
494 m_AttemptsCount = p.param2;
495 }
496 }
497
498 override protected void CreateResultDataStructure()
499 {
501
502 super.CreateResultDataStructure();
503 }
504
505 override protected void ClearCatchingItemData()
506 {
507 super.ClearCatchingItemData();
508
510 m_QualityBaseMod = 0.0;
513 }
514
515 override protected void InitItemValues(EntityAI item)
516 {
517 //skip ruined or deleted items entirely
518 if (item.IsRuined() || item.IsSetForDeletion())
519 return;
520
521 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
522 if (GetGame().ConfigIsExisting(path))
523 {
524 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
525 {
528 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
529 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
530 int count = CachedObjectsArrays.ARRAY_INT.Count();
532 {
533 int key;
534 float value;
535 for (int i = 0; i < count; i++)
536 {
539 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
540 {
542 }
543 }
544 }
545 else
546 {
547 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
548 }
549 }
550 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
551 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
552 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
553 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
554 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
555 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
556 }
557 }
558
561 {
562 float ret = 1.0;
563 ItemBase ib;
564 if (Class.CastTo(ib,item))
565 {
566 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
567 }
568
569 return ret;
570 }
571
572 override protected void InitCatchEnviroMask()
573 {
574 vector pos = m_MainItem.GetPosition();
575 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
577 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
579 else
581 }
582
583 override protected void Init(Param par)
584 {
585 super.Init(par);
586
588 }
589
590 override protected void SetupInitialTypes()
591 {
592 #ifdef DEVELOPER
593 if (IsCLIParam("catchingLogs"))
594 {
595 Print("********************"); //just for debug purposes to track the start
596 Print("dbgTrapz | START");
597 Print("********************");
598 }
599 #endif
600
601 super.SetupInitialTypes();
602
603 #ifdef DEVELOPER
604 if (IsCLIParam("catchingLogs"))
605 {
606 Print("***"); //just for debug purposes to track the start
607 }
608 #endif
609 }
610
611 void UpdateDataAndMasks()
612 {
614 InitCatchMethodMask(); //bait check
615 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
618 }
619
621 {
623 return GetCatchEnviroMask();
624 }
625
626 void SetTrapEnviroMask(int value)
627 {
629 }
630
633 {
634 m_Bait = null;
635 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
636 {
638 if (dta)
639 {
640 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
643 }
644 else
645 ErrorEx("failed to acquire BaitData from type: " + type);
646 }
647
648 #ifdef DEVELOPER
649 if (IsCLIParam("catchingLogs"))
650 {
651 if (m_Bait)
652 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
653 else
654 Print("dbgTrapz | UpdateUsedBait to 'null'!");
655 }
656 #endif
657 }
658
660 {
661 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
662 int usedType = -1;
663 float probability = -1;
664 float highestProbability = 0.0;
665 int count = m_BaitCompatibilityMap.Count();
666 for (int i = 0; i < count; i++)
667 {
669 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
671 {
674 }
675 }
676
678 #ifdef DEVELOPER
679 if (IsCLIParam("catchingLogs"))
680 {
681 //Print("********************");
682 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
683 }
684 #endif
686
687 #ifdef DEVELOPER
688 if (IsCLIParam("catchingLogs"))
689 {
690 float dbgProb;
692 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
693 }
694 #endif
695 }
696
697 override bool ModifySignalProbability(inout float probability)
698 {
700
701 return true;
702 }
703
704 void RemoveBait()
705 {
706 if (m_Bait)
707 m_Bait.DeleteSafe();
708 }
709
710 void ReduceBaitQty(float qtyNorm)
711 {
712 if (m_Bait)
713 {
714 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
715 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
716 else
717 m_Bait.DeleteSafe();
718 }
719 }
720}
721
723{
724 override protected void InitCatchMethodMask()
725 {
727 }
728}
729
731{
732 override protected void InitCatchMethodMask()
733 {
735 }
736}
737
739{
740 override protected void InitCatchMethodMask()
741 {
743 }
744}

◆ RemoveBait()

void RemoveBait ( )
protected
472 : CatchingContextBase
473{
477
478 protected float m_CumulativeTrappingSuccess;
479 protected int m_AttemptsCount;
480 protected ItemBase m_Bait;
481
482 override protected void DeserializeData(Param par)
483 {
485 if (Class.CastTo(p,par))
486 {
487 m_MainItem = p.param1;
488 m_AttemptsCount = p.param2;
489 }
490 }
491
492 override protected void CreateResultDataStructure()
493 {
495
496 super.CreateResultDataStructure();
497 }
498
499 override protected void ClearCatchingItemData()
500 {
501 super.ClearCatchingItemData();
502
504 m_QualityBaseMod = 0.0;
507 }
508
509 override protected void InitItemValues(EntityAI item)
510 {
511 //skip ruined or deleted items entirely
512 if (item.IsRuined() || item.IsSetForDeletion())
513 return;
514
515 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
516 if (GetGame().ConfigIsExisting(path))
517 {
518 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
519 {
522 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
523 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
524 int count = CachedObjectsArrays.ARRAY_INT.Count();
526 {
527 int key;
528 float value;
529 for (int i = 0; i < count; i++)
530 {
533 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
534 {
536 }
537 }
538 }
539 else
540 {
541 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
542 }
543 }
544 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
545 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
546 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
547 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
548 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
549 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
550 }
551 }
552
555 {
556 float ret = 1.0;
557 ItemBase ib;
558 if (Class.CastTo(ib,item))
559 {
560 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
561 }
562
563 return ret;
564 }
565
566 override protected void InitCatchEnviroMask()
567 {
568 vector pos = m_MainItem.GetPosition();
569 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
571 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
573 else
575 }
576
577 override protected void Init(Param par)
578 {
579 super.Init(par);
580
582 }
583
584 override protected void SetupInitialTypes()
585 {
586 #ifdef DEVELOPER
587 if (IsCLIParam("catchingLogs"))
588 {
589 Print("********************"); //just for debug purposes to track the start
590 Print("dbgTrapz | START");
591 Print("********************");
592 }
593 #endif
594
595 super.SetupInitialTypes();
596
597 #ifdef DEVELOPER
598 if (IsCLIParam("catchingLogs"))
599 {
600 Print("***"); //just for debug purposes to track the start
601 }
602 #endif
603 }
604
605 void UpdateDataAndMasks()
606 {
608 InitCatchMethodMask(); //bait check
609 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
612 }
613
615 {
617 return GetCatchEnviroMask();
618 }
619
620 void SetTrapEnviroMask(int value)
621 {
623 }
624
627 {
628 m_Bait = null;
629 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
630 {
632 if (dta)
633 {
634 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
637 }
638 else
639 ErrorEx("failed to acquire BaitData from type: " + type);
640 }
641
642 #ifdef DEVELOPER
643 if (IsCLIParam("catchingLogs"))
644 {
645 if (m_Bait)
646 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
647 else
648 Print("dbgTrapz | UpdateUsedBait to 'null'!");
649 }
650 #endif
651 }
652
654 {
655 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
656 int usedType = -1;
657 float probability = -1;
658 float highestProbability = 0.0;
659 int count = m_BaitCompatibilityMap.Count();
660 for (int i = 0; i < count; i++)
661 {
663 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
665 {
668 }
669 }
670
672 #ifdef DEVELOPER
673 if (IsCLIParam("catchingLogs"))
674 {
675 //Print("********************");
676 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
677 }
678 #endif
680
681 #ifdef DEVELOPER
682 if (IsCLIParam("catchingLogs"))
683 {
684 float dbgProb;
686 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
687 }
688 #endif
689 }
690
691 override bool ModifySignalProbability(inout float probability)
692 {
694
695 return true;
696 }
697
698 void RemoveBait()
699 {
700 if (m_Bait)
701 m_Bait.DeleteSafe();
702 }
703
704 void ReduceBaitQty(float qtyNorm)
705 {
706 if (m_Bait)
707 {
708 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
709 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
710 else
711 m_Bait.DeleteSafe();
712 }
713 }
714}
715
717{
718 override protected void InitCatchMethodMask()
719 {
721 }
722}
723
725{
726 override protected void InitCatchMethodMask()
727 {
729 }
730}
731
733{
734 override protected void InitCatchMethodMask()
735 {
737 }
738}

◆ SetTrapEnviroMask()

void SetTrapEnviroMask ( int value)
protected
394 : CatchingContextBase
395{
399
400 protected float m_CumulativeTrappingSuccess;
401 protected int m_AttemptsCount;
402 protected ItemBase m_Bait;
403
404 override protected void DeserializeData(Param par)
405 {
407 if (Class.CastTo(p,par))
408 {
409 m_MainItem = p.param1;
410 m_AttemptsCount = p.param2;
411 }
412 }
413
414 override protected void CreateResultDataStructure()
415 {
417
418 super.CreateResultDataStructure();
419 }
420
421 override protected void ClearCatchingItemData()
422 {
423 super.ClearCatchingItemData();
424
426 m_QualityBaseMod = 0.0;
429 }
430
431 override protected void InitItemValues(EntityAI item)
432 {
433 //skip ruined or deleted items entirely
434 if (item.IsRuined() || item.IsSetForDeletion())
435 return;
436
437 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
438 if (GetGame().ConfigIsExisting(path))
439 {
440 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
441 {
444 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
445 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
446 int count = CachedObjectsArrays.ARRAY_INT.Count();
448 {
449 int key;
450 float value;
451 for (int i = 0; i < count; i++)
452 {
455 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
456 {
458 }
459 }
460 }
461 else
462 {
463 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
464 }
465 }
466 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
467 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
468 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
469 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
470 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
471 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
472 }
473 }
474
477 {
478 float ret = 1.0;
479 ItemBase ib;
480 if (Class.CastTo(ib,item))
481 {
482 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
483 }
484
485 return ret;
486 }
487
488 override protected void InitCatchEnviroMask()
489 {
490 vector pos = m_MainItem.GetPosition();
491 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
493 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
495 else
497 }
498
499 override protected void Init(Param par)
500 {
501 super.Init(par);
502
504 }
505
506 override protected void SetupInitialTypes()
507 {
508 #ifdef DEVELOPER
509 if (IsCLIParam("catchingLogs"))
510 {
511 Print("********************"); //just for debug purposes to track the start
512 Print("dbgTrapz | START");
513 Print("********************");
514 }
515 #endif
516
517 super.SetupInitialTypes();
518
519 #ifdef DEVELOPER
520 if (IsCLIParam("catchingLogs"))
521 {
522 Print("***"); //just for debug purposes to track the start
523 }
524 #endif
525 }
526
527 void UpdateDataAndMasks()
528 {
530 InitCatchMethodMask(); //bait check
531 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
534 }
535
537 {
539 return GetCatchEnviroMask();
540 }
541
542 void SetTrapEnviroMask(int value)
543 {
545 }
546
549 {
550 m_Bait = null;
551 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
552 {
554 if (dta)
555 {
556 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
559 }
560 else
561 ErrorEx("failed to acquire BaitData from type: " + type);
562 }
563
564 #ifdef DEVELOPER
565 if (IsCLIParam("catchingLogs"))
566 {
567 if (m_Bait)
568 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
569 else
570 Print("dbgTrapz | UpdateUsedBait to 'null'!");
571 }
572 #endif
573 }
574
576 {
577 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
578 int usedType = -1;
579 float probability = -1;
580 float highestProbability = 0.0;
581 int count = m_BaitCompatibilityMap.Count();
582 for (int i = 0; i < count; i++)
583 {
585 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
587 {
590 }
591 }
592
594 #ifdef DEVELOPER
595 if (IsCLIParam("catchingLogs"))
596 {
597 //Print("********************");
598 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
599 }
600 #endif
602
603 #ifdef DEVELOPER
604 if (IsCLIParam("catchingLogs"))
605 {
606 float dbgProb;
608 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
609 }
610 #endif
611 }
612
613 override bool ModifySignalProbability(inout float probability)
614 {
616
617 return true;
618 }
619
620 void RemoveBait()
621 {
622 if (m_Bait)
623 m_Bait.DeleteSafe();
624 }
625
626 void ReduceBaitQty(float qtyNorm)
627 {
628 if (m_Bait)
629 {
630 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
631 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
632 else
633 m_Bait.DeleteSafe();
634 }
635 }
636}
637
639{
640 override protected void InitCatchMethodMask()
641 {
643 }
644}
645
647{
648 override protected void InitCatchMethodMask()
649 {
651 }
652}
653
655{
656 override protected void InitCatchMethodMask()
657 {
659 }
660}

Используется в ItemBase::SetActive().

◆ SetupInitialTypes()

void SetupInitialTypes ( )
protected
358 : CatchingContextBase
359{
363
364 protected float m_CumulativeTrappingSuccess;
365 protected int m_AttemptsCount;
366 protected ItemBase m_Bait;
367
368 override protected void DeserializeData(Param par)
369 {
371 if (Class.CastTo(p,par))
372 {
373 m_MainItem = p.param1;
374 m_AttemptsCount = p.param2;
375 }
376 }
377
378 override protected void CreateResultDataStructure()
379 {
381
382 super.CreateResultDataStructure();
383 }
384
385 override protected void ClearCatchingItemData()
386 {
387 super.ClearCatchingItemData();
388
390 m_QualityBaseMod = 0.0;
393 }
394
395 override protected void InitItemValues(EntityAI item)
396 {
397 //skip ruined or deleted items entirely
398 if (item.IsRuined() || item.IsSetForDeletion())
399 return;
400
401 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
402 if (GetGame().ConfigIsExisting(path))
403 {
404 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
405 {
408 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
409 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
410 int count = CachedObjectsArrays.ARRAY_INT.Count();
412 {
413 int key;
414 float value;
415 for (int i = 0; i < count; i++)
416 {
419 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
420 {
422 }
423 }
424 }
425 else
426 {
427 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
428 }
429 }
430 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
431 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
432 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
433 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
434 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
435 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
436 }
437 }
438
441 {
442 float ret = 1.0;
443 ItemBase ib;
444 if (Class.CastTo(ib,item))
445 {
446 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
447 }
448
449 return ret;
450 }
451
452 override protected void InitCatchEnviroMask()
453 {
454 vector pos = m_MainItem.GetPosition();
455 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
457 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
459 else
461 }
462
463 override protected void Init(Param par)
464 {
465 super.Init(par);
466
468 }
469
470 override protected void SetupInitialTypes()
471 {
472 #ifdef DEVELOPER
473 if (IsCLIParam("catchingLogs"))
474 {
475 Print("********************"); //just for debug purposes to track the start
476 Print("dbgTrapz | START");
477 Print("********************");
478 }
479 #endif
480
481 super.SetupInitialTypes();
482
483 #ifdef DEVELOPER
484 if (IsCLIParam("catchingLogs"))
485 {
486 Print("***"); //just for debug purposes to track the start
487 }
488 #endif
489 }
490
491 void UpdateDataAndMasks()
492 {
494 InitCatchMethodMask(); //bait check
495 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
498 }
499
501 {
503 return GetCatchEnviroMask();
504 }
505
506 void SetTrapEnviroMask(int value)
507 {
509 }
510
513 {
514 m_Bait = null;
515 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
516 {
518 if (dta)
519 {
520 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
523 }
524 else
525 ErrorEx("failed to acquire BaitData from type: " + type);
526 }
527
528 #ifdef DEVELOPER
529 if (IsCLIParam("catchingLogs"))
530 {
531 if (m_Bait)
532 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
533 else
534 Print("dbgTrapz | UpdateUsedBait to 'null'!");
535 }
536 #endif
537 }
538
540 {
541 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
542 int usedType = -1;
543 float probability = -1;
544 float highestProbability = 0.0;
545 int count = m_BaitCompatibilityMap.Count();
546 for (int i = 0; i < count; i++)
547 {
549 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
551 {
554 }
555 }
556
558 #ifdef DEVELOPER
559 if (IsCLIParam("catchingLogs"))
560 {
561 //Print("********************");
562 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
563 }
564 #endif
566
567 #ifdef DEVELOPER
568 if (IsCLIParam("catchingLogs"))
569 {
570 float dbgProb;
572 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
573 }
574 #endif
575 }
576
577 override bool ModifySignalProbability(inout float probability)
578 {
580
581 return true;
582 }
583
584 void RemoveBait()
585 {
586 if (m_Bait)
587 m_Bait.DeleteSafe();
588 }
589
590 void ReduceBaitQty(float qtyNorm)
591 {
592 if (m_Bait)
593 {
594 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
595 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
596 else
597 m_Bait.DeleteSafe();
598 }
599 }
600}
601
603{
604 override protected void InitCatchMethodMask()
605 {
607 }
608}
609
611{
612 override protected void InitCatchMethodMask()
613 {
615 }
616}
617
619{
620 override protected void InitCatchMethodMask()
621 {
623 }
624}

◆ UpdateBaseProbability()

override void UpdateBaseProbability ( YieldItemBase yItem)
protected

updates base probability when catching the specific item (some context subclasses only)

427 : CatchingContextBase
428{
432
433 protected float m_CumulativeTrappingSuccess;
434 protected int m_AttemptsCount;
435 protected ItemBase m_Bait;
436
437 override protected void DeserializeData(Param par)
438 {
440 if (Class.CastTo(p,par))
441 {
442 m_MainItem = p.param1;
443 m_AttemptsCount = p.param2;
444 }
445 }
446
447 override protected void CreateResultDataStructure()
448 {
450
451 super.CreateResultDataStructure();
452 }
453
454 override protected void ClearCatchingItemData()
455 {
456 super.ClearCatchingItemData();
457
459 m_QualityBaseMod = 0.0;
462 }
463
464 override protected void InitItemValues(EntityAI item)
465 {
466 //skip ruined or deleted items entirely
467 if (item.IsRuined() || item.IsSetForDeletion())
468 return;
469
470 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
471 if (GetGame().ConfigIsExisting(path))
472 {
473 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
474 {
477 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
478 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
479 int count = CachedObjectsArrays.ARRAY_INT.Count();
481 {
482 int key;
483 float value;
484 for (int i = 0; i < count; i++)
485 {
488 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
489 {
491 }
492 }
493 }
494 else
495 {
496 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
497 }
498 }
499 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
500 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
501 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
502 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
503 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
504 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
505 }
506 }
507
510 {
511 float ret = 1.0;
512 ItemBase ib;
513 if (Class.CastTo(ib,item))
514 {
515 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
516 }
517
518 return ret;
519 }
520
521 override protected void InitCatchEnviroMask()
522 {
523 vector pos = m_MainItem.GetPosition();
524 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
526 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
528 else
530 }
531
532 override protected void Init(Param par)
533 {
534 super.Init(par);
535
537 }
538
539 override protected void SetupInitialTypes()
540 {
541 #ifdef DEVELOPER
542 if (IsCLIParam("catchingLogs"))
543 {
544 Print("********************"); //just for debug purposes to track the start
545 Print("dbgTrapz | START");
546 Print("********************");
547 }
548 #endif
549
550 super.SetupInitialTypes();
551
552 #ifdef DEVELOPER
553 if (IsCLIParam("catchingLogs"))
554 {
555 Print("***"); //just for debug purposes to track the start
556 }
557 #endif
558 }
559
560 void UpdateDataAndMasks()
561 {
563 InitCatchMethodMask(); //bait check
564 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
567 }
568
570 {
572 return GetCatchEnviroMask();
573 }
574
575 void SetTrapEnviroMask(int value)
576 {
578 }
579
582 {
583 m_Bait = null;
584 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
585 {
587 if (dta)
588 {
589 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
592 }
593 else
594 ErrorEx("failed to acquire BaitData from type: " + type);
595 }
596
597 #ifdef DEVELOPER
598 if (IsCLIParam("catchingLogs"))
599 {
600 if (m_Bait)
601 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
602 else
603 Print("dbgTrapz | UpdateUsedBait to 'null'!");
604 }
605 #endif
606 }
607
609 {
610 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
611 int usedType = -1;
612 float probability = -1;
613 float highestProbability = 0.0;
614 int count = m_BaitCompatibilityMap.Count();
615 for (int i = 0; i < count; i++)
616 {
618 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
620 {
623 }
624 }
625
627 #ifdef DEVELOPER
628 if (IsCLIParam("catchingLogs"))
629 {
630 //Print("********************");
631 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
632 }
633 #endif
635
636 #ifdef DEVELOPER
637 if (IsCLIParam("catchingLogs"))
638 {
639 float dbgProb;
641 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
642 }
643 #endif
644 }
645
646 override bool ModifySignalProbability(inout float probability)
647 {
649
650 return true;
651 }
652
653 void RemoveBait()
654 {
655 if (m_Bait)
656 m_Bait.DeleteSafe();
657 }
658
659 void ReduceBaitQty(float qtyNorm)
660 {
661 if (m_Bait)
662 {
663 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
664 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
665 else
666 m_Bait.DeleteSafe();
667 }
668 }
669}
670
672{
673 override protected void InitCatchMethodMask()
674 {
676 }
677}
678
680{
681 override protected void InitCatchMethodMask()
682 {
684 }
685}
686
688{
689 override protected void InitCatchMethodMask()
690 {
692 }
693}

Используется в GenerateResult().

◆ UpdateDataAndMasks()

void UpdateDataAndMasks ( )
protected
379 : CatchingContextBase
380{
384
385 protected float m_CumulativeTrappingSuccess;
386 protected int m_AttemptsCount;
387 protected ItemBase m_Bait;
388
389 override protected void DeserializeData(Param par)
390 {
392 if (Class.CastTo(p,par))
393 {
394 m_MainItem = p.param1;
395 m_AttemptsCount = p.param2;
396 }
397 }
398
399 override protected void CreateResultDataStructure()
400 {
402
403 super.CreateResultDataStructure();
404 }
405
406 override protected void ClearCatchingItemData()
407 {
408 super.ClearCatchingItemData();
409
411 m_QualityBaseMod = 0.0;
414 }
415
416 override protected void InitItemValues(EntityAI item)
417 {
418 //skip ruined or deleted items entirely
419 if (item.IsRuined() || item.IsSetForDeletion())
420 return;
421
422 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
423 if (GetGame().ConfigIsExisting(path))
424 {
425 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
426 {
429 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
430 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
431 int count = CachedObjectsArrays.ARRAY_INT.Count();
433 {
434 int key;
435 float value;
436 for (int i = 0; i < count; i++)
437 {
440 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
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"))
452 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
453 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
454 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
455 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
456 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
457 }
458 }
459
462 {
463 float ret = 1.0;
464 ItemBase ib;
465 if (Class.CastTo(ib,item))
466 {
467 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
468 }
469
470 return ret;
471 }
472
473 override protected void InitCatchEnviroMask()
474 {
475 vector pos = m_MainItem.GetPosition();
476 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
478 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
480 else
482 }
483
484 override protected void Init(Param par)
485 {
486 super.Init(par);
487
489 }
490
491 override protected void SetupInitialTypes()
492 {
493 #ifdef DEVELOPER
494 if (IsCLIParam("catchingLogs"))
495 {
496 Print("********************"); //just for debug purposes to track the start
497 Print("dbgTrapz | START");
498 Print("********************");
499 }
500 #endif
501
502 super.SetupInitialTypes();
503
504 #ifdef DEVELOPER
505 if (IsCLIParam("catchingLogs"))
506 {
507 Print("***"); //just for debug purposes to track the start
508 }
509 #endif
510 }
511
512 void UpdateDataAndMasks()
513 {
515 InitCatchMethodMask(); //bait check
516 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
519 }
520
522 {
524 return GetCatchEnviroMask();
525 }
526
527 void SetTrapEnviroMask(int value)
528 {
530 }
531
534 {
535 m_Bait = null;
536 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
537 {
539 if (dta)
540 {
541 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
544 }
545 else
546 ErrorEx("failed to acquire BaitData from type: " + type);
547 }
548
549 #ifdef DEVELOPER
550 if (IsCLIParam("catchingLogs"))
551 {
552 if (m_Bait)
553 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
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;
566 int count = m_BaitCompatibilityMap.Count();
567 for (int i = 0; i < count; i++)
568 {
570 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
572 {
575 }
576 }
577
579 #ifdef DEVELOPER
580 if (IsCLIParam("catchingLogs"))
581 {
582 //Print("********************");
583 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
584 }
585 #endif
587
588 #ifdef DEVELOPER
589 if (IsCLIParam("catchingLogs"))
590 {
591 float dbgProb;
593 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
594 }
595 #endif
596 }
597
598 override bool ModifySignalProbability(inout float probability)
599 {
601
602 return true;
603 }
604
605 void RemoveBait()
606 {
607 if (m_Bait)
608 m_Bait.DeleteSafe();
609 }
610
611 void ReduceBaitQty(float qtyNorm)
612 {
613 if (m_Bait)
614 {
615 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
616 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
617 else
618 m_Bait.DeleteSafe();
619 }
620 }
621}
622
624{
625 override protected void InitCatchMethodMask()
626 {
628 }
629}
630
632{
633 override protected void InitCatchMethodMask()
634 {
636 }
637}
638
640{
641 override protected void InitCatchMethodMask()
642 {
644 }
645}

◆ UpdateTrapEnviroMask()

int UpdateTrapEnviroMask ( )
protected
388 : CatchingContextBase
389{
393
394 protected float m_CumulativeTrappingSuccess;
395 protected int m_AttemptsCount;
396 protected ItemBase m_Bait;
397
398 override protected void DeserializeData(Param par)
399 {
401 if (Class.CastTo(p,par))
402 {
403 m_MainItem = p.param1;
404 m_AttemptsCount = p.param2;
405 }
406 }
407
408 override protected void CreateResultDataStructure()
409 {
411
412 super.CreateResultDataStructure();
413 }
414
415 override protected void ClearCatchingItemData()
416 {
417 super.ClearCatchingItemData();
418
420 m_QualityBaseMod = 0.0;
423 }
424
425 override protected void InitItemValues(EntityAI item)
426 {
427 //skip ruined or deleted items entirely
428 if (item.IsRuined() || item.IsSetForDeletion())
429 return;
430
431 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
432 if (GetGame().ConfigIsExisting(path))
433 {
434 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
435 {
438 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
439 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
440 int count = CachedObjectsArrays.ARRAY_INT.Count();
442 {
443 int key;
444 float value;
445 for (int i = 0; i < count; i++)
446 {
449 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
450 {
452 }
453 }
454 }
455 else
456 {
457 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
458 }
459 }
460 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
461 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
462 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
463 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
464 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
465 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
466 }
467 }
468
471 {
472 float ret = 1.0;
473 ItemBase ib;
474 if (Class.CastTo(ib,item))
475 {
476 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
477 }
478
479 return ret;
480 }
481
482 override protected void InitCatchEnviroMask()
483 {
484 vector pos = m_MainItem.GetPosition();
485 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
487 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
489 else
491 }
492
493 override protected void Init(Param par)
494 {
495 super.Init(par);
496
498 }
499
500 override protected void SetupInitialTypes()
501 {
502 #ifdef DEVELOPER
503 if (IsCLIParam("catchingLogs"))
504 {
505 Print("********************"); //just for debug purposes to track the start
506 Print("dbgTrapz | START");
507 Print("********************");
508 }
509 #endif
510
511 super.SetupInitialTypes();
512
513 #ifdef DEVELOPER
514 if (IsCLIParam("catchingLogs"))
515 {
516 Print("***"); //just for debug purposes to track the start
517 }
518 #endif
519 }
520
521 void UpdateDataAndMasks()
522 {
524 InitCatchMethodMask(); //bait check
525 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
528 }
529
531 {
533 return GetCatchEnviroMask();
534 }
535
536 void SetTrapEnviroMask(int value)
537 {
539 }
540
543 {
544 m_Bait = null;
545 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
546 {
548 if (dta)
549 {
550 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
553 }
554 else
555 ErrorEx("failed to acquire BaitData from type: " + type);
556 }
557
558 #ifdef DEVELOPER
559 if (IsCLIParam("catchingLogs"))
560 {
561 if (m_Bait)
562 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
563 else
564 Print("dbgTrapz | UpdateUsedBait to 'null'!");
565 }
566 #endif
567 }
568
570 {
571 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
572 int usedType = -1;
573 float probability = -1;
574 float highestProbability = 0.0;
575 int count = m_BaitCompatibilityMap.Count();
576 for (int i = 0; i < count; i++)
577 {
579 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
581 {
584 }
585 }
586
588 #ifdef DEVELOPER
589 if (IsCLIParam("catchingLogs"))
590 {
591 //Print("********************");
592 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
593 }
594 #endif
596
597 #ifdef DEVELOPER
598 if (IsCLIParam("catchingLogs"))
599 {
600 float dbgProb;
602 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
603 }
604 #endif
605 }
606
607 override bool ModifySignalProbability(inout float probability)
608 {
610
611 return true;
612 }
613
614 void RemoveBait()
615 {
616 if (m_Bait)
617 m_Bait.DeleteSafe();
618 }
619
620 void ReduceBaitQty(float qtyNorm)
621 {
622 if (m_Bait)
623 {
624 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
625 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
626 else
627 m_Bait.DeleteSafe();
628 }
629 }
630}
631
633{
634 override protected void InitCatchMethodMask()
635 {
637 }
638}
639
641{
642 override protected void InitCatchMethodMask()
643 {
645 }
646}
647
649{
650 override protected void InitCatchMethodMask()
651 {
653 }
654}

Используется в ItemBase::OnPlacementComplete() и ItemBase::SetActive().

◆ UpdateUsedBait()

void UpdateUsedBait ( ECatchingBaitCategories type)
protected

if non-empty bait type is used, some 'Bait' attachment is picked as an active bait (currently no direct link between item and sensitivity-weighted target probability)

400 : CatchingContextBase
401{
405
406 protected float m_CumulativeTrappingSuccess;
407 protected int m_AttemptsCount;
408 protected ItemBase m_Bait;
409
410 override protected void DeserializeData(Param par)
411 {
413 if (Class.CastTo(p,par))
414 {
415 m_MainItem = p.param1;
416 m_AttemptsCount = p.param2;
417 }
418 }
419
420 override protected void CreateResultDataStructure()
421 {
423
424 super.CreateResultDataStructure();
425 }
426
427 override protected void ClearCatchingItemData()
428 {
429 super.ClearCatchingItemData();
430
432 m_QualityBaseMod = 0.0;
435 }
436
437 override protected void InitItemValues(EntityAI item)
438 {
439 //skip ruined or deleted items entirely
440 if (item.IsRuined() || item.IsSetForDeletion())
441 return;
442
443 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " Trapping";
444 if (GetGame().ConfigIsExisting(path))
445 {
446 if (GetGame().ConfigIsExisting(path + " baitTypes") && GetGame().ConfigIsExisting(path + " baitTypeChances"))
447 {
450 GetGame().ConfigGetIntArray(path + " baitTypes",CachedObjectsArrays.ARRAY_INT);
451 GetGame().ConfigGetFloatArray(path + " baitTypeChances",CachedObjectsArrays.ARRAY_FLOAT);
452 int count = CachedObjectsArrays.ARRAY_INT.Count();
454 {
455 int key;
456 float value;
457 for (int i = 0; i < count; i++)
458 {
461 if (!m_BaitCompatibilityMap.Contains(key) || (m_BaitCompatibilityMap.Get(key).m_BaseProbability < value))
462 {
464 }
465 }
466 }
467 else
468 {
469 ErrorEx("'baitTypes' and 'baitTypeChances' arrray counts of " + item.GetType() + " do not match!",ErrorExSeverity.INFO);
470 }
471 }
472 if (GetGame().ConfigIsExisting(path + " resultQuantityBaseMod"))
473 m_QualityBaseMod += GetGame().ConfigGetFloat(path + " resultQuantityBaseMod");
474 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMin"))
475 m_QualityDispersionMinMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMin");
476 if (GetGame().ConfigIsExisting(path + " resultQuantityDispersionMax"))
477 m_QualityDispersionMaxMod += GetGame().ConfigGetFloat(path + " resultQuantityDispersionMax");
478 }
479 }
480
483 {
484 float ret = 1.0;
485 ItemBase ib;
486 if (Class.CastTo(ib,item))
487 {
488 //ret *= ib.GetBaitEffectivity(); //disconnected for the Time Being
489 }
490
491 return ret;
492 }
493
494 override protected void InitCatchEnviroMask()
495 {
496 vector pos = m_MainItem.GetPosition();
497 if (GetGame().SurfaceIsSea(pos[0], pos[2]))
499 else if (GetGame().SurfaceIsPond( pos[0], pos[2]))
501 else
503 }
504
505 override protected void Init(Param par)
506 {
507 super.Init(par);
508
510 }
511
512 override protected void SetupInitialTypes()
513 {
514 #ifdef DEVELOPER
515 if (IsCLIParam("catchingLogs"))
516 {
517 Print("********************"); //just for debug purposes to track the start
518 Print("dbgTrapz | START");
519 Print("********************");
520 }
521 #endif
522
523 super.SetupInitialTypes();
524
525 #ifdef DEVELOPER
526 if (IsCLIParam("catchingLogs"))
527 {
528 Print("***"); //just for debug purposes to track the start
529 }
530 #endif
531 }
532
533 void UpdateDataAndMasks()
534 {
536 InitCatchMethodMask(); //bait check
537 //InitCatchEnviroMask(); //skipping, raycasts are unreliable outside network bubbles
540 }
541
543 {
545 return GetCatchEnviroMask();
546 }
547
548 void SetTrapEnviroMask(int value)
549 {
551 }
552
555 {
556 m_Bait = null;
557 if (type != ECatchingBaitCategories.BAIT_TYPE_EMPTY)
558 {
560 if (dta)
561 {
562 ItemBase potentialBait = ItemBase.Cast(dta.m_Owner);
565 }
566 else
567 ErrorEx("failed to acquire BaitData from type: " + type);
568 }
569
570 #ifdef DEVELOPER
571 if (IsCLIParam("catchingLogs"))
572 {
573 if (m_Bait)
574 Print("dbgTrapz | UpdateUsedBait to: " + m_Bait + " | with base bait probability used: " + m_BaitCompatibilityMap.Get(type).m_BaseProbability);
575 else
576 Print("dbgTrapz | UpdateUsedBait to 'null'!");
577 }
578 #endif
579 }
580
582 {
583 int baitType = ECatchingBaitCategories.BAIT_TYPE_EMPTY;
584 int usedType = -1;
585 float probability = -1;
586 float highestProbability = 0.0;
587 int count = m_BaitCompatibilityMap.Count();
588 for (int i = 0; i < count; i++)
589 {
591 probability = m_BaitCompatibilityMap.Get(baitType).m_BaseProbability * yItem.GetBaitTypeSensitivity(baitType);
593 {
596 }
597 }
598
600 #ifdef DEVELOPER
601 if (IsCLIParam("catchingLogs"))
602 {
603 //Print("********************");
604 Print("dbgTrapz | using bait type: " + baitType + " to catch: " + yItem);
605 }
606 #endif
608
609 #ifdef DEVELOPER
610 if (IsCLIParam("catchingLogs"))
611 {
612 float dbgProb;
614 Print("dbgTrapz | starting catching of " + yItem + " | at probability: " + dbgProb + " | with target success: " + m_CumulativeTrappingSuccess);
615 }
616 #endif
617 }
618
619 override bool ModifySignalProbability(inout float probability)
620 {
622
623 return true;
624 }
625
626 void RemoveBait()
627 {
628 if (m_Bait)
629 m_Bait.DeleteSafe();
630 }
631
632 void ReduceBaitQty(float qtyNorm)
633 {
634 if (m_Bait)
635 {
636 if (m_Bait.HasQuantity() && !m_Bait.CanBeSplit())
637 m_Bait.SetQuantityNormalized((m_Bait.GetQuantityNormalized() - qtyNorm));
638 else
639 m_Bait.DeleteSafe();
640 }
641 }
642}
643
645{
646 override protected void InitCatchMethodMask()
647 {
649 }
650}
651
653{
654 override protected void InitCatchMethodMask()
655 {
657 }
658}
659
661{
662 override protected void InitCatchMethodMask()
663 {
665 }
666}

Переменные

◆ m_AttemptsCount

int m_AttemptsCount
protected

◆ m_Bait

ItemBase m_Bait
protected

◆ m_CumulativeTrappingSuccess

m_CumulativeTrappingSuccess
protected

after N attempts, the chance to catch should be this. Only highest one applies. @NOTE: Take care, only way to achieve guaranteed 1.0 chance at the end is to have EVERY chance at 1.0.