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