DayZ 1.24
Loading...
Searching...
No Matches
Shelter.c
Go to the documentation of this file.
1class ShelterBase extends TentBase
2{
3 static const string SITE_OBJECT_TYPE = "ShelterSite";
4
6 {
7 m_ShowAnimationsWhenPitched.Insert("Body");
8 m_ShowAnimationsWhenPacked.Insert("Body");
9
10 m_HalfExtents = Vector(0.8, 0.15, 1.3);
11 }
12
13 override void SetActions()
14 {
15 super.SetActions();
16
20 RemoveAction(ActionDeployObject);
21
23 }
24
25 override void EEInit()
26 {
27 super.EEInit();
28
29 TryPitch(true, true);
30 }
31
38
40 {
41 return string.Format("%1 %2 Construction site %3 Materials", CFG_VEHICLESPATH, SITE_OBJECT_TYPE, GetShelterVariant());
42 }
43
45 {
46 return "";
47 }
48
49 void SpawnKit()
50 {
51 ItemBase constructionKit = ItemBase.Cast(GetGame().CreateObjectEx("ShelterKit", GetPosition(), ECE_PLACE_ON_SURFACE));
52 constructionKit.SetHealth01("", "", GetHealth01());
53 }
54
55 override bool IsPlayerInside(PlayerBase player, string selection)
56 {
57 vector player_pos = player.GetPosition();
59 vector ref_dir = GetDirection();
60 ref_dir[1] = 0;
61 ref_dir.Normalize();
62
63 vector x[2];
64 vector b1, b2;
65 GetCollisionBox(x);
66 b1 = x[0];
67 b2 = x[1];
68
70 dir_to_shelter[1] = 0;
71 float len = dir_to_shelter.Length();
72
73 dir_to_shelter.Normalize();
74
75 vector ref_dir_angle = ref_dir.VectorToAngles();
78
79 vector test_position = test_angles.AnglesToVector() * len;
80
81 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2)
82 return false;
83 else
84 return true;
85 }
86}
87
88class ShelterFabric extends ShelterBase
89{
90 override string GetShelterVariant()
91 {
92 return "fabric";
93 }
94}
95
97{
98 override string GetShelterVariant()
99 {
100 return "leather";
102}
103
104class ShelterStick extends ShelterBase
105{
106 override string GetShelterVariant()
107 {
108 return "stick";
109 }
110}
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
static const string SITE_OBJECT_TYPE
Definition Shelter.c:91
void SpawnKit()
Definition Shelter.c:137
string GetMaterialPath()
Definition Shelter.c:127
class JsonUndergroundAreaTriggerData GetPosition
override string GetShelterVariant()
Definition Shelter.c:98
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
override void SetActions()
Definition Shelter.c:13
void ShelterBase()
Definition Shelter.c:5
override void EEInit()
Definition Shelter.c:25
string GetMaterialPath()
Definition Shelter.c:39
override bool IsPlayerInside(PlayerBase player, string selection)
Definition Shelter.c:55
void SpawnKit()
Definition Shelter.c:49
void Deconstruct()
Definition Shelter.c:32
string GetShelterVariant()
Definition Shelter.c:44
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.