trap_fishnet.c 2.6 KB

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