Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actiondiggardenplot.c
Go to the documentation of this file.
1
class
ActionDigGardenPlotCB
: ActiondeployObjectCB
2
{
3
override
void
CreateActionComponent
()
4
{
5
m_ActionData.m_ActionComponent =
new
CAContinuousTime
(
UATimeSpent
.
DIG_GARDEN
);
6
}
7
};
8
9
class
ActionDigGardenPlot
:
ActionDeployObject
10
{
11
GardenPlot
m_GardenPlot
;
12
13
void
ActionDigGardenPlot
()
14
{
15
m_CallbackClass =
ActionDigGardenPlotCB
;
16
m_FullBody =
true
;
17
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ERECT;
18
m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_LOW;
19
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONFB_DIGMANIPULATE;
20
21
m_Text =
"#make_garden_plot"
;
22
}
23
24
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item)
25
{
26
//Client
27
if
(!
g_Game
.IsDedicatedServer())
28
{
29
//Action not allowed if player has broken legs
30
if
(player.GetBrokenLegs() ==
eBrokenLegs
.BROKEN_LEGS)
31
return
false
;
32
33
if
(!
CfgGameplayHandler
.
GetDisableColdAreaPlacementCheck
() && player.GetInColdArea())
34
return
false
;
35
36
if
(player.IsPlacingLocal())
37
{
38
Hologram
hologram = player.GetHologramLocal();
39
GardenPlot item_GP;
40
Class
.
CastTo
(item_GP, hologram.
GetProjectionEntity
());
41
CheckSurfaceBelowGardenPlot
(player, item_GP, hologram);
42
43
if
(!hologram.
IsColliding
())
44
{
45
return
true
;
46
}
47
}
48
return
false
;
49
}
50
//Server
51
return
true
;
52
}
53
54
override
void
SetupAnimation
(
ItemBase
item)
55
{
56
if
(item)
57
{
58
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONFB_DIG;
59
}
60
}
61
62
void
CheckSurfaceBelowGardenPlot
(
PlayerBase
player, GardenPlot item_GP,
Hologram
hologram)
63
{
64
vector
min_max[2];
65
item_GP.GetCollisionBox(min_max);
66
float
offset = min_max[1][1] - min_max[0][1];
67
//Print(offset);
68
vector
pos_adjusted = item_GP.GetPosition();
69
pos_adjusted[1] = pos_adjusted[1] + offset;
70
71
if
(item_GP.CanBePlaced(player,
/*item_GP.GetPosition()*/
pos_adjusted) )
72
{
73
if
(item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.
GetLeftCloseProjectionVector
())))
74
{
75
if
(item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.
GetRightCloseProjectionVector
())))
76
{
77
if
(item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.
GetLeftFarProjectionVector
())))
78
{
79
if
(item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.
GetRightFarProjectionVector
())))
80
{
81
hologram.
SetIsCollidingGPlot
(
false
);
82
83
return
;
84
}
85
}
86
}
87
}
88
}
89
90
hologram.
SetIsCollidingGPlot
(
true
);
91
}
92
93
override
void
DropDuringPlacing
(
PlayerBase
player)
94
{
95
}
96
97
override
void
OnFinishProgressClient
(
ActionData
action_data)
98
{
99
PlaceObjectActionData
poActionData;
100
poActionData =
PlaceObjectActionData
.Cast(action_data);
101
poActionData.
m_AlreadyPlaced
=
true
;
102
}
103
104
override
void
OnFinishProgressServer
(
ActionData
action_data)
105
{
106
PlaceObjectActionData
poActionData;
107
poActionData =
PlaceObjectActionData
.Cast(action_data);
108
EntityAI
entity_for_placing = action_data.m_MainItem;
109
vector
position = action_data.m_Player.GetLocalProjectionPosition();
110
vector
orientation = action_data.m_Player.GetLocalProjectionOrientation();
111
112
if
(
g_Game
.IsMultiplayer())
113
{
114
m_GardenPlot
= GardenPlot.Cast(action_data.m_Player.GetHologramServer().PlaceEntity(entity_for_placing));
115
m_GardenPlot
.SetOrientation(orientation);
116
action_data.m_Player.GetHologramServer().CheckPowerSource();
117
action_data.m_Player.PlacingCompleteServer();
118
119
m_GardenPlot
.OnPlacementComplete(action_data.m_Player);
120
}
121
122
//local singleplayer
123
if
(!
g_Game
.IsMultiplayer())
124
{
125
m_GardenPlot
= GardenPlot.Cast(action_data.m_Player.GetHologramLocal().PlaceEntity(entity_for_placing));
126
m_GardenPlot
.SetOrientation(orientation);
127
action_data.m_Player.PlacingCompleteServer();
128
action_data.m_Player.PlacingCompleteLocal();
129
130
m_GardenPlot
.OnPlacementComplete(action_data.m_Player);
131
}
132
133
g_Game
.ClearJuncture(action_data.m_Player, entity_for_placing);
134
action_data.m_MainItem.SetIsBeingPlaced(
false
);
135
poActionData.
m_AlreadyPlaced
=
true
;
136
137
MiscGameplayFunctions.DealEvinronmentAdjustedDmg(action_data.m_MainItem, action_data.m_Player, 10);
138
139
}
140
};
m_CommandUID
int m_CommandUID
Definition
actionbase.c:31
m_StanceMask
int m_StanceMask
Definition
actionbase.c:33
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionDeployObject
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Definition
actiondeployobject.c:9
ActionTarget
class ActionTargets ActionTarget
ActionDigGardenPlotCB
Definition
actiondiggardenplot.c:2
ActionDigGardenPlotCB::CreateActionComponent
override void CreateActionComponent()
Definition
actiondiggardenplot.c:3
ActionDigGardenPlot::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actiondiggardenplot.c:104
ActionDigGardenPlot::ActionDigGardenPlot
void ActionDigGardenPlot()
Definition
actiondiggardenplot.c:13
ActionDigGardenPlot::DropDuringPlacing
override void DropDuringPlacing(PlayerBase player)
Definition
actiondiggardenplot.c:93
ActionDigGardenPlot::SetupAnimation
override void SetupAnimation(ItemBase item)
Definition
actiondiggardenplot.c:54
ActionDigGardenPlot::m_GardenPlot
GardenPlot m_GardenPlot
Definition
actiondiggardenplot.c:11
ActionDigGardenPlot::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actiondiggardenplot.c:24
ActionDigGardenPlot::OnFinishProgressClient
override void OnFinishProgressClient(ActionData action_data)
Definition
actiondiggardenplot.c:97
ActionDigGardenPlot::CheckSurfaceBelowGardenPlot
void CheckSurfaceBelowGardenPlot(PlayerBase player, GardenPlot item_GP, Hologram hologram)
Definition
actiondiggardenplot.c:62
CAContinuousTime
Definition
cacontinuoustime.c:2
CfgGameplayHandler
Definition
cfggameplayhandler.c:2
CfgGameplayHandler::GetDisableColdAreaPlacementCheck
static bool GetDisableColdAreaPlacementCheck()
Definition
cfggameplayhandler.c:342
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
EntityAI
Definition
inventoryitem.c:2
Hologram
Definition
hologram.c:2
Hologram::SetIsCollidingGPlot
void SetIsCollidingGPlot(bool is_colliding_gplot)
Definition
hologram.c:1360
Hologram::IsColliding
bool IsColliding()
Definition
hologram.c:1373
Hologram::GetRightFarProjectionVector
vector GetRightFarProjectionVector()
Definition
hologram.c:1116
Hologram::GetLeftCloseProjectionVector
vector GetLeftCloseProjectionVector()
Definition
hologram.c:1089
Hologram::GetProjectionEntity
EntityAI GetProjectionEntity()
Definition
hologram.c:1332
Hologram::GetRightCloseProjectionVector
vector GetRightCloseProjectionVector()
Definition
hologram.c:1097
Hologram::GetLeftFarProjectionVector
vector GetLeftFarProjectionVector()
Definition
hologram.c:1107
ItemBase
Definition
inventoryitem.c:742
PlaceObjectActionData
Definition
actiondeploybase.c:2
PlaceObjectActionData::m_AlreadyPlaced
bool m_AlreadyPlaced
Definition
actiondeploybase.c:5
PlayerBase
Definition
playerbaseclient.c:2
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::DIG_GARDEN
const float DIG_GARDEN
Definition
actionconstants.c:77
vector
Definition
enconvert.c:119
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
eBrokenLegs
eBrokenLegs
Definition
ebrokenlegs.c:2
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actiondiggardenplot.c
Generated by
1.17.0