Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
burlapsackcover.c
Go to the documentation of this file.
1
class
BurlapSackCover
extends
HeadGear_Base
2
{
3
protected
PlayerBase
m_Player
;
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
(
g_Game
.IsDedicatedServer() && newLoc.GetType() ==
InventoryLocationType
.GROUND)
18
{
19
EntityAI
newItem =
EntityAI
.Cast(
g_Game
.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
if
(slot_id ==
InventorySlots
.HEADGEAR)
30
g_Game
.GetCallQueue(
CALL_CATEGORY_SYSTEM
).CallLater(
HandleAttachedToHead
, 0);
31
}
32
33
override
bool
CanPutInCargo
(
EntityAI
parent)
34
{
35
if
(!super.CanPutInCargo(parent))
36
return
false
;
37
38
if
(parent && parent !=
this
)
39
return
true
;
40
41
return
false
;
42
}
43
44
override
bool
CanDetachAttachment
(
EntityAI
parent)
45
{
46
return
false
;
47
}
48
49
protected
void
OnRemovedFromHead
(
PlayerBase
player)
50
{
51
if
((!
g_Game
.IsServer() || !
g_Game
.IsMultiplayer()) &&
PlayerBase
.Cast(
g_Game
.GetPlayer()) == player)
// Client side
52
{
53
PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Stop();
54
player.SetInventorySoftLock(
false
);
55
player.SetMasterAttenuation(
""
);
56
}
57
58
if
(
g_Game
.IsServer() ||
g_Game
.IsMultiplayer())
// Server side or single player
59
SetInvisibleRecursive(
false
, player, {
InventorySlots
.MASK,
InventorySlots
.EYEWEAR});
60
}
61
62
override
protected
set<int>
GetAttachmentExclusionInitSlotValue
(
int
slotId)
63
{
64
set<int> ret = super.GetAttachmentExclusionInitSlotValue(slotId);
65
if
(slotId ==
InventorySlots
.HEADGEAR)
66
{
67
ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
68
}
69
return
ret;
70
}
71
72
protected
void
HandleAttachedToHead
()
73
{
74
Class
.
CastTo
(
m_Player
, GetHierarchyRootPlayer());
75
if
(!
m_Player
)
76
return
;
77
78
if
(!
g_Game
.IsServer() || !
g_Game
.IsMultiplayer())
// Client side
79
{
80
if
(
m_Player
&&
PlayerBase
.Cast(
g_Game
.GetPlayer()) ==
m_Player
)
81
{
82
PPERequesterBase
ppeRB = PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects);
83
if
(ppeRB)
84
ppeRB.
Start
();
85
86
m_Player
.SetInventorySoftLock(
true
);
87
m_Player
.SetMasterAttenuation(
"BurlapSackAttenuation"
);
88
89
if
(
g_Game
.GetUIManager().IsMenuOpen(
MENU_INVENTORY
))
90
g_Game
.GetMission().HideInventory();
91
}
92
}
93
94
if
(
g_Game
.IsServer() ||
g_Game
.IsMultiplayer())
// Server side or single player
95
SetInvisibleRecursive(
true
,
m_Player
, {
InventorySlots
.MASK,
InventorySlots
.EYEWEAR});
96
}
97
}
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition
centraleconomy.c:37
RF_DEFAULT
const int RF_DEFAULT
Definition
centraleconomy.c:65
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
EntityAI
Definition
inventoryitem.c:2
HeadGear_Base
hard helmet base
Definition
baseballcap_colorbase.c:2
HeadGear_Base::~BurlapSackCover
void ~BurlapSackCover()
Definition
burlapsackcover.c:5
HeadGear_Base::OnRemovedFromHead
void OnRemovedFromHead(PlayerBase player)
Definition
burlapsackcover.c:49
HeadGear_Base::m_Player
PlayerBase m_Player
Definition
burlapsackcover.c:3
HeadGear_Base::CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition
burlapsackcover.c:33
HeadGear_Base::EEItemLocationChanged
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition
burlapsackcover.c:13
HeadGear_Base::OnWasAttached
override void OnWasAttached(EntityAI parent, int slot_id)
Definition
burlapsackcover.c:25
HeadGear_Base::GetAttachmentExclusionInitSlotValue
set< int > GetAttachmentExclusionInitSlotValue(int slotId)
Definition
burlapsackcover.c:62
HeadGear_Base::CanDetachAttachment
override bool CanDetachAttachment(EntityAI parent)
Definition
burlapsackcover.c:44
HeadGear_Base::HandleAttachedToHead
void HandleAttachedToHead()
Definition
burlapsackcover.c:72
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventorySlots
provides access to slot configuration
Definition
inventoryslots.c:6
PPERequesterBase
Definition
pperequestplatformsbase.c:3
PPERequesterBase::Start
void Start(Param par=null)
Definition
pperequestplatformsbase.c:38
PlayerBase
Definition
playerbaseclient.c:2
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
MENU_INVENTORY
const int MENU_INVENTORY
Definition
constants.c:180
CALL_CATEGORY_SYSTEM
const int CALL_CATEGORY_SYSTEM
Definition
tools.c:8
InventoryLocationType
InventoryLocationType
types of Inventory Location
Definition
inventorylocation.c:4
Games
Dayz
scripts
4_world
entities
itembase
clothing
burlapsackcover.c
Generated by
1.17.0