DayZ 1.24
Loading...
Searching...
No Matches
Clothing_Base.c
Go to the documentation of this file.
1// I know the filename is stupid, but it's what the other files in this structure use..
2// And I can't really make it "class Clothing_Base extends Clothing"
3// since that will conflict with config and other parts of script and break mods :c
5{
6 override bool IsClothing()
7 {
8 return true;
9 }
10
11 override bool CanHaveWetness()
12 {
13 return true;
14 }
15
18 {
19 return -1;
20 }
21
22 //----------------------------------------------------------------
23 // GameplayWidgetEffects
25 {
26 return null;
27 }
28
29 // Conditions
30 override bool CanPutInCargo(EntityAI parent)
31 {
32 if (!super.CanPutInCargo(parent))
33 return false;
34
35 return !parent || CanPutInCargoClothingConditions(parent);
36 }
37
39 {
40 bool is_hidden_stash_exception = false;
41
42 if (parent.IsInherited(UndergroundStash))
44
45 if (GetNumberOfItems() == 0 || !parent || parent.IsMan() || is_hidden_stash_exception)
46 {
47 EntityAI cargoParent = parent.GetHierarchyParent();
49 if (cargoParent)
50 return !(parent.IsClothing() && cargoParent.IsClothing()) || (parentClothing && parentClothing.SmershException(cargoParent));
51
52 return true;
53 }
54
55 return false;
56 }
57
59 {
60 if (!super.CanReceiveItemIntoCargo(item))
61 return false;
62
63 return CanReceiveItemIntoCargoClothingConditions(item);
64 }
65
67 {
68 EntityAI hierarchyParent = GetHierarchyParent();
69 return !hierarchyParent || hierarchyParent.IsMan() || SmershException(hierarchyParent);
70 }
71
72 //Kind of a hack but I don't have enough time left to do larger scale reworks, sorry
74 {
75 EntityAI hp = hierarchyParent.GetHierarchyParent();
76 if (hp)
77 {
78 if (!hp.IsMan())
79 return false;
80 }
81
82 return IsInherited(SmershBag) && hierarchyParent.IsInherited(SmershVest);
83 }
84
86 {
87 if (!super.CanLoadItemIntoCargo(item))
88 return false;
89
90 return CanLoadItemIntoCargoClothingConditions(item);
91 }
92
94 {
95 EntityAI parent = GetHierarchyParent();
96
97 if (parent && parent.IsInherited(UndergroundStash))
98 return true;
99
100 return !parent || parent.IsMan() || SmershException(parent);
101 }
102
103 //Method used to specify if a piece of eyeware can be worn under a gas mask
106 {
107 return true;
108 }
109
110 // -------------------------------------------------------------------------
111 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
112 {
113 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
114 if (!GetGame().IsDedicatedServer())
115 {
116 PlayerBase player_owner = PlayerBase.Cast(GetHierarchyParent());
117
118 if (player_owner)
119 {
120 if (player_owner.m_CorpseState != 0)
121 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(player_owner.UpdateCorpseState, 0, false);
122 }
123 }
124 }
125
127 {
128 super.SwitchItemSelectionTextureEx(context, par);
129
131 if (!data)
132 return;
133
134 PlayerBase player = data.param1;
135
136 int personality = GetHiddenSelectionIndex("personality");
137 if (personality >= 0)
138 {
139 string tone_mat = player.m_EmptyGloves.GetHiddenSelectionsMaterials().Get(0);
140 string tone_texture;
141
142 if (player.m_CorpseState > PlayerConstants.CORPSE_STATE_FRESH)
143 tone_texture = player.m_DecayedTexture;
144 else
145 tone_texture = player.m_EmptyGloves.GetHiddenSelectionsTextures().Get(0);
146
147 SetObjectMaterial(personality, tone_mat);
148 SetObjectTexture(personality, tone_texture);
149 }
150 }
151};
152
154//intermediate types//
156class Belt_Base : Clothing {};
157class Backpack_Base : Clothing {};
159{
160 override protected void InitGlobalExclusionValues()
161 {
162 super.InitGlobalExclusionValues();
163
164 AddSingleExclusionValueGlobal(EAttExclusions.EXCLUSION_GLASSES_REGULAR_0);
165 }
166};
167class Gloves_Base : Clothing {};
168class HeadGear_Base : Clothing {};
169class Mask_Base : Clothing
170{
172 {
173 set<int> ret = super.GetAttachmentExclusionInitSlotValue(slotId);
174 if (slotId == InventorySlots.MASK)
175 ret.Insert(EAttExclusions.SHAVING_MASK_ATT_0);
176 return ret;
177 }
178};
179class Pants_Base : Clothing {};
180class Shoes_Base : Clothing {};
181class Top_Base : Clothing {};
182class Vest_Base : Clothing {};
183
Clothing ClothingBase
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Definition ItemBase.c:8059
array< int > GetEffectWidgetTypes()
bool CanPutInCargoClothingConditions(EntityAI parent)
bool CanWearUnderMask(EntityAI parent)
deprecated
bool CanReceiveItemIntoCargoClothingConditions(EntityAI item)
override bool CanHaveWetness()
bool CanLoadItemIntoCargoClothingConditions(EntityAI item)
override void SwitchItemSelectionTextureEx(EItemManipulationContext context, Param par=null)
override bool CanPutInCargo(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool CanLoadItemIntoCargo(EntityAI item)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
bool SmershException(EntityAI hierarchyParent)
int GetGlassesEffectID()
Used for 'glasses' (and other colored layers triggered by attach/detach in the InventorySlots....
override bool IsClothing()
override bool IsMan()
Definition Man.c:33
void InitGlobalExclusionValues()
hard helmet base
provides access to slot configuration
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
static const int CORPSE_STATE_FRESH
proto native CGame GetGame()
const int CALL_CATEGORY_GUI
Definition tools.c:9