DayZ 1.24
Loading...
Searching...
No Matches
Clothing Class Reference
Inheritance diagram for Clothing:
[legend]
Collaboration diagram for Clothing:
[legend]

Protected Member Functions

void InitGlobalExclusionValues ()
 
void CheckParent ()
 
override void OnWorkStart ()
 
override void OnWorkStop ()
 
override void OnWork (float consumed_energy)
 
void OnLightCreated ()
 
void CreateHeadtorchLight ()
 
void AttachLightOnHead (EntityAI person)
 
override void OnWasAttached (EntityAI parent, int slot_id)
 
override void OnWasDetached (EntityAI parent, int slot_id)
 
override void SetActions ()
 
override bool IsLightSource ()
 
override ItemBase GetLightSourceItem ()
 
override void OnInvisibleSet (bool invisible)
 

Private Member Functions

override bool CanPutInCargo (EntityAI parent)
 
override bool CanPutAsAttachment (EntityAI parent)
 
override void SetActions ()
 
override void SwitchItemSelectionTextureEx (EItemManipulationContext context, Param par=null)
 
void Headtorch_ColorBase ()
 
override void SetActions ()
 

Private Attributes

HeadtorchLight m_Light
 
ref Timer m_Timer
 

Static Private Attributes

static int REFLECTOR_ID = 4
 
static int GLASS_ID = 5
 
static string LIGHT_OFF_GLASS = "dz\\characters\\headgear\\data\\HeadTorchGlass.rvmat"
 
static string LIGHT_OFF_REFLECTOR = "dz\\characters\\headgear\\data\\HeadTorch.rvmat"
 
static string LIGHT_ON_GLASS = "dz\\characters\\headgear\\data\\HeadTorchGlass_on.rvmat"
 
static string LIGHT_ON_GLASS_RED = "dz\\characters\\headgear\\data\\HeadTorchGlass_on_red.rvmat"
 
static string LIGHT_ON_REFLECTOR = "dz\\characters\\headgear\\data\\HeadTorch_ON.rvmat"
 
static string LIGHT_ON_REFLECTOR_RED = "dz\\characters\\headgear\\data\\HeadTorch_ON_red.rvmat"
 
static vector m_OnHeadLocalPos = Vector(0.12, 0.15, 0)
 
static vector m_OnHeadLocalOri = Vector(0, 90, 0)
 
static string m_OffHeadLightPoint = "beamStart"
 
static string m_OffHeadLightTarget = "beamEnd"
 

Detailed Description

Definition at line 1 of file Armband_ColorBase.c.

Member Function Documentation

◆ AttachLightOnHead()

void Clothing::AttachLightOnHead ( EntityAI person)
inlineprotected

Definition at line 153 of file Headtorch_ColorBase.c.

154 {
155 if (person.IsPlayer())
156 {
158 int boneIdx = player.GetBoneIndexByName("Head");
159
160 if (boneIdx != -1)
161 {
162 if (m_Light.GetParent())
163 m_Light.DetachFromParent();
164
165 m_Light.SetPosition(m_OnHeadLocalPos);
166 m_Light.SetOrientation(m_OnHeadLocalOri);
167
168 player.AddChild(m_Light, boneIdx);
169 }
170 }
171 else if (person.IsZombie())
172 {
173 if (m_Light.GetParent())
174 m_Light.DetachFromParent();
175
176 m_Light.SetPosition(m_OnHeadLocalPos);
177 m_Light.SetOrientation(m_OnHeadLocalOri);
178
179 person.AddChild(m_Light, 17);
180 }
181 }
HeadtorchLight m_Light
static vector m_OnHeadLocalOri
static vector m_OnHeadLocalPos

References m_Light.

◆ CanPutAsAttachment()

override bool Clothing::CanPutAsAttachment ( EntityAI parent)
inlineprivate

Definition at line 11 of file Armband_ColorBase.c.

12 {
13 if (!super.CanPutAsAttachment(parent)) return false;
14 if (GetQuantity() <= 1)
15 return true;
16 return false;
17 }
override float GetQuantity()
Definition ItemBase.c:7995

References GetQuantity().

◆ CanPutInCargo()

override bool Clothing::CanPutInCargo ( EntityAI parent)
inlineprivate

Definition at line 3 of file Armband_ColorBase.c.

