Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
shelter.c
Go to the documentation of this file.
1
class
ShelterBase
extends
TentBase
2
{
3
static
const
string
SITE_OBJECT_TYPE
=
"ShelterSite"
;
4
5
void
ShelterBase
()
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
17
RemoveAction
(
ActionTogglePlaceObject
);
18
RemoveAction
(
ActionToggleTentOpen
);
19
RemoveAction
(
ActionPackTent
);
20
RemoveAction
(
ActionDeployObject
);
21
22
AddAction
(
ActionDeconstructShelter
);
23
}
24
25
override
void
EEInit
()
26
{
27
super.EEInit();
28
29
TryPitch(
true
,
true
);
30
}
31
32
void
Deconstruct
()
33
{
34
StaticConstructionMethods
.
SpawnConstructionMaterialPiles
(
this
, null,
GetMaterialPath
(),
GetShelterVariant
());
35
SpawnKit
();
36
Delete();
37
}
38
39
string
GetMaterialPath
()
40
{
41
return
string
.
Format
(
"%1 %2 Construction site %3 Materials"
,
CFG_VEHICLESPATH
,
SITE_OBJECT_TYPE
,
GetShelterVariant
());
42
}
43
44
string
GetShelterVariant
()
45
{
46
return
""
;
47
}
48
49
void
SpawnKit
()
50
{
51
ItemBase
constructionKit =
ItemBase
.Cast(
g_Game
.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();
58
vector
shelter_pos =
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
69
vector
dir_to_shelter = shelter_pos - player_pos;
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
();
76
vector
dir_to_shelter_angle = dir_to_shelter.
VectorToAngles
();
77
vector
test_angles = dir_to_shelter_angle - ref_dir_angle;
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
{
83
return
false
;
84
}
85
else
86
{
87
return
true
;
88
}
89
}
90
}
91
92
class
ShelterFabric
extends
ShelterBase
93
{
94
override
string
GetShelterVariant
()
95
{
96
return
"fabric"
;
97
}
98
}
99
100
class
ShelterLeather
extends
ShelterBase
101
{
102
override
string
GetShelterVariant
()
103
{
104
return
"leather"
;
105
}
106
}
107
108
class
ShelterStick
extends
ShelterBase
109
{
110
override
string
GetShelterVariant
()
111
{
112
return
"stick"
;
113
}
114
}
ActionDeployObject
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Definition
actiondeployobject.c:9
ActionPackTent
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
Definition
actionpacktent.c:11
AddAction
void AddAction(typename actionName)
Definition
advancedcommunication.c:220
RemoveAction
void RemoveAction(typename actionName)
Definition
advancedcommunication.c:252
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition
centraleconomy.c:37
ActionDeconstructShelter
Definition
actionpackshelter.c:2
ActionTogglePlaceObject
Definition
actiontoggleplaceobject.c:2
ActionToggleTentOpen
Definition
actiontoggletentopen.c:2
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
ShelterBase
Definition
shelter.c:101
ShelterBase::GetShelterVariant
override string GetShelterVariant()
Definition
shelter.c:102
StaticConstructionMethods
Definition
construction.c:1231
StaticConstructionMethods::SpawnConstructionMaterialPiles
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
Definition
construction.c:1233
TentBase
Definition
cartent.c:2
TentBase::GetMaterialPath
string GetMaterialPath()
Definition
shelter.c:39
TentBase::SITE_OBJECT_TYPE
static const string SITE_OBJECT_TYPE
Definition
shelter.c:3
TentBase::EEInit
override void EEInit()
Definition
shelter.c:25
TentBase::Deconstruct
void Deconstruct()
Definition
shelter.c:32
TentBase::IsPlayerInside
override bool IsPlayerInside(PlayerBase player, string selection)
Definition
shelter.c:55
TentBase::GetShelterVariant
string GetShelterVariant()
Definition
shelter.c:44
TentBase::SpawnKit
void SpawnKit()
Definition
shelter.c:49
TentBase::ShelterBase
void ShelterBase()
Definition
shelter.c:5
TentBase::SetActions
override void SetActions()
Definition
shelter.c:13
vector
Definition
enconvert.c:119
vector::Normalize
proto float Normalize()
Normalizes vector.
vector::AnglesToVector
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
vector::VectorToAngles
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
vector::Length
proto native float Length()
Returns length of vector (magnitude).
m_HalfExtents
Container_Base m_HalfExtents
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Vector
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
CFG_VEHICLESPATH
const string CFG_VEHICLESPATH
Definition
constants.c:220
GetPosition
vector GetPosition()
Get the world position of the Effect.
Definition
effect.c:473
string::Format
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.
x
Icon x
GetMaterialPath
string GetMaterialPath()
Definition
shelter.c:131
SpawnKit
void SpawnKit()
Definition
shelter.c:141
Games
Dayz
scripts
4_world
entities
itembase
tentbase
shelter.c
Generated by
1.17.0