Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
burlapsackcover.c
Go to the documentation of this file.
1class BurlapSackCover extends HeadGear_Base
2{
4
5 void ~BurlapSackCover()
6 {
7 if (m_Player)
8 {
9 OnRemovedFromHead(m_Player);
10 }
11 }
12
13 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
14 {
15 super.EEItemLocationChanged(oldLoc,newLoc);
16
17 if (GetGame().IsDedicatedServer() && newLoc.GetType() == InventoryLocationType.GROUND)
18 {
19 EntityAI newItem = EntityAI.Cast(GetGame().CreateObjectEx("BurlapSack",newLoc.GetPos(),ECE_PLACE_ON_SURFACE,RF_DEFAULT));
20 MiscGameplayFunctions.TransferItemProperties(this,newItem);
21 DeleteSafe();
22 }
23 }
24
25 override void OnWasAttached(EntityAI parent, int slot_id)
26 {
27 super.OnWasAttached(parent, slot_id);
28
29 Class.CastTo(m_Player, parent.GetHierarchyRootPlayer());
30
31 if ((!GetGame().IsDedicatedServer()) && m_Player && m_Player.IsControlledPlayer() && slot_id == InventorySlots.HEADGEAR)
32 {
33 PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Start();
34 m_Player.SetInventorySoftLock(true);
35 m_Player.SetMasterAttenuation("BurlapSackAttenuation");
36
37 if (GetGame().GetUIManager().IsMenuOpen(MENU_INVENTORY))
38 {
39 GetGame().GetMission().HideInventory();
40 }
41 }
42 SetInvisibleRecursive(true,m_Player,{InventorySlots.MASK,InventorySlots.EYEWEAR});
43 }
44
45 override bool CanPutInCargo( EntityAI parent )
46 {
47 if (!super.CanPutInCargo(parent))
48 return false;
49
50 if (parent && parent != this)
51 return true;
52
53 return false;
54 }
55
56 override bool CanDetachAttachment( EntityAI parent )
57 {
58 return false;
59 }
60
61 void OnRemovedFromHead(PlayerBase player)
62 {
63 if (player.IsControlledPlayer())
64 {
65 PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Stop();
66 player.SetInventorySoftLock(false);
67 player.SetMasterAttenuation("");
68 }
69 SetInvisibleRecursive(false,player,{InventorySlots.MASK,InventorySlots.EYEWEAR});
70 }
71
72 override protected set<int> GetAttachmentExclusionInitSlotValue(int slotId)
73 {
74 set<int> ret = super.GetAttachmentExclusionInitSlotValue(slotId);
75 if (slotId == InventorySlots.HEADGEAR)
76 {
77 ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
78 }
79 return ret;
80 }
81}
const int ECE_PLACE_ON_SURFACE
const int RF_DEFAULT
Super root of all classes in Enforce script.
Definition enscript.c:11
hard helmet base
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
InventoryLocation.
provides access to slot configuration
override bool CanPutInCargo(EntityAI parent)
proto native CGame GetGame()
const int MENU_INVENTORY
Definition constants.c:180
DayZPlayer m_Player
Definition hand_events.c:42
InventoryLocationType
types of Inventory Location
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)