Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionattachpowersourcetopanel.c
Go to the documentation of this file.
1
2
class
ActionAttachPowerSourceToPanel
:
ActionSingleUseBase
3
{
4
void
ActionAttachPowerSourceToPanel
()
5
{
6
m_Text
=
"#attach"
;
7
}
8
9
override
void
CreateConditionComponents
()
10
{
11
m_ConditionItem
=
new
CCINonRuined
;
12
m_ConditionTarget
=
new
CCTNonRuined
(
UAMaxDistances
.
DEFAULT
);
13
}
14
15
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
16
{
17
EntityAI
target_entity =
EntityAI
.Cast( target.GetObject() );
18
if
( player && target_entity && item )
19
{
20
if
( target_entity.IsStaticTransmitter() && target_entity.GetInventory().AttachmentCount() == 0 )
//has any power source attachment attached
21
{
22
return
true
;
23
}
24
}
25
26
return
false
;
27
}
28
29
protected
void
OnExecuteImpl
(
ActionData
action_data )
30
{
31
EntityAI
target_entity =
EntityAI
.Cast( action_data.m_Target.GetObject() );
32
EntityAI
item_entity = action_data.m_MainItem;
33
34
//find inventory location for attachment
35
InventoryLocation
target_location =
new
InventoryLocation
;
36
if
( target_entity.GetInventory().FindFirstFreeLocationForNewEntity( item_entity.GetType(),
FindInventoryLocationType
.ATTACHMENT, target_location ) )
37
{
38
action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx( target_entity, item_entity, target_location.
GetSlot
() );
39
}
40
}
41
42
override
void
OnExecuteClient
(
ActionData
action_data )
43
{
44
ClearInventoryReservationEx
(action_data);
45
OnExecuteImpl
(action_data);
46
}
47
48
override
void
OnExecuteServer
(
ActionData
action_data )
49
{
50
if
(
g_Game
.IsMultiplayer())
51
return
;
// multiplayer handled on client side via OnExecuteClient
52
else
53
OnExecuteImpl
(action_data);
// single player
54
}
55
56
override
void
OnEndClient
(
ActionData
action_data )
57
{
58
// Probably not needed since attaching is done server side.
59
/*
60
EntityAI target_entity = EntityAI.Cast( action_data.m_Target.GetObject() );
61
EntityAI item_entity = EntityAI.Cast( action_data.m_MainItem );
62
63
//find inventory location for attachment
64
InventoryLocation target_location = new InventoryLocation;
65
66
if( target_entity.GetInventory().FindFirstFreeLocationForNewEntity( item_entity.GetType(), FindInventoryLocationType.ATTACHMENT, target_location ) )
67
{
68
//target_entity.PredictiveTakeEntityToTargetAttachmentEx( target_entity, item_entity, target_location.GetSlot() );
69
target_entity.LocalTakeEntityAsAttachmentEx( item_entity, target_location.GetSlot() );
70
}
71
*/
72
}
73
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionAttachPowerSourceToPanel::ActionAttachPowerSourceToPanel
void ActionAttachPowerSourceToPanel()
Definition
actionattachpowersourcetopanel.c:4
ActionAttachPowerSourceToPanel::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actionattachpowersourcetopanel.c:48
ActionAttachPowerSourceToPanel::OnExecuteImpl
void OnExecuteImpl(ActionData action_data)
Definition
actionattachpowersourcetopanel.c:29
ActionAttachPowerSourceToPanel::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionattachpowersourcetopanel.c:9
ActionAttachPowerSourceToPanel::OnExecuteClient
override void OnExecuteClient(ActionData action_data)
Definition
actionattachpowersourcetopanel.c:42
ActionAttachPowerSourceToPanel::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionattachpowersourcetopanel.c:15
ActionAttachPowerSourceToPanel::OnEndClient
override void OnEndClient(ActionData action_data)
Definition
actionattachpowersourcetopanel.c:56
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::ClearInventoryReservationEx
void ClearInventoryReservationEx(ActionData action_data)
Definition
actionbase.c:1040
ActionSingleUseBase::ActionSingleUseBase
void ActionSingleUseBase()
Definition
actionsingleusebase.c:31
CCINonRuined
Definition
ccinonruined.c:2
CCTNonRuined
Definition
cctnonruined.c:2
EntityAI
Definition
inventoryitem.c:2
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::GetSlot
proto native int GetSlot()
returns slot id if current type is Attachment
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
UAMaxDistances
Definition
actionconstants.c:110
UAMaxDistances::DEFAULT
const float DEFAULT
Definition
actionconstants.c:112
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
FindInventoryLocationType
FindInventoryLocationType
flags for searching locations in inventory
Definition
inventorylocation.c:18
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
singleuse
actionattachpowersourcetopanel.c
Generated by
1.17.0