Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionattachwheels.c
Go to the documentation of this file.
1
2
class
ActionAttachWheels
:
ActionAttach
3
{
4
int
m_wheel_hub
;
5
6
void
ActionAttachWheels
()
7
{
8
m_wheel_hub
= -1;
9
m_Text =
"#attach"
;
10
}
11
12
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
13
{
14
Object
targetObject = target.GetObject();
15
16
string
test = player.GetDisplayName();
17
string
test2 = item.GetType();
18
string
test3 = targetObject.GetDisplayName();
19
20
if
( player && targetObject && item )
21
{
22
int
componentIndex = target.GetComponentIndex();
23
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_1_1"
) )
24
{
25
Print
(
"Predni leve"
);
26
m_wheel_hub
= 0;
27
return
true
;
28
}
29
30
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_1_2"
) )
31
{
32
Print
(
"zadni leve"
);
33
m_wheel_hub
= 1;
34
return
true
;
35
}
36
37
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_1_3"
) )
38
{
39
Print
(
"prostredni leve"
);
40
m_wheel_hub
= 2;
41
return
true
;
42
}
43
44
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_1_4"
) )
45
{
46
Print
(
"druhe predni leve"
);
47
m_wheel_hub
= 3;
48
return
true
;
49
}
50
51
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_2_1"
) )
52
{
53
Print
(
"Predni prave"
);
54
m_wheel_hub
= 4;
55
return
true
;
56
}
57
58
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_2_2"
) )
59
{
60
Print
(
"zadni prave"
);
61
m_wheel_hub
= 5;
62
return
true
;
63
}
64
65
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_2_3"
) )
66
{
67
Print
(
"prostredni prave"
);
68
m_wheel_hub
= 6;
69
return
true
;
70
}
71
72
if
( targetObject.IsActionComponentPartOfSelection(componentIndex,
"wheel_2_4"
) )
73
{
74
Print
(
"druhe predni prave"
);
75
m_wheel_hub
= 7;
76
return
true
;
77
}
78
}
79
80
return
false
;
81
}
82
83
override
void
OnExecuteServer
(
ActionData
action_data )
84
{
85
EntityAI
target_entity;
86
Class
.
CastTo
(target_entity, action_data.m_Target.GetObject() );
// cast to ItemBase
87
int
slot_index = action_data.m_MainItem.GetInventory().GetSlotId(0);
88
int
test =
m_wheel_hub
;
89
if
(!target_entity.
LocalTakeEntityAsAttachmentEx
( action_data.m_MainItem, slot_index ))
90
target_entity.
LocalTakeEntityAsAttachment
( action_data.m_MainItem );
91
}
92
override
void
OnExecuteClient
(
ActionData
action_data )
93
{
94
EntityAI
target_entity;
95
Class
.
CastTo
(target_entity, action_data.m_Target.GetObject() );
// cast to ItemBase
96
int
slot_index = action_data.m_MainItem.GetInventory().GetSlotId(0);
97
int
test =
m_wheel_hub
;
98
if
(!target_entity.
LocalTakeEntityAsAttachmentEx
( action_data.m_MainItem, slot_index ))
99
target_entity.
LocalTakeEntityAsAttachment
( action_data.m_MainItem );
100
}
101
};
ActionAttach
AttachActionData ActionData ActionAttach()
Definition
actionattach.c:9
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionAttachWheels::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actionattachwheels.c:83
ActionAttachWheels::OnExecuteClient
override void OnExecuteClient(ActionData action_data)
Definition
actionattachwheels.c:92
ActionAttachWheels::ActionAttachWheels
void ActionAttachWheels()
Definition
actionattachwheels.c:6
ActionAttachWheels::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionattachwheels.c:12
ActionAttachWheels::m_wheel_hub
int m_wheel_hub
Definition
actionattachwheels.c:4
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
EntityAI
Definition
inventoryitem.c:2
EntityAI::LocalTakeEntityAsAttachmentEx
override bool LocalTakeEntityAsAttachmentEx(notnull EntityAI item, int slot)
Definition
man.c:503
EntityAI::LocalTakeEntityAsAttachment
override bool LocalTakeEntityAsAttachment(notnull EntityAI item)
Definition
man.c:464
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlayerBase
Definition
playerbaseclient.c:2
Print
proto void Print(void var)
Prints content of variable to console/log.
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
singleuse
actionattachwheels.c
Generated by
1.17.0