DayZ 1.24
Loading...
Searching...
No Matches
GardenPlot.c
Go to the documentation of this file.
1class GardenPlot extends GardenBase
2{
4 private const int GARDEN_SLOT_COUNT = 9;
5
6 void GardenPlot()
7 {
8 SetBaseFertility(0.5);
9 }
10
11 override void EEInit()
12 {
13 super.EEInit();
14 }
15
16 override bool OnStoreLoad(ParamsReadContext ctx, int version)
17 {
18 if (!super.OnStoreLoad(ctx, version))
19 return false;
20
21 if (!m_ClutterCutter)
22 {
23 m_ClutterCutter = GetGame().CreateObjectEx("ClutterCutter6x6", GetPosition(), ECE_PLACE_ON_SURFACE);
24 m_ClutterCutter.SetOrientation(GetOrientation());
25 }
26
27 return true;
28 }
29
30 override void EEDelete(EntityAI parent)
31 {
32 super.EEDelete(parent);
33
34 if (m_ClutterCutter && GetGame())
35 {
36 GetGame().ObjectDelete(m_ClutterCutter);
38 }
39 }
40
41 override bool IsInventoryVisible()
42 {
43 return true;
44 }
45
46 override int GetGardenSlotsCount()
47 {
48 return GARDEN_SLOT_COUNT;
49 }
50
52 {
53 HideSelection("SeedBase_1");
54 HideSelection("SeedBase_2");
55 HideSelection("SeedBase_3");
56 HideSelection("SeedBase_4");
57 HideSelection("SeedBase_5");
58 HideSelection("SeedBase_6");
59 HideSelection("SeedBase_7");
60 HideSelection("SeedBase_8");
61 HideSelection("SeedBase_9");
62 HideSelection("slotCovered_01");
63 HideSelection("slotCovered_02");
64 HideSelection("slotCovered_03");
65 HideSelection("slotCovered_04");
66 HideSelection("slotCovered_05");
67 HideSelection("slotCovered_06");
68 HideSelection("slotCovered_07");
69 HideSelection("slotCovered_08");
70 HideSelection("slotCovered_09");
71 }
72
73 //================================================================
74 // ADVANCED PLACEMENT
75 //================================================================
76
77 override void OnPlacementStarted(Man player)
78 {
80 }
81
82 override void OnHologramBeingPlaced(Man player)
83 {
85 }
86
87 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
88 {
89 super.OnPlacementComplete(player, position, orientation);
90
92 //vector pos = player_base.GetLocalProjectionPosition();
93 //vector ori = player_base.GetLocalProjectionOrientation();
94
95 if (GetGame().IsServer())
96 {
97 // To properly move the clutter cutter from spawn position, it must be deleted and created again.
99 {
100 GetGame().ObjectDelete(m_ClutterCutter);
102 }
103
104 if (!m_ClutterCutter)
105 {
106 m_ClutterCutter = GetGame().CreateObjectEx("ClutterCutter6x6", GetPosition(), ECE_PLACE_ON_SURFACE);
107 m_ClutterCutter.SetOrientation(orientation);
108 }
109 }
110 }
111
112 override bool CanBePlaced(Man player, vector position)
113 {
114 string surface_type;
115 GetGame().SurfaceGetType3D(position[0], position[1], position[2], surface_type);
116
117 return GetGame().IsSurfaceFertile(surface_type);
118 }
119}
120
121//class GardenPlotOutside : GardenPlot {}
122class GardenPlotPolytunnel : GardenPlot
123{
124 private const int POLYTUNNEL_SLOT_COUNT = 13;
125 override int GetGardenSlotsCount()
126 {
128 }
129
130 override void RefreshSlots()
131 {
132 HideSelection("SeedBase_1");
133 HideSelection("SeedBase_2");
134 HideSelection("SeedBase_3");
135 HideSelection("SeedBase_4");
136 HideSelection("SeedBase_5");
137 HideSelection("SeedBase_6");
138 HideSelection("SeedBase_7");
139 HideSelection("SeedBase_8");
140 HideSelection("SeedBase_9");
141 HideSelection("SeedBase_10");
142 HideSelection("SeedBase_11");
143 HideSelection("SeedBase_12");
144 HideSelection("SeedBase_13");
145 }
146}
147class GardenPlotGreenhouse : GardenPlot {}
148
149class GardenPlotPlacing extends GardenPlot
150{
151 override void EOnInit(IEntity other, int extra) {};
152 override void RefreshSlots() {};
153 override void SyncSlots() {};
154}
vector GetOrientation()
const int ECE_PLACE_ON_SURFACE
Object m_ClutterCutter
override void SyncSlots()
Definition GardenPlot.c:153
class GardenPlot extends GardenBase POLYTUNNEL_SLOT_COUNT
override int GetGardenSlotsCount()
Definition GardenPlot.c:125
override void RefreshSlots()
Definition GardenPlot.c:130
override void EOnInit(IEntity other, int extra)
class JsonUndergroundAreaTriggerData GetPosition
override void EEDelete(EntityAI parent)
Definition GardenPlot.c:30
void GardenPlot()
Definition GardenPlot.c:6
void RefreshSlots()
Definition GardenPlot.c:51
override bool IsInventoryVisible()
Definition GardenPlot.c:41
override void EEInit()
Definition GardenPlot.c:11
override void OnPlacementStarted(Man player)
Definition GardenPlot.c:77
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition GardenPlot.c:16
override bool CanBePlaced(Man player, vector position)
Definition GardenPlot.c:112
Object m_ClutterCutter
Definition GardenPlot.c:3
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition GardenPlot.c:87
override int GetGardenSlotsCount()
Definition GardenPlot.c:46
override void OnHologramBeingPlaced(Man player)
Definition GardenPlot.c:82
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto native CGame GetGame()