trap_smallfish.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. class Trap_SmallFish extends TrapSpawnBase
  2. {
  3. override void InitTrapValues()
  4. {
  5. super.InitTrapValues();
  6. m_DefectRate = 2.5; //Added damage after trap activation
  7. m_InitWaitTimeMin = 120;
  8. m_InitWaitTimeMax = 180;
  9. m_UpdateWaitTime = 30;
  10. m_SpawnUpdateWaitTime = 30;
  11. m_MaxActiveTime = 1200;
  12. m_MinimalDistanceFromPlayersToCatch = 15;
  13. m_AnimationPhaseSet = "inventory";
  14. m_AnimationPhaseTriggered = "placing";
  15. m_AnimationPhaseUsed = "triggered";
  16. }
  17. override void InitCatchingComponent()
  18. {
  19. if (!m_CatchingContext)
  20. {
  21. int updateCount = m_MaxActiveTime/m_UpdateWaitTime;
  22. Param2<EntityAI,int> par = new Param2<EntityAI,int>(this,updateCount);
  23. m_CatchingContext = new CatchingContextTrapFishSmall(par);
  24. }
  25. }
  26. //========================================================
  27. //============= PLACING AND INVENTORY EVENTS =============
  28. //========================================================
  29. override bool IsPlaceableAtPosition( vector position )
  30. {
  31. return IsSurfaceWater( position );
  32. }
  33. override bool CanReceiveAttachment( EntityAI attachment, int slotId )
  34. {
  35. if ( !attachment.IsInherited( Worm ) )
  36. return false;
  37. return super.CanReceiveAttachment( attachment, slotId );
  38. }
  39. #ifdef PLATFORM_WINDOWS
  40. // How one sees the tripwire when in vicinity
  41. override int GetViewIndex()
  42. {
  43. if ( MemoryPointExists( "invView2" ) )
  44. {
  45. InventoryLocation il = new InventoryLocation;
  46. GetInventory().GetCurrentInventoryLocation( il );
  47. InventoryLocationType type = il.GetType();
  48. switch ( type )
  49. {
  50. case InventoryLocationType.CARGO:
  51. {
  52. return 0;
  53. }
  54. case InventoryLocationType.ATTACHMENT:
  55. {
  56. return 1;
  57. }
  58. case InventoryLocationType.HANDS:
  59. {
  60. return 0;
  61. }
  62. case InventoryLocationType.GROUND:
  63. {
  64. // Different view index depending on deployment state
  65. if ( IsDeployed() )
  66. return 1;
  67. // When folded
  68. return 0;
  69. }
  70. case InventoryLocationType.PROXYCARGO:
  71. {
  72. return 0;
  73. }
  74. default:
  75. {
  76. if ( IsDeployed() )
  77. return 1;
  78. // When folded
  79. return 0;
  80. }
  81. }
  82. }
  83. return 0;
  84. }
  85. #endif
  86. }
  87. class SmallFishTrap extends Trap_SmallFish
  88. {
  89. // DEPRECATED
  90. ref RainProcurementManager m_RainProcurement;
  91. //================================================================
  92. // ADVANCED PLACEMENT
  93. //================================================================
  94. override bool IsDeployable()
  95. {
  96. return true;
  97. }
  98. override string GetDeploySoundset()
  99. {
  100. return "placeSmallFishTrap_SoundSet";
  101. }
  102. override string GetLoopDeploySoundset()
  103. {
  104. return "fishtrap_deploy_SoundSet";
  105. }
  106. override bool DoPlacingHeightCheck()
  107. {
  108. return true; //has to be able to catch rain, default distance raycast
  109. }
  110. }