trap_fishnet.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. class Trap_FishNet 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_IsFoldable = true;
  13. m_MinimalDistanceFromPlayersToCatch = 15;
  14. m_AnimationPhaseSet = "inventory";
  15. m_AnimationPhaseTriggered = "placing";
  16. m_AnimationPhaseUsed = "triggered";
  17. }
  18. override void InitCatchingComponent()
  19. {
  20. if (!m_CatchingContext)
  21. {
  22. int updateCount = m_MaxActiveTime/m_UpdateWaitTime;
  23. Param2<EntityAI,int> par = new Param2<EntityAI,int>(this,updateCount);
  24. m_CatchingContext = new CatchingContextTrapFishLarge(par);
  25. }
  26. super.InitCatchingComponent();
  27. }
  28. //========================================================
  29. //============= PLACING AND INVENTORY EVENTS =============
  30. //========================================================
  31. override bool IsPlaceableAtPosition( vector position )
  32. {
  33. return IsSurfaceWater( position );
  34. }
  35. override bool CanReceiveAttachment( EntityAI attachment, int slotId )
  36. {
  37. if ( !attachment.IsInherited( Worm ) )
  38. return false;
  39. return super.CanReceiveAttachment( attachment, slotId );
  40. }
  41. #ifdef PLATFORM_WINDOWS
  42. // How one sees the tripwire when in vicinity
  43. override int GetViewIndex()
  44. {
  45. if ( MemoryPointExists( "invView2" ) )
  46. {
  47. InventoryLocation il = new InventoryLocation;
  48. GetInventory().GetCurrentInventoryLocation( il );
  49. InventoryLocationType type = il.GetType();
  50. switch ( type )
  51. {
  52. case InventoryLocationType.CARGO:
  53. {
  54. return 0;
  55. }
  56. case InventoryLocationType.ATTACHMENT:
  57. {
  58. return 1;
  59. }
  60. case InventoryLocationType.HANDS:
  61. {
  62. return 0;
  63. }
  64. case InventoryLocationType.GROUND:
  65. {
  66. // Different view index depending on deployment state
  67. if ( IsActive() )
  68. return 1;
  69. // When folded
  70. return 0;
  71. }
  72. case InventoryLocationType.PROXYCARGO:
  73. {
  74. return 0;
  75. }
  76. default:
  77. {
  78. if ( IsActive() )
  79. return 1;
  80. // When folded
  81. return 0;
  82. }
  83. }
  84. }
  85. return 0;
  86. }
  87. #endif
  88. //================================================================
  89. // ADVANCED PLACEMENT
  90. //================================================================
  91. override bool IsDeployable()
  92. {
  93. return true;
  94. }
  95. override string GetDeploySoundset()
  96. {
  97. return "placeFishNetTrap_SoundSet";
  98. }
  99. override string GetLoopDeploySoundset()
  100. {
  101. return "fishnet_deploy_SoundSet";
  102. }
  103. }
  104. class FishNetTrap extends Trap_FishNet
  105. {
  106. }