4 {
5 if (!super.CanPutInCargo(parent)) return false;
6 if (GetNumberOfItems() == 0 || !parent || parent.IsMan())
7 return true;
8 return false;
9 }
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Definition ItemBase.c:8059
override bool IsMan()
Definition Man.c:33

References GetNumberOfItems(), and EntityAI::IsMan().

◆ CheckParent()

void Clothing::CheckParent ( )
inlineprotected

Definition at line 39 of file Headtorch_ColorBase.c.

40 {
41 EntityAI owner = GetHierarchyParent();
42
43 // Spawn a battery in the headtorch if it's attached on a zombie and switch it on
44 if (owner && owner.IsZombie())
45 {
46 GetInventory().CreateAttachment("Battery9V");
47 GetCompEM().SwitchOn();
48 }
49
50 if (m_Timer)
51 m_Timer.Stop();
52
53 m_Timer = null;
54 }
ref Timer m_Timer

References m_Timer.

◆ CreateHeadtorchLight()

void Clothing::CreateHeadtorchLight ( )
inlineprotected

Definition at line 116 of file Headtorch_ColorBase.c.

117 {
118 if (!m_Light)
119 m_Light = HeadtorchLight.Cast(ScriptedLightBase.CreateLight(HeadtorchLight, "0 0 0"));
120
122
123 m_Light.PerformVisibilityCheck(this);
124
125 EntityAI owner = GetHierarchyParent();
126
127 if (owner)
128 {
129 if (owner.IsPlayer())
130 {
132 ItemBase att_item = owner_PB.GetItemOnSlot("Eyewear");
133
134 if (att_item == this)
136 else
137 m_Light.AttachOnMemoryPoint(this, m_OffHeadLightPoint, m_OffHeadLightTarget);
138 }
139 else if (owner.IsZombie())
140 {
142 EntityAI item_EAI = owner.GetInventory().FindAttachment(slot_id);
144
145 if (item_IB == this)
147 }
148 }
149 else
150 m_Light.AttachOnMemoryPoint(this, m_OffHeadLightPoint, m_OffHeadLightTarget);
151 }
static string m_OffHeadLightTarget
void AttachLightOnHead(EntityAI person)
static string m_OffHeadLightPoint
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

References InventorySlots::GetSlotIdFromString(), and m_Light.

◆ GetLightSourceItem()

override ItemBase Clothing::GetLightSourceItem ( )
inlineprotected

Definition at line 224 of file Headtorch_ColorBase.c.

225 {
226 return this;
227 }

◆ Headtorch_ColorBase()

void Clothing::Headtorch_ColorBase ( )
inlineprivate

Definition at line 22 of file Headtorch_ColorBase.c.

23 {
24 if (GetGame().IsServer())
25 {
26 if (!m_Timer)
28
29 m_Timer.Run(1, this, "CheckParent", NULL, false);
30 }
31 }
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

References CALL_CATEGORY_SYSTEM, GetGame(), and m_Timer.

◆ InitGlobalExclusionValues()

void Clothing::InitGlobalExclusionValues ( )
inlineprotected

Definition at line 33 of file Headtorch_ColorBase.c.

34 {
35 super.InitGlobalExclusionValues();
36 AddSingleExclusionValueGlobal(EAttExclusions.EXCLUSION_HEADSTRAP_0);
37 }

◆ IsLightSource()

override bool Clothing::IsLightSource ( )
inlineprotected

Definition at line 219 of file Headtorch_ColorBase.c.

220 {
221 return true;
222 }

◆ OnInvisibleSet()

override void Clothing::OnInvisibleSet ( bool invisible)
inlineprotected

Definition at line 229 of file Headtorch_ColorBase.c.

230 {
231 if (m_Light)
232 m_Light.SetEnabled(!invisible);
233 }

References m_Light.

◆ OnLightCreated()

void Clothing::OnLightCreated ( )
inlineprotected

Definition at line 111 of file Headtorch_ColorBase.c.

112 {
113 m_Light.SetColorToWhite();
114 }

References m_Light, and PointLightBase::SetColorToWhite().

◆ OnWasAttached()

override void Clothing::OnWasAttached ( EntityAI parent,
int slot_id )
inlineprotected

Definition at line 183 of file Headtorch_ColorBase.c.

184 {
185 super.OnWasAttached(parent, slot_id);
186
187 PlayerBase player = PlayerBase.Cast(parent);
188
189 if (player)
190 {
191 if (m_Light)
193 }
194 }

