Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
cablereel.c
Go to the documentation of this file.
1
class
CableReel
extends
ItemBase
2
{
3
bool
m_ForceIntoHands
;
4
5
static
const
string
SEL_CORD_FOLDED
=
"cord_folded"
;
6
static
const
string
SEL_CORD_PLUGGED
=
"cord_plugged"
;
7
8
void
CableReel
()
9
{
10
m_ForceIntoHands
=
false
;
11
}
12
13
override
bool
IsElectricAppliance
()
14
{
15
return
true
;
16
}
17
18
void
ForceIntoHandsNow
(
PlayerBase
player)
19
{
20
m_ForceIntoHands
=
true
;
21
player.LocalTakeEntityToHands(
this
);
// Local, because ForceIntoHandsNow is executed on both, Client and Server
22
m_ForceIntoHands
=
false
;
23
}
24
25
override
bool
CanPutInCargo
(
EntityAI
parent)
26
{
27
if
(!super.CanPutInCargo(parent))
28
return
false
;
29
30
EntityAI
owner = GetHierarchyParent();
31
if
(owner && owner.IsKindOf(
"Fence"
))
32
return
true
;
33
34
bool
allowIntoInventory = !GetCompEM().IsPlugged();
35
return
allowIntoInventory;
36
}
37
38
override
bool
CanPutIntoHands
(
EntityAI
parent)
39
{
40
if
(!super.CanPutIntoHands(parent))
41
return
false
;
42
43
if
(
m_ForceIntoHands
)
44
{
45
return
true
;
46
}
47
else
48
{
49
EntityAI
owner = GetHierarchyParent();
50
if
(owner && owner.IsKindOf(
"Fence"
))
51
return
true
;
52
}
53
54
return
true
;
55
}
56
57
// Event called on item when it is placed in the player(Man) inventory, passes the owner as a parameter
58
override
void
OnInventoryEnter
(Man player)
59
{
60
super.OnInventoryEnter(player);
61
62
PlayerBase
playerPB =
PlayerBase
.Cast(player);
63
if
(playerPB.GetItemInHands() ==
this
&& GetCompEM().IsPlugged())
64
return
;
65
66
GetCompEM().UnplugAllDevices();
67
68
if
(!playerPB.IsPlacingLocal())
69
GetCompEM().UnplugThis();
70
}
71
72
override
bool
CanRemoveFromHands
(
EntityAI
parent)
73
{
74
return
true
;
75
}
76
77
//================================================================
78
// ADVANCED PLACEMENT
79
//================================================================
80
81
override
void
OnPlacementStarted
(Man player)
82
{
83
super.OnPlacementStarted(player);
84
85
array<string>
selections = {
86
SEL_CORD_PLUGGED
,
87
SEL_CORD_FOLDED
88
};
89
90
PlayerBase
playerPB =
PlayerBase
.Cast(player);
91
if
(
g_Game
.IsMultiplayer() &&
g_Game
.IsServer())
92
playerPB.GetHologramServer().SetSelectionToRefresh(selections);
93
else
94
playerPB.GetHologramLocal().SetSelectionToRefresh(selections);
95
}
96
97
override
string
GetDeploySoundset
()
98
{
99
return
"placeCableReel_SoundSet"
;
100
}
101
102
override
void
SetActions
()
103
{
104
super.SetActions();
105
106
RemoveAction
(
ActionTakeItemToHands
);
107
108
AddAction
(
ActionPlugIn
);
109
AddAction
(
ActionPlugTargetIntoThis
);
110
AddAction
(
ActionTogglePlaceObject
);
111
AddAction
(
ActionPullOutPlug
);
112
AddAction
(
ActionUnplugThisByCord
);
113
AddAction
(
ActionRepositionPluggedItem
);
114
AddAction
(
ActionPlaceObject
);
115
AddAction
(
ActionTakeItemToHands
);
116
}
117
}
ActionPlaceObject
ActionPlaceObjectCB ActiondeployObjectCB ActionPlaceObject()
Definition
actionplaceobject.c:11
AddAction
void AddAction(typename actionName)
Definition
advancedcommunication.c:220
RemoveAction
void RemoveAction(typename actionName)
Definition
advancedcommunication.c:252
ActionPlugIn
Definition
actionplugin.c:2
ActionPlugTargetIntoThis
Definition
actionplugtargetintothis.c:2
ActionPullOutPlug
Definition
actionpulloutplug.c:2
ActionRepositionPluggedItem
Definition
actionrepositionpluggeditem.c:2
ActionTakeItemToHands
Definition
actiontakeitemtohands.c:2
ActionTogglePlaceObject
Definition
actiontoggleplaceobject.c:2
ActionUnplugThisByCord
Definition
actionunplugthisbycord.c:2
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
ItemBase::GetDeploySoundset
override string GetDeploySoundset()
Definition
cablereel.c:97
ItemBase::ForceIntoHandsNow
void ForceIntoHandsNow(PlayerBase player)
Definition
cablereel.c:18
ItemBase::CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition
cablereel.c:25
ItemBase::SEL_CORD_FOLDED
const string SEL_CORD_FOLDED
Definition
batterycharger.c:11
ItemBase::CanPutIntoHands
override bool CanPutIntoHands(EntityAI parent)
Definition
cablereel.c:38
ItemBase::IsElectricAppliance
override bool IsElectricAppliance()
Definition
cablereel.c:13
ItemBase::CableReel
void CableReel()
Definition
cablereel.c:8
ItemBase::OnPlacementStarted
override void OnPlacementStarted(Man player)
Definition
cablereel.c:81
ItemBase::OnInventoryEnter
override void OnInventoryEnter(Man player)
Definition
cablereel.c:58
ItemBase::SEL_CORD_PLUGGED
const string SEL_CORD_PLUGGED
Definition
batterycharger.c:10
ItemBase::CanRemoveFromHands
override bool CanRemoveFromHands(EntityAI parent)
Definition
cablereel.c:72
ItemBase::m_ForceIntoHands
bool m_ForceIntoHands
Definition
cablereel.c:3
ItemBase::SetActions
override void SetActions()
Definition
cablereel.c:102
PlayerBase
Definition
playerbaseclient.c:2
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Games
Dayz
scripts
4_world
entities
itembase
cablereel.c
Generated by
1.17.0