3 void Trap_RabbitSnare()
11 m_MinimalDistanceFromPlayersToCatch = 10;
14 m_NoBaitCatchProb = 15;
18 m_AnimationPhaseUsed =
"triggered";
20 m_WaterSurfaceForSetup =
false;
22 m_CatchesGroundAnimal =
new multiMap<string, float>;
23 m_CatchesGroundAnimal.Insert(
"DeadRooster", 1);
24 m_CatchesGroundAnimal.Insert(
"DeadChicken_White", 1);
25 m_CatchesGroundAnimal.Insert(
"DeadChicken_Spotted", 1);
26 m_CatchesGroundAnimal.Insert(
"DeadChicken_Brown", 1);
28 m_CatchesGroundAnimal.Insert(
"DeadRabbit", 1);
38 g_Game.SurfaceUnderObject(
PlayerBase.Cast(player).GetHologramLocal().GetProjectionEntity(), surfaceType, liquidType);
40 return g_Game.IsSurfaceDigable(surfaceType);
45 super.OnVariablesSynchronized();
57 if ( GetHierarchyRootPlayer().CanDropEntity(
this ) )
68 vector trapPos = owner_player.GetDirection();
70 SetPosition( owner_player.GetPosition() + trapPos );
74 SetOrientation( owner_player.GetOrientation() );
80 override void SpawnCatch()
86 multiMap<string, float> catches;
90 catches = m_CatchesGroundAnimal;
93 if ( catches && catches.Count() > 0 )
96 int count = catches.Count() - 1;
97 int randomCatchIndex =
Math.RandomInt( 0, count );
99 if (
Math.RandomFloat(0, 100) < m_FinalCatchProb )
103 if ( m_Bait.IsInherited( Worm ) )
106 randomCatchIndex =
Math.RandomInt( 0, count - 1 );
112 randomCatchIndex = count;
119 randomCatchIndex =
Math.RandomIntInclusive( 0, 1 );
120 if ( randomCatchIndex == 0 )
122 randomCatchIndex =
Math.RandomInt( 0, count - 1 );
127 randomCatchIndex = count;
134 CatchSetQuant(
catch );
156 super.OnPlacementComplete( player, position, orientation );
157 SetOrientation(orientation);
168 return "placeRabbitSnareTrap_SoundSet";
173 return "rabbitsnare_deploy_SoundSet";
191 override void AlignCatch(
ItemBase obj,
string catch_name )
193 if ( catch_name ==
"Animal_LepusEuropaeus" )
197 vector forward_vec = GetDirection();
198 vector side_vec = forward_vec.Perpend( ) * -0.22;
199 forward_vec = forward_vec * -0.3;
201 vector chatch_pos = obj.GetPosition() + forward_vec + side_vec;
202 obj.SetPosition( chatch_pos );
207 class RabbitSnareTrap
extends Trap_RabbitSnare