References m_Light.

◆ OnWasDetached()

override void Clothing::OnWasDetached ( EntityAI parent,
int slot_id )
inlineprotected

Definition at line 196 of file Headtorch_ColorBase.c.

197 {
198 super.OnWasDetached(parent, slot_id);
199
200 if (parent && (parent.IsPlayer() || parent.IsZombie()))
201 {
202 if (m_Light)
203 {
204 m_Light.DetachFromParent();
205 m_Light.AttachOnMemoryPoint(this, m_OffHeadLightPoint, m_OffHeadLightTarget);
206 }
207 }
208 }

References m_Light.

◆ OnWork()

override void Clothing::OnWork ( float consumed_energy)
inlineprotected

Definition at line 91 of file Headtorch_ColorBase.c.

92 {
93 super.OnWork(consumed_energy);
94
95 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
96 {
97 Battery9V battery = Battery9V.Cast(GetCompEM().GetEnergySource());
98
99 if (battery && m_Light)
100 {
101 float efficiency = battery.GetEfficiency0To1();
102
103 if (efficiency < 1)
104 m_Light.SetIntensity(efficiency, GetCompEM().GetUpdateInterval());
105 else
106 m_Light.SetIntensity(1, 0);
107 }
108 }
109 }

References GetGame(), m_Light, and PointLightBase::SetIntensity().

◆ OnWorkStart()

override void Clothing::OnWorkStart ( )
inlineprotected

Definition at line 56 of file Headtorch_ColorBase.c.

57 {
58 super.OnWorkStart();
59
60 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
62
63 if (IsInherited(Headtorch_Black))
64 {
65 SetObjectMaterial(GLASS_ID, LIGHT_ON_GLASS_RED);
66 SetObjectMaterial(REFLECTOR_ID, LIGHT_ON_REFLECTOR_RED);
67 }
68 else
69 {
70 SetObjectMaterial(GLASS_ID, LIGHT_ON_GLASS);
71 SetObjectMaterial(REFLECTOR_ID, LIGHT_ON_REFLECTOR);
72 }
73 }
static string LIGHT_ON_GLASS
static int GLASS_ID
static string LIGHT_ON_REFLECTOR_RED
static string LIGHT_ON_REFLECTOR
void CreateHeadtorchLight()
static int REFLECTOR_ID
static string LIGHT_ON_GLASS_RED

References GetGame().

◆ OnWorkStop()

override void Clothing::OnWorkStop ( )
inlineprotected

Definition at line 75 of file Headtorch_ColorBase.c.

76 {
77 super.OnWorkStop();
78
79 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // Client side
80 {
81 if (m_Light)
82 m_Light.FadeOut();
83
84 m_Light = NULL;
85 }
86
87 SetObjectMaterial(GLASS_ID, LIGHT_OFF_GLASS);
88 SetObjectMaterial(REFLECTOR_ID, LIGHT_OFF_REFLECTOR);
89 }
static string LIGHT_OFF_REFLECTOR
static string LIGHT_OFF_GLASS

References GetGame(), and m_Light.

◆ SetActions() [1/3]

override void Clothing::SetActions ( )
inlineprivate

Definition at line 19 of file Armband_ColorBase.c.

20 {
21 super.SetActions();
23 }
void AddAction(typename actionName)

References AddAction().

◆ SetActions() [2/3]

◆ SetActions() [3/3]

override void Clothing::SetActions ( )
inlineprivate

Definition at line 3 of file WitchHood.c.

4 {
5 super.SetActions();
7 }

References AddAction().

◆ SwitchItemSelectionTextureEx()

override void Clothing::SwitchItemSelectionTextureEx ( EItemManipulationContext context,
Param par = null )
inlineprivate

Definition at line 25 of file Armband_ColorBase.c.

