Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actioncreategreenhousegardenplot.c
Go to the documentation of this file.
1
class
ActionCreateGreenhouseGardenPlotCB
:
ActionContinuousBaseCB
2
{
3
override
void
CreateActionComponent
()
4
{
5
m_ActionData
.m_ActionComponent =
new
CAContinuousTime
(
UATimeSpent
.
DIG_GARDEN
);
6
}
7
};
8
9
class
ActionCreateGreenhouseGardenPlot
:
ActionContinuousBase
10
{
11
GardenPlot
m_GardenPlot
;
12
private
const
float
CAMERA_PITCH_THRESHOLD
= -30;
13
14
void
ActionCreateGreenhouseGardenPlot
()
15
{
16
m_CallbackClass
=
ActionCreateGreenhouseGardenPlotCB
;
17
m_FullBody
=
true
;
18
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONFB_DIGMANIPULATE;
19
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ERECT;
20
m_SpecialtyWeight
= UASoftSkillsWeight.ROUGH_LOW;
21
m_Text
=
"#make_garden_plot"
;
22
}
23
24
override
void
CreateConditionComponents
()
25
{
26
m_ConditionItem
=
new
CCINonRuined
;
27
m_ConditionTarget
=
new
CCTCursor
;
28
}
29
30
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
31
{
32
if
( !target )
33
return
false
;
34
35
if
( player.IsPlacingLocal() )
36
return
false
;
37
38
if
(!
CfgGameplayHandler
.
GetDisableColdAreaPlacementCheck
() && player.GetInColdArea())
39
return
false
;
40
41
Object
target_object = target.GetObject();
42
43
Land_Misc_Greenhouse
greenHouse =
Land_Misc_Greenhouse
.Cast( target_object );
44
Land_Misc_Polytunnel
polytunnel =
Land_Misc_Polytunnel
.Cast( target_object) ;
45
46
if
( target_object && ( greenHouse || polytunnel ) )
47
{
48
string
action_selection = target_object.GetActionComponentName( target.GetComponentIndex() );
49
//Update selections in model, name the desired part Soil to improve action condition check
50
if
( action_selection !=
"soil"
)
51
return
false
;
52
53
//check if there is any gardenplot objects in the current building
54
ref
array<Object>
nearest_objects =
new
array<Object>
;
55
ref
array<CargoBase>
proxy_cargos =
new
array<CargoBase>
;
56
vector
pos = target_object.GetPosition();
57
pos[1] = pos[1] - 1;
//Lower by one meter for check if plot already present
58
g_Game
.GetObjectsAtPosition3D( pos, 2, nearest_objects, proxy_cargos );
59
60
for
(
int
i = 0; i < nearest_objects.Count(); ++i )
61
{
62
Object
object
= nearest_objects.Get( i );
63
64
if
(
object
.IsInherited( GardenPlot ) )
65
{
66
return
false
;
67
}
68
}
69
70
return
true
;
71
}
72
73
return
false
;
74
}
75
76
override
void
OnFinishProgressServer
(
ActionData
action_data )
77
{
78
PlaceObjectActionData
poActionData;
79
poActionData =
PlaceObjectActionData
.Cast(action_data);
80
EntityAI
entity_for_placing = action_data.m_MainItem;
81
Object
targetObject = action_data.m_Target.GetObject();
82
83
vector
position = targetObject.GetPosition();
84
85
//Depending on where we dig the required height offset is not the same
86
Land_Misc_Greenhouse
greenHouse =
Land_Misc_Greenhouse
.Cast( targetObject );
87
Land_Misc_Polytunnel
polytunnel =
Land_Misc_Polytunnel
.Cast( targetObject) ;
88
89
if
( polytunnel )
90
position[1] = position[1] - 1.15;
//Lower Y position by roughly 1 meter to compensate for spawning location offset
91
else
92
position[1] = position[1] - 1.05;
93
94
vector
orientation = targetObject.GetOrientation();
95
96
Land_Misc_Polytunnel
tunnel;
97
if
(
g_Game
.IsMultiplayer())
98
{
99
tunnel =
Land_Misc_Polytunnel
.Cast(action_data.m_Target.GetObject());
100
if
(tunnel)
101
{
102
m_GardenPlot
= GardenPlot.Cast(
g_Game
.CreateObjectEx(
"GardenPlotPolytunnel"
, position,
ECE_KEEPHEIGHT
));
103
}
104
else
105
{
106
m_GardenPlot
= GardenPlot.Cast(
g_Game
.CreateObjectEx(
"GardenPlotGreenhouse"
, position,
ECE_KEEPHEIGHT
));
107
}
108
109
m_GardenPlot
.SetOrientation(orientation);
110
m_GardenPlot
.OnPlacementComplete(action_data.m_Player);
111
}
112
113
//local singleplayer
114
if
(!
g_Game
.IsMultiplayer())
115
{
116
tunnel =
Land_Misc_Polytunnel
.Cast(action_data.m_Target.GetObject());
117
if
(tunnel)
118
{
119
m_GardenPlot
= GardenPlot.Cast(
g_Game
.CreateObjectEx(
"GardenPlotPolytunnel"
, position,
ECE_KEEPHEIGHT
));
120
}
121
else
122
{
123
m_GardenPlot
= GardenPlot.Cast(
g_Game
.CreateObjectEx(
"GardenPlotGreenhouse"
, position,
ECE_KEEPHEIGHT
));
124
}
125
126
m_GardenPlot
.SetOrientation(orientation);
127
m_GardenPlot
.OnPlacementComplete(action_data.m_Player);
128
}
129
}
130
131
override
bool
IsLockTargetOnUse
()
132
{
133
return
false
;
134
}
135
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ECE_KEEPHEIGHT
const int ECE_KEEPHEIGHT
Definition
centraleconomy.c:27
ActionBaseCB::m_ActionData
ActionData m_ActionData
Definition
animatedactionbase.c:3
ActionBase::m_FullBody
bool m_FullBody
Definition
actionbase.c:67
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_SpecialtyWeight
float m_SpecialtyWeight
Definition
actionbase.c:83
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionContinuousBaseCB
Definition
actioncontinuousbase.c:2
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionCreateGreenhouseGardenPlotCB
Definition
actioncreategreenhousegardenplot.c:2
ActionCreateGreenhouseGardenPlotCB::CreateActionComponent
override void CreateActionComponent()
Definition
actioncreategreenhousegardenplot.c:3
ActionCreateGreenhouseGardenPlot::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actioncreategreenhousegardenplot.c:76
ActionCreateGreenhouseGardenPlot::ActionCreateGreenhouseGardenPlot
void ActionCreateGreenhouseGardenPlot()
Definition
actioncreategreenhousegardenplot.c:14
ActionCreateGreenhouseGardenPlot::CreateConditionComponents
override void CreateConditionComponents()
Definition
actioncreategreenhousegardenplot.c:24
ActionCreateGreenhouseGardenPlot::m_GardenPlot
GardenPlot m_GardenPlot
Definition
actioncreategreenhousegardenplot.c:11
ActionCreateGreenhouseGardenPlot::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actioncreategreenhousegardenplot.c:30
ActionCreateGreenhouseGardenPlot::IsLockTargetOnUse
override bool IsLockTargetOnUse()
Definition
actioncreategreenhousegardenplot.c:131
ActionCreateGreenhouseGardenPlot::CAMERA_PITCH_THRESHOLD
const float CAMERA_PITCH_THRESHOLD
Definition
actioncreategreenhousegardenplot.c:12
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
CAContinuousTime
Definition
cacontinuoustime.c:2
CCINonRuined
Definition
ccinonruined.c:2
CCTCursor
Definition
cctcursor.c:2
CfgGameplayHandler
Definition
cfggameplayhandler.c:2
CfgGameplayHandler::GetDisableColdAreaPlacementCheck
static bool GetDisableColdAreaPlacementCheck()
Definition
cfggameplayhandler.c:342
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlaceObjectActionData
Definition
actiondeploybase.c:2
PlayerBase
Definition
playerbaseclient.c:2
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::DIG_GARDEN
const float DIG_GARDEN
Definition
actionconstants.c:77
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
vector
Definition
enconvert.c:119
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Land_Misc_Polytunnel
class Land_Misc_Greenhouse extends BuildingSuper Land_Misc_Polytunnel()
Definition
land_misc_greenhouse.c:11
Land_Misc_Greenhouse
void Land_Misc_Greenhouse()
Definition
land_misc_greenhouse.c:12
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actioncreategreenhousegardenplot.c
Generated by
1.17.0