Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
trap_rabbitsnare.c
Go to the documentation of this file.
1
class
Trap_RabbitSnare
extends
TrapSpawnBase
2
{
3
override
void
InitTrapValues
()
4
{
5
super.InitTrapValues();
6
7
m_DefectRate
= 2.5;
//Added damage after trap activation
8
9
m_InitWaitTimeMin = 120;
10
m_InitWaitTimeMax = 180;
11
m_UpdateWaitTime = 30;
12
m_SpawnUpdateWaitTime = 30;
13
m_MaxActiveTime = 1200;
14
m_IsFoldable =
true
;
15
m_MinimalDistanceFromPlayersToCatch = 15;
16
17
m_AnimationPhaseSet
=
"inventory"
;
18
m_AnimationPhaseTriggered
=
"placing"
;
19
m_AnimationPhaseUsed =
"triggered"
;
20
}
21
22
override
bool
CanBePlaced
(Man player,
vector
position)
23
{
24
if
(
m_IsBeingPlaced
)
25
return
true
;
26
27
int
liquidType;
28
string
surfaceType;
29
g_Game
.SurfaceUnderObject(
PlayerBase
.Cast(player).GetHologramLocal().GetProjectionEntity(), surfaceType, liquidType);
30
31
return
g_Game
.IsSurfaceDigable(surfaceType);
32
}
33
34
override
void
SetupTrap
()
35
{
36
if
(
g_Game
.IsServer() )
37
{
38
if
( GetHierarchyRootPlayer().CanDropEntity(
this
) )
39
{
40
if
( IsRuined() )
41
{
42
PlayerBase
player =
PlayerBase
.Cast( GetHierarchyRootPlayer() );
43
}
44
else
45
{
46
PlayerBase
owner_player =
PlayerBase
.Cast( GetHierarchyRootPlayer() );
47
48
//GetDirection
49
vector
trapPos = owner_player.GetDirection();
50
trapPos[1] = 0;
51
SetPosition
( owner_player.GetPosition() + trapPos );
52
53
SetActive
();
54
55
SetOrientation( owner_player.GetOrientation() );
56
}
57
}
58
}
59
}
60
61
override
void
InitCatchingComponent
()
62
{
63
if
(!m_CatchingContext)
64
{
65
int
updateCount = m_MaxActiveTime/m_UpdateWaitTime;
66
Param2<EntityAI,int>
par =
new
Param2<EntityAI,int>
(
this
,updateCount);
67
m_CatchingContext =
new
CatchingContextTrapLandSnare(par);
68
}
69
70
super.InitCatchingComponent();
71
}
72
73
//================================================================
74
// ADVANCED PLACEMENT
75
//================================================================
76
77
override
void
OnPlacementComplete
( Man player,
vector
position =
"0 0 0"
,
vector
orientation =
"0 0 0"
)
78
{
79
super.OnPlacementComplete( player, position, orientation );
80
SetOrientation(orientation);
81
}
82
83
override
bool
IsDeployable
()
84
{
85
return
true
;
86
}
87
88
override
string
GetDeploySoundset
()
89
{
90
return
"placeRabbitSnareTrap_SoundSet"
;
91
}
92
93
override
string
GetLoopDeploySoundset
()
94
{
95
return
"rabbitsnare_deploy_SoundSet"
;
96
}
97
98
override
void
SetActions
()
99
{
100
super.SetActions();
101
102
// We remove the hunting trap deploy action in order to allow advanced placement
103
RemoveAction
(
ActionDeployHuntingTrap
);
104
105
AddAction
(
ActionTogglePlaceObject
);
106
AddAction
(
ActionDeployObject
);
107
}
108
109
// ===============================================================
110
// ===================== DEPRECATED ============================
111
// ===============================================================
112
113
override
void
AlignCatch
(
ItemBase
obj,
string
catch_name )
114
{
115
if
( catch_name ==
"Animal_LepusEuropaeus"
)
116
{
117
obj.SetOrientation(
GetOrientation
() );
118
119
vector
forward_vec = GetDirection();
120
vector
side_vec = forward_vec.
Perpend
( ) * -0.22;
121
forward_vec = forward_vec * -0.3;
122
123
vector
chatch_pos = obj.GetPosition() + forward_vec + side_vec;
124
obj.SetPosition( chatch_pos );
125
}
126
}
127
}
128
129
class
RabbitSnareTrap
extends
Trap_RabbitSnare
130
{
131
132
}
ActionDeployObject
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Definition
actiondeployobject.c:9
AddAction
void AddAction(typename actionName)
Definition
advancedcommunication.c:220
RemoveAction
void RemoveAction(typename actionName)
Definition
advancedcommunication.c:252
GetOrientation
vector GetOrientation()
Definition
areadamagemanager.c:306
ActionDeployHuntingTrap
Definition
actiondeployhuntingtrap.c:2
ActionTogglePlaceObject
Definition
actiontoggleplaceobject.c:2
ItemBase
Definition
inventoryitem.c:742
Param2
Definition
ppeconstants.c:68
PlayerBase
Definition
playerbaseclient.c:2
TrapSpawnBase
Definition
trap_fishnet.c:2
TrapSpawnBase::GetDeploySoundset
override string GetDeploySoundset()
Definition
trap_rabbitsnare.c:88
TrapSpawnBase::GetLoopDeploySoundset
override string GetLoopDeploySoundset()
Definition
trap_rabbitsnare.c:93
TrapSpawnBase::SetupTrap
override void SetupTrap()
Definition
trap_rabbitsnare.c:34
TrapSpawnBase::CanBePlaced
override bool CanBePlaced(Man player, vector position)
Definition
trap_rabbitsnare.c:22
TrapSpawnBase::OnPlacementComplete
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition
trap_rabbitsnare.c:77
TrapSpawnBase::AlignCatch
override void AlignCatch(ItemBase obj, string catch_name)
Definition
trap_rabbitsnare.c:113
TrapSpawnBase::InitTrapValues
override void InitTrapValues()
Definition
trap_rabbitsnare.c:3
TrapSpawnBase::IsDeployable
override bool IsDeployable()
Definition
trap_rabbitsnare.c:83
TrapSpawnBase::InitCatchingComponent
override void InitCatchingComponent()
Definition
trap_rabbitsnare.c:61
TrapSpawnBase::SetActions
override void SetActions()
Definition
trap_rabbitsnare.c:98
vector
Definition
enconvert.c:119
vector::Perpend
vector Perpend()
Returns perpendicular vector.
Definition
enconvert.c:222
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
SetPosition
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition
effect.c:463
m_IsBeingPlaced
bool m_IsBeingPlaced
Definition
itembase.c:4957
m_AnimationPhaseTriggered
string m_AnimationPhaseTriggered
Definition
trapbase.c:34
m_DefectRate
float m_DefectRate
Definition
trapbase.c:19
SetActive
void SetActive()
Definition
trapbase.c:404
m_AnimationPhaseSet
string m_AnimationPhaseSet
Definition
trapbase.c:33
Games
Dayz
scripts
4_world
entities
itembase
trapspawnbase
trap_rabbitsnare.c
Generated by
1.17.0