Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actiondetachpowersourcefrompanel.c
Go to the documentation of this file.
1
2
class
ActionDetachPowerSourceFromPanel
:
ActionInteractBase
3
{
4
void
ActionDetachPowerSourceFromPanel
()
5
{
6
m_Text
=
"#detach_power_source"
;
7
}
8
9
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
10
{
11
Object
target_object = target.GetObject();
12
13
if
( player && target_object )
14
{
15
EntityAI
target_entity =
EntityAI
.Cast( target.GetObject() );
16
string
selection = target_object.GetActionComponentName( target.GetComponentIndex() );
17
18
19
if
( target_entity && target_entity.GetInventory() && target_entity.GetInventory().AttachmentCount() > 0 && selection ==
"power_source"
)
//has any power source attachment attached
20
{
21
return
true
;
22
}
23
}
24
25
return
false
;
26
}
27
28
override
void
OnExecuteClient
(
ActionData
action_data )
29
{
30
Process
(action_data);
31
}
32
33
override
void
OnExecuteServer
(
ActionData
action_data )
34
{
35
Process
(action_data);
36
}
37
38
void
Process
(
ActionData
action_data )
39
{
40
EntityAI
target_entity =
EntityAI
.Cast( action_data.m_Target.GetObject() );
41
42
EntityAI
attachment;
43
int
attachments_count = target_entity.GetInventory().AttachmentCount();
44
for
(
int
j = 0; j < attachments_count; j++ )
//find any attached power source
45
{
46
// @TODO: vezme prvni att?
47
attachment = target_entity.GetInventory().GetAttachmentFromIndex( j );
48
if
( attachment )
49
break
;
50
}
51
52
if
( attachment )
53
{
54
action_data.m_Player.PredictiveTakeEntityToHands(attachment );
55
}
56
}
57
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionDetachPowerSourceFromPanel::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actiondetachpowersourcefrompanel.c:33
ActionDetachPowerSourceFromPanel::OnExecuteClient
override void OnExecuteClient(ActionData action_data)
Definition
actiondetachpowersourcefrompanel.c:28
ActionDetachPowerSourceFromPanel::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actiondetachpowersourcefrompanel.c:9
ActionDetachPowerSourceFromPanel::ActionDetachPowerSourceFromPanel
void ActionDetachPowerSourceFromPanel()
Definition
actiondetachpowersourcefrompanel.c:4
ActionDetachPowerSourceFromPanel::Process
void Process(ActionData action_data)
Definition
actiondetachpowersourcefrompanel.c:38
ActionInteractBase::ActionInteractBase
void ActionInteractBase()
Definition
actioninteractbase.c:43
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlayerBase
Definition
playerbaseclient.c:2
Process
void Process()
Definition
effectmanager.c:743
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
interact
actiondetachpowersourcefrompanel.c
Generated by
1.17.0