26 {
27 super.SwitchItemSelectionTextureEx(context, par);
28
30 {
32 if (!data)
33 return;
34
35 PlayerBase player = data.param1;
36
37 int selection_idx = -1;
38 string texture;
39
42
43 //has top
44 if (player.FindAttachmentBySlotName("Body"))
45 {
46 show_selections.Insert("camoMale_big_a");
47 show_selections.Insert("camoMale_big_b");
48 show_selections.Insert("camoFemale_big_a");
49 show_selections.Insert("camoFemale_big_b");
50
51 hide_selections.Insert("camoMale_small_a");
52 hide_selections.Insert("camoMale_small_b");
53 hide_selections.Insert("camoFemale_small_a");
54 hide_selections.Insert("camoFemale_small_b");
55 }
56 //has no top
57 else
58 {
59 hide_selections.Insert("camoMale_big_a");
60 hide_selections.Insert("camoMale_big_b");
61 hide_selections.Insert("camoFemale_big_a");
62 hide_selections.Insert("camoFemale_big_b");
63
64 show_selections.Insert("camoMale_small_a");
65 show_selections.Insert("camoMale_small_b");
66 show_selections.Insert("camoFemale_small_a");
67 show_selections.Insert("camoFemale_small_b");
68 }
69
70 int i;
71 for (i = 0; i < show_selections.Count(); i++)
72 {
73 selection_idx = GetHiddenSelectionIndex(show_selections[i]);
74 texture = GetHiddenSelectionsData().GetHiddenSelectionsTextures()[selection_idx];
75 SetObjectTexture(selection_idx, texture);
76 }
77
78 for (i = 0; i < hide_selections.Count(); i++)
79 {
80 selection_idx = GetHiddenSelectionIndex(hide_selections[i]);
81 SetObjectTexture(selection_idx, "");
82 }
83 }
84 }

Member Data Documentation

◆ GLASS_ID

int Clothing::GLASS_ID = 5
staticprivate

Definition at line 6 of file Headtorch_ColorBase.c.

◆ LIGHT_OFF_GLASS

string Clothing::LIGHT_OFF_GLASS = "dz\\characters\\headgear\\data\\HeadTorchGlass.rvmat"
staticprivate

Definition at line 8 of file Headtorch_ColorBase.c.

◆ LIGHT_OFF_REFLECTOR

string Clothing::LIGHT_OFF_REFLECTOR = "dz\\characters\\headgear\\data\\HeadTorch.rvmat"
staticprivate

Definition at line 9 of file Headtorch_ColorBase.c.

◆ LIGHT_ON_GLASS

string Clothing::LIGHT_ON_GLASS = "dz\\characters\\headgear\\data\\HeadTorchGlass_on.rvmat"
staticprivate

Definition at line 10 of file Headtorch_ColorBase.c.

◆ LIGHT_ON_GLASS_RED

string Clothing::LIGHT_ON_GLASS_RED = "dz\\characters\\headgear\\data\\HeadTorchGlass_on_red.rvmat"
staticprivate

Definition at line 11 of file Headtorch_ColorBase.c.

◆ LIGHT_ON_REFLECTOR

string Clothing::LIGHT_ON_REFLECTOR = "dz\\characters\\headgear\\data\\HeadTorch_ON.rvmat"
staticprivate

Definition at line 12 of file Headtorch_ColorBase.c.

◆ LIGHT_ON_REFLECTOR_RED

string Clothing::LIGHT_ON_REFLECTOR_RED = "dz\\characters\\headgear\\data\\HeadTorch_ON_red.rvmat"
staticprivate

Definition at line 13 of file Headtorch_ColorBase.c.

◆ m_Light

HeadtorchLight Clothing::m_Light
private

Definition at line 3 of file Headtorch_ColorBase.c.

◆ m_OffHeadLightPoint

string Clothing::m_OffHeadLightPoint = "beamStart"
staticprivate

Definition at line 17 of file Headtorch_ColorBase.c.

◆ m_OffHeadLightTarget

string Clothing::m_OffHeadLightTarget = "beamEnd"
staticprivate

Definition at line 18 of file Headtorch_ColorBase.c.

◆ m_OnHeadLocalOri

vector Clothing::m_OnHeadLocalOri = Vector(0, 90, 0)
staticprivate

Definition at line 16 of file Headtorch_ColorBase.c.

◆ m_OnHeadLocalPos

vector Clothing::m_OnHeadLocalPos = Vector(0.12, 0.15, 0)
staticprivate

Definition at line 15 of file Headtorch_ColorBase.c.

◆ m_Timer

ref Timer Clothing::m_Timer
private

Definition at line 20 of file Headtorch_ColorBase.c.

◆ REFLECTOR_ID

int Clothing::REFLECTOR_ID = 4
staticprivate

Definition at line 5 of file Headtorch_ColorBase.c.


The documentation for this class was generated from the following files: