DayZ 1.24
Loading...
Searching...
No Matches
Shelter.c File Reference

Go to the source code of this file.

Classes

class  TentBase
 
class  ShelterBase
 

Functions

class ShelterBase extends TentBase GetShelterVariant ()
 
void ShelterBase ()
 
override void SetActions ()
 
override void EEInit ()
 
void Deconstruct ()
 
string GetMaterialPath ()
 
void SpawnKit ()
 
override bool IsPlayerInside (PlayerBase player, string selection)
 

Variables

static const string SITE_OBJECT_TYPE = "ShelterSite"
 

Function Documentation

◆ Deconstruct()

void GetShelterVariant::Deconstruct ( )

Definition at line 120 of file Shelter.c.

◆ EEInit()

override void GetShelterVariant::EEInit ( )

Definition at line 113 of file Shelter.c.

114{
115 static const string SITE_OBJECT_TYPE = "ShelterSite";
116
117 void ShelterBase()
118 {
119 m_ShowAnimationsWhenPitched.Insert("Body");
120 m_ShowAnimationsWhenPacked.Insert("Body");
121
122 m_HalfExtents = Vector(0.8, 0.15, 1.3);
123 }
124
125 override void SetActions()
126 {
127 super.SetActions();
128
132 RemoveAction(ActionDeployObject);
133
135 }
136
137 override void EEInit()
138 {
139 super.EEInit();
140
141 TryPitch(true, true);
142 }
143
144 void Deconstruct()
145 {
147 SpawnKit();
148 Delete();
149 }
150
151 string GetMaterialPath()
152 {
153 return string.Format("%1 %2 Construction site %3 Materials", CFG_VEHICLESPATH, SITE_OBJECT_TYPE, GetShelterVariant());
154 }
155
156 string GetShelterVariant()
157 {
158 return "";
159 }
160
161 void SpawnKit()
162 {
163 ItemBase constructionKit = ItemBase.Cast(GetGame().CreateObjectEx("ShelterKit", GetPosition(), ECE_PLACE_ON_SURFACE));
164 constructionKit.SetHealth01("", "", GetHealth01());
165 }
166
167 override bool IsPlayerInside(PlayerBase player, string selection)
168 {
169 vector player_pos = player.GetPosition();
171 vector ref_dir = GetDirection();
172 ref_dir[1] = 0;
173 ref_dir.Normalize();
174
175 vector x[2];
176 vector b1, b2;
177 GetCollisionBox(x);
178 b1 = x[0];
179 b2 = x[1];
180
182 dir_to_shelter[1] = 0;
183 float len = dir_to_shelter.Length();
184
185 dir_to_shelter.Normalize();
186
187 vector ref_dir_angle = ref_dir.VectorToAngles();
188 vector dir_to_shelter_angle = dir_to_shelter.VectorToAngles();
190
191 vector test_position = test_angles.AnglesToVector() * len;
192
193 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
194 return false;
195 else
196 return true;
197 }
198}
199
200class ShelterFabric extends ShelterBase
201{
202 override string GetShelterVariant()
203 {
204 return "fabric";
205 }
206}
207
208class ShelterLeather extends ShelterBase
209{
210 override string GetShelterVariant()
211 {
212 return "leather";
213 }
214}
215
216class ShelterStick extends ShelterBase
217{
218 override string GetShelterVariant()
219 {
220 return "stick";
221 }
222}
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
void AddAction(typename actionName)
void RemoveAction(typename actionName)
const int ECE_PLACE_ON_SURFACE
Container_Base m_HalfExtents
Icon x
class ShelterBase extends TentBase GetShelterVariant()
Definition Shelter.c:90
override bool IsPlayerInside(PlayerBase player, string selection)
Definition Shelter.c:143
static const string SITE_OBJECT_TYPE
Definition Shelter.c:91
void SpawnKit()
Definition Shelter.c:137
void Deconstruct()
Definition Shelter.c:120
override void EEInit()
Definition Shelter.c:113
override void SetActions()
Definition Shelter.c:101
string GetMaterialPath()
Definition Shelter.c:127
void ShelterBase()
Definition Shelter.c:93
class JsonUndergroundAreaTriggerData GetPosition
static void SpawnConstructionMaterialPiles(notnull EntityAI entity, Man player, string cfg_path, string main_part_name, string damagezone_name="", bool is_base=false)
spawns material from any construction; 'player' parameter optional
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
const string CFG_VEHICLESPATH
Definition constants.c:209
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.

