DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Shelter.c
См. документацию.
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
24
25 override void EEInit()
26 {
27 super.EEInit();
28
29 TryPitch(true, true);
30 }
31
33 {
35 }
36
37 void DeconstructEx(bool createdItemsFall = false)
38 {
40 SpawnKitEx(createdItemsFall);
41 Delete();
42 }
43
45 {
46 return string.Format("%1 %2 Construction site %3 Materials", CFG_VEHICLESPATH, SITE_OBJECT_TYPE, GetShelterVariant());
47 }
48
50 {
51 return "";
52 }
53
54 void SpawnKit()
55 {
56 SpawnKitEx();
57 }
58
59 void SpawnKitEx(bool shouldKitFall = false)
60 {
61 ItemBase constructionKit = ItemBase.Cast(g_Game.CreateObjectEx("ShelterKit", GetPosition(), ECE_PLACE_ON_SURFACE));
62 constructionKit.SetHealth01("", "", GetHealth01());
63
64 if (shouldKitFall)
65 constructionKit.ThrowPhysically(null, vector.Zero);
66 }
67
68 override bool IsPlayerInside(PlayerBase player, string selection)
69 {
70 vector player_pos = player.GetPosition();
71 vector shelter_pos = GetPosition();
72 vector ref_dir = GetDirection();
73 ref_dir[1] = 0;
74 ref_dir.Normalize();
75
76 vector x[2];
77 vector b1,b2;
78 GetCollisionBox(x);
79 b1 = x[0];
80 b2 = x[1];
81
82 vector dir_to_shelter = shelter_pos - player_pos;
83 dir_to_shelter[1] = 0;
84 float len = dir_to_shelter.Length();
85
86 dir_to_shelter.Normalize();
87
88 vector ref_dir_angle = ref_dir.VectorToAngles();
89 vector dir_to_shelter_angle = dir_to_shelter.VectorToAngles();
90 vector test_angles = dir_to_shelter_angle - ref_dir_angle;
91
92 vector test_position = test_angles.AnglesToVector() * len;
93
94 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2 )
95 {
96 return false;
97 }
98 else
99 {
100 return true;
101 }
102 }
103
104 override void OnItemFallRebuilding()
105 {
106 if (!g_Game.IsServer() || m_IsFalling)
107 return;
108
109 DropCargoItems();
110 DeconstructEx(true);
111 m_IsFalling = true;
112
113 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ClearIsFalling, 800);
114 }
115}
116
117class ShelterFabric extends ShelterBase
118{
119 override string GetShelterVariant()
121 return "fabric";
123}
124
125class ShelterLeather extends ShelterBase
126{
127 override string GetShelterVariant()
128 {
129 return "leather";
131}
132
133class ShelterStick extends ShelterBase
134{
135 override string GetShelterVariant()
136 {
137 return "stick";
138 }
139}
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Определения ActionDeployObject.c:9
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
Определения ActionPackTent.c:11
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:38
Container_Base m_HalfExtents
DayZGame g_Game
Определения DayZGame.c:4074
Icon x
void DeconstructEx(bool createdItemsFall=false)
Определения Shelter.c:154
void SpawnKitEx(bool shouldKitFall=false)
Определения Shelter.c:176
string GetMaterialPath()
Определения Shelter.c:161
bool m_IsFalling
Определения TrapBase.c:48
void ClearIsFalling()
Определения TrapBase.c:723
Определения PlayerBaseClient.c:2
override string GetShelterVariant()
Определения Shelter.c:127
Определения Shelter.c:126
static void SpawnConstructionMaterialPilesEx(notnull EntityAI entity, Man player, string cfgPath, string mainPartName, string damagezoneName="", bool isBase=false, bool throwPiles=false)
spawns material from any construction; 'player' parameter optional; 'main_part_name' is actually a PA...
Определения ConstructionBase.c:1809
Deprecated.
Определения ConstructionBase.c:1807
void SpawnKitEx(bool shouldKitFall=false)
Определения Shelter.c:59
static const string SITE_OBJECT_TYPE
Определения Shelter.c:3
override void SetActions()
Определения Shelter.c:13
override void OnItemFallRebuilding()
Определения Shelter.c:104
void ShelterBase()
Определения Shelter.c:5
override void EEInit()
Определения Shelter.c:25
string GetMaterialPath()
Определения Shelter.c:44
override bool IsPlayerInside(PlayerBase player, string selection)
Определения Shelter.c:68
void SpawnKit()
Определения Shelter.c:54
void DeconstructEx(bool createdItemsFall=false)
Определения Shelter.c:37
void Deconstruct()
Определения Shelter.c:32
string GetShelterVariant()
Определения Shelter.c:49
Определения CarTent.c:2
proto native float Length()
Returns length of vector (magnitude)
static const vector Zero
Определения EnConvert.c:123
proto float Normalize()
Normalizes vector. Returns length.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
Определения EnConvert.c:119
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
const string CFG_VEHICLESPATH
Определения 3_Game/DayZ/constants.c:228
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
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.
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8