Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
gardenplot.c
Go to the documentation of this file.
1
class
GardenPlot
extends
GardenBase
2
{
3
Object
m_ClutterCutter
;
4
private
const
int
GARDEN_SLOT_COUNT
= 9;
5
private
const
float
PLACEMENT_HEIGHT_LIMIT
= 0.3;
// Y coord placement limit - this is important when server has collision checks disabled
6
7
void
GardenPlot
()
8
{
9
SetBaseFertility(0.5);
10
}
11
12
override
bool
OnStoreLoad
(
ParamsReadContext
ctx,
int
version )
13
{
14
if
( !super.OnStoreLoad(ctx, version) )
15
return
false
;
16
17
if
( !
m_ClutterCutter
)
18
{
19
m_ClutterCutter
=
g_Game
.CreateObjectEx(
"ClutterCutter6x6"
,
GetPosition
(),
ECE_PLACE_ON_SURFACE
);
20
m_ClutterCutter
.SetOrientation(
GetOrientation
() );
21
}
22
23
return
true
;
24
}
25
26
override
void
EEDelete
(
EntityAI
parent)
27
{
28
super.EEDelete(parent);
29
30
if
(
m_ClutterCutter
&&
g_Game
)
31
{
32
g_Game
.ObjectDelete(
m_ClutterCutter
);
33
m_ClutterCutter
= NULL;
34
}
35
}
36
37
override
bool
IsInventoryVisible
()
38
{
39
return
true
;
40
}
41
42
override
int
GetGardenSlotsCount
()
43
{
44
return
GARDEN_SLOT_COUNT
;
45
}
46
47
void
RefreshSlots
()
48
{
49
HideSelection(
"SeedBase_1"
);
50
HideSelection(
"SeedBase_2"
);
51
HideSelection(
"SeedBase_3"
);
52
HideSelection(
"SeedBase_4"
);
53
HideSelection(
"SeedBase_5"
);
54
HideSelection(
"SeedBase_6"
);
55
HideSelection(
"SeedBase_7"
);
56
HideSelection(
"SeedBase_8"
);
57
HideSelection(
"SeedBase_9"
);
58
HideSelection(
"slotCovered_01"
);
59
HideSelection(
"slotCovered_02"
);
60
HideSelection(
"slotCovered_03"
);
61
HideSelection(
"slotCovered_04"
);
62
HideSelection(
"slotCovered_05"
);
63
HideSelection(
"slotCovered_06"
);
64
HideSelection(
"slotCovered_07"
);
65
HideSelection(
"slotCovered_08"
);
66
HideSelection(
"slotCovered_09"
);
67
}
68
69
//================================================================
70
// ADVANCED PLACEMENT
71
//================================================================
72
73
override
void
OnPlacementStarted
( Man player )
74
{
75
RefreshSlots
();
76
}
77
78
override
void
OnHologramBeingPlaced
( Man player )
79
{
80
RefreshSlots
();
81
}
82
83
override
void
OnPlacementComplete
( Man player,
vector
position =
"0 0 0"
,
vector
orientation =
"0 0 0"
)
84
{
85
super.OnPlacementComplete( player, position, orientation );
86
87
// To properly move the clutter cutter from spawn position, it must be deleted and created again.
88
if
(
m_ClutterCutter
)
89
{
90
g_Game
.ObjectDelete(
m_ClutterCutter
);
91
m_ClutterCutter
= NULL;
92
}
93
94
if
(!
m_ClutterCutter
)
95
{
96
m_ClutterCutter
=
g_Game
.CreateObjectEx(
"ClutterCutter6x6"
,
GetPosition
(),
ECE_PLACE_ON_SURFACE
);
97
m_ClutterCutter
.SetOrientation( orientation );
98
}
99
100
SyncSlots
();
101
}
102
103
override
bool
CanBePlaced
( Man player,
vector
position )
104
{
105
string
surface_type;
106
float
surfaceHeight =
g_Game
.SurfaceGetType3D( position[0], position[1], position[2], surface_type );
107
if
((position[1] - surfaceHeight) >
PLACEMENT_HEIGHT_LIMIT
)
108
return
false
;
109
110
return
g_Game
.IsSurfaceFertile(surface_type);
111
}
112
113
override
bool
IsTakeable
()
114
{
115
return
false
;
116
}
117
118
override
bool
CanPutInCargo
(
EntityAI
parent )
119
{
120
return
false
;
121
}
122
123
override
bool
CanRemoveFromCargo
(
EntityAI
parent )
124
{
125
return
false
;
126
}
127
128
//hands
129
override
bool
CanPutIntoHands
(
EntityAI
parent )
130
{
131
return
false
;
132
}
133
}
134
135
//class GardenPlotOutside : GardenPlot {}
136
class
GardenPlotPolytunnel : GardenPlot
137
{
138
private
const
int
POLYTUNNEL_SLOT_COUNT
= 13;
139
override
int
GetGardenSlotsCount
()
140
{
141
return
POLYTUNNEL_SLOT_COUNT
;
142
}
143
144
override
void
OnPlacementComplete
( Man player,
vector
position =
"0 0 0"
,
vector
orientation =
"0 0 0"
)
145
{
146
if
(
g_Game
.IsServer() || !
g_Game
.IsMultiplayer() )
147
{
148
SyncSlots
();
149
}
150
}
151
152
override
void
RefreshSlots
()
153
{
154
HideSelection(
"SeedBase_1"
);
155
HideSelection(
"SeedBase_2"
);
156
HideSelection(
"SeedBase_3"
);
157
HideSelection(
"SeedBase_4"
);
158
HideSelection(
"SeedBase_5"
);
159
HideSelection(
"SeedBase_6"
);
160
HideSelection(
"SeedBase_7"
);
161
HideSelection(
"SeedBase_8"
);
162
HideSelection(
"SeedBase_9"
);
163
HideSelection(
"SeedBase_10"
);
164
HideSelection(
"SeedBase_11"
);
165
HideSelection(
"SeedBase_12"
);
166
HideSelection(
"SeedBase_13"
);
167
}
168
}
169
class
GardenPlotGreenhouse
: GardenPlot
170
{
171
override
void
OnPlacementComplete
( Man player,
vector
position =
"0 0 0"
,
vector
orientation =
"0 0 0"
)
172
{
173
if
(
g_Game
.IsServer() || !
g_Game
.IsMultiplayer() )
174
{
175
SyncSlots
();
176
}
177
}
178
}
179
180
class
GardenPlotPlacing
extends
GardenPlot
181
{
182
override
void
EOnInit
(IEntity other,
int
extra) {};
183
override
void
RefreshSlots
() {};
184
override
void
SyncSlots
() {};
185
}
GetOrientation
vector GetOrientation()
Definition
areadamagemanager.c:306
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition
centraleconomy.c:37
EntityAI
Definition
inventoryitem.c:2
GardenBase
Definition
gardenplot.c:2
GardenBase::IsInventoryVisible
override bool IsInventoryVisible()
Definition
gardenplot.c:37
GardenBase::m_ClutterCutter
Object m_ClutterCutter
Definition
gardenplot.c:3
GardenBase::OnHologramBeingPlaced
override void OnHologramBeingPlaced(Man player)
Definition
gardenplot.c:78
GardenBase::PLACEMENT_HEIGHT_LIMIT
const float PLACEMENT_HEIGHT_LIMIT
Definition
gardenplot.c:5
GardenBase::CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition
gardenplot.c:118
GardenBase::CanBePlaced
override bool CanBePlaced(Man player, vector position)
Definition
gardenplot.c:103
GardenBase::GardenPlot
void GardenPlot()
Definition
gardenplot.c:7
GardenBase::OnPlacementComplete
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition
gardenplot.c:83
GardenBase::EEDelete
override void EEDelete(EntityAI parent)
Definition
gardenplot.c:26
GardenBase::GetGardenSlotsCount
override int GetGardenSlotsCount()
Definition
gardenplot.c:42
GardenBase::CanPutIntoHands
override bool CanPutIntoHands(EntityAI parent)
Definition
gardenplot.c:129
GardenBase::CanRemoveFromCargo
override bool CanRemoveFromCargo(EntityAI parent)
Definition
gardenplot.c:123
GardenBase::OnStoreLoad
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition
gardenplot.c:12
GardenBase::RefreshSlots
void RefreshSlots()
Definition
gardenplot.c:47
GardenBase::IsTakeable
override bool IsTakeable()
Definition
gardenplot.c:113
GardenBase::OnPlacementStarted
override void OnPlacementStarted(Man player)
Definition
gardenplot.c:73
GardenBase::GARDEN_SLOT_COUNT
const int GARDEN_SLOT_COUNT
Definition
gardenplot.c:4
GardenPlotGreenhouse
Definition
gardenplot.c:170
GardenPlotGreenhouse::OnPlacementComplete
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition
gardenplot.c:171
Object
Definition
objecttyped.c:2
vector
Definition
enconvert.c:119
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
OnPlacementComplete
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition
explosivesbase.c:140
ParamsReadContext
Serializer ParamsReadContext
Definition
gameplay.c:15
SyncSlots
override void SyncSlots()
Definition
gardenplot.c:184
POLYTUNNEL_SLOT_COUNT
class GardenPlot extends GardenBase POLYTUNNEL_SLOT_COUNT
GetGardenSlotsCount
override int GetGardenSlotsCount()
Definition
gardenplot.c:139
RefreshSlots
override void RefreshSlots()
Definition
gardenplot.c:152
GetPosition
vector GetPosition()
Get the world position of the Effect.
Definition
effect.c:473
EOnInit
override void EOnInit(IEntity other, int extra)
Definition
testframework.c:235
Games
Dayz
scripts
4_world
entities
gardenbase
gardenplot.c
Generated by
1.17.0