◆ GetMaterialPath()

string GetShelterVariant::GetMaterialPath ( )

Definition at line 127 of file Shelter.c.

128{
129 static const string SITE_OBJECT_TYPE = "ShelterSite";
130
131 void ShelterBase()
132 {
133 m_ShowAnimationsWhenPitched.Insert("Body");
134 m_ShowAnimationsWhenPacked.Insert("Body");
135
136 m_HalfExtents = Vector(0.8, 0.15, 1.3);
137 }
138
139 override void SetActions()
140 {
141 super.SetActions();
142
146 RemoveAction(ActionDeployObject);
147
149 }
150
151 override void EEInit()
152 {
153 super.EEInit();
154
155 TryPitch(true, true);
156 }
157
158 void Deconstruct()
159 {
161 SpawnKit();
162 Delete();
163 }
164
165 string GetMaterialPath()
166 {
167 return string.Format("%1 %2 Construction site %3 Materials", CFG_VEHICLESPATH, SITE_OBJECT_TYPE, GetShelterVariant());
168 }
169
170 string GetShelterVariant()
171 {
172 return "";
173 }
174
175 void SpawnKit()
176 {
177 ItemBase constructionKit = ItemBase.Cast(GetGame().CreateObjectEx("ShelterKit", GetPosition(), ECE_PLACE_ON_SURFACE));
178 constructionKit.SetHealth01("", "", GetHealth01());
179 }
180
181 override bool IsPlayerInside(PlayerBase player, string selection)
182 {
183 vector player_pos = player.GetPosition();
185 vector ref_dir = GetDirection();
186 ref_dir[1] = 0;
187 ref_dir.Normalize();
188
189 vector x[2];
190 vector b1, b2;
191 GetCollisionBox(x);
192 b1 = x[0];
193 b2 = x[1];
194
196 dir_to_shelter[1] = 0;
197 float len = dir_to_shelter.Length();
198
199 dir_to_shelter.Normalize();
200
201 vector ref_dir_angle = ref_dir.VectorToAngles();
202 vector dir_to_shelter_angle = dir_to_shelter.VectorToAngles();
204
205 vector test_position = test_angles.AnglesToVector() * len;
206
207 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
208 return false;
209 else
210 return true;
211 }
212}
213
214class ShelterFabric extends ShelterBase
215{
216 override string GetShelterVariant()
217 {
218 return "fabric";
219 }
220}
221
222class ShelterLeather extends ShelterBase
223{
224 override string GetShelterVariant()
225 {
226 return "leather";
227 }
228}
229
230class ShelterStick extends ShelterBase
231{
232 override string GetShelterVariant()
233 {
234 return "stick";
235 }
236}

Referenced by TentBase::Deconstruct().

◆ GetShelterVariant()

override string GetShelterVariant ( )

Definition at line 1 of file Shelter.c.

91 {
92 return "fabric";
93 }

◆ IsPlayerInside()

override bool GetShelterVariant::IsPlayerInside ( PlayerBase player,
string selection )

Definition at line 143 of file Shelter.c.

144{
145 static const string SITE_OBJECT_TYPE = "ShelterSite";
146
147 void ShelterBase()
148 {
149 m_ShowAnimationsWhenPitched.Insert("Body");
150 m_ShowAnimationsWhenPacked.Insert("Body");
151
152 m_HalfExtents = Vector(0.8, 0.15, 1.3);
153 }
154
155 override void SetActions()
156 {
157 super.SetActions();
158
162 RemoveAction(ActionDeployObject);
163
165 }
166
167 override void EEInit()
168 {
169 super.EEInit();
170
171 TryPitch(true, true);
172 }
173
174 void Deconstruct()
175 {
177 SpawnKit();
178 Delete();
179 }
180
181 string GetMaterialPath()
182 {
183 return string.Format("%1 %2 Construction site %3 Materials", CFG_VEHICLESPATH, SITE_OBJECT_TYPE, GetShelterVariant());
184 }
185
186 string GetShelterVariant()
187 {
188 return "";
189 }
190
191 void SpawnKit()
192 {
193 ItemBase constructionKit = ItemBase.Cast(GetGame().CreateObjectEx("ShelterKit", GetPosition(), ECE_PLACE_ON_SURFACE));
194 constructionKit.SetHealth01("", "", GetHealth01());
195 }
196
197 override bool IsPlayerInside(PlayerBase player, string selection)
198 {
199 vector player_pos = player.GetPosition();
201 vector ref_dir = GetDirection();
202 ref_dir[1] = 0;
203 ref_dir.Normalize();
204
205 vector x[2];
206 vector b1, b2;
207 GetCollisionBox(x);
208 b1 = x[0];
209 b2 = x[1];
210
212 dir_to_shelter[1] = 0;
213 float len = dir_to_shelter.Length();
214
215 dir_to_shelter.Normalize();
216
217 vector ref_dir_angle = ref_dir.VectorToAngles();
218 vector dir_to_shelter_angle = dir_to_shelter.VectorToAngles();
220
221 vector test_position = test_angles.AnglesToVector() * len;
222
223 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
224 return false;
225 else
226 return true;
227 }
228}
229
230class ShelterFabric extends ShelterBase
231{
232 override string GetShelterVariant()
233 {
234 return "fabric";
235 }
236}
237
238class ShelterLeather extends ShelterBase
239{
240 override string GetShelterVariant()
241 {
242 return "leather";
243 }
244}
245
246class ShelterStick extends ShelterBase
247{
248 override string GetShelterVariant()
249 {
250 return "stick";
251 }
252}

◆ SetActions()

override void GetShelterVariant::SetActions ( )

Definition at line 101 of file Shelter.c.

105{
106 override string GetShelterVariant()
107 {
108 return "stick";
109 }
110}

◆ ShelterBase()

void GetShelterVariant::ShelterBase ( )

Definition at line 93 of file Shelter.c.

97{
98 override string GetShelterVariant()
99 {

◆ SpawnKit()

void GetShelterVariant::SpawnKit ( )

Definition at line 137 of file Shelter.c.

138{
139 static const string SITE_OBJECT_TYPE = "ShelterSite";
140
141 void ShelterBase()
142 {
143 m_ShowAnimationsWhenPitched.Insert("Body");
144 m_ShowAnimationsWhenPacked.Insert("Body");
145
146 m_HalfExtents = Vector(0.8, 0.15, 1.3);
147 }
148
149 override void SetActions()
150 {
151 super.SetActions();
152
156 RemoveAction(ActionDeployObject);
157
159 }
160
161 override void EEInit()
162 {
163 super.EEInit();
164
165 TryPitch(true, true);
166 }
167
168 void Deconstruct()
169 {
171 SpawnKit();
172 Delete();
173 }
174
175 string GetMaterialPath()
176 {
177 return string.Format("%1 %2 Construction site %3 Materials", CFG_VEHICLESPATH, SITE_OBJECT_TYPE, GetShelterVariant());
178 }
179
180 string GetShelterVariant()
181 {
182 return "";
183 }
184
185 void SpawnKit()
186 {
187 ItemBase constructionKit = ItemBase.Cast(GetGame().CreateObjectEx("ShelterKit", GetPosition(), ECE_PLACE_ON_SURFACE));
188 constructionKit.SetHealth01("", "", GetHealth01());
189 }
190
191 override bool IsPlayerInside(PlayerBase player, string selection)
192 {
193 vector player_pos = player.GetPosition();
195 vector ref_dir = GetDirection();
196 ref_dir[1] = 0;
197 ref_dir.Normalize();
198
199 vector x[2];
200 vector b1, b2;
201 GetCollisionBox(x);
202 b1 = x[0];
203 b2 = x[1];
204
206 dir_to_shelter[1] = 0;
207 float len = dir_to_shelter.Length();
208
209 dir_to_shelter.Normalize();
210
211 vector ref_dir_angle = ref_dir.VectorToAngles();
212 vector dir_to_shelter_angle = dir_to_shelter.VectorToAngles();
214
215 vector test_position = test_angles.AnglesToVector() * len;
216
217 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
218 return false;
219 else
220 return true;
221 }
222}
223
224class ShelterFabric extends ShelterBase
225{
226 override string GetShelterVariant()
227 {
228 return "fabric";
229 }
230}
231
232class ShelterLeather extends ShelterBase
233{
234 override string GetShelterVariant()
235 {
236 return "leather";
237 }
238}
239
240class ShelterStick extends ShelterBase
241{
242 override string GetShelterVariant()
243 {
244 return "stick";
245 }
246}

Referenced by TentBase::Deconstruct().

Variable Documentation

◆ SITE_OBJECT_TYPE

const string SITE_OBJECT_TYPE = "ShelterSite"
static

Definition at line 91 of file Shelter.c.

Referenced by TentBase::GetMaterialPath().