Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actiondestroypart.c
Go to the documentation of this file.
1
class
ActionDestroyPartCB
:
ActionContinuousBaseCB
2
{
3
override
void
CreateActionComponent
()
4
{
5
m_ActionData
.m_ActionComponent =
new
CAContinuousRepeat
(
UATimeSpent
.
DEFAULT_DESTROY
/
ActionDestroyPart
.Cast(
m_ActionData
.m_Action).
CYCLES
);
6
}
7
};
8
9
class
ActionDestroyPart
:
ActionContinuousBase
10
{
11
static
int
CYCLES
= 4;
12
13
void
ActionDestroyPart
()
14
{
15
m_CallbackClass
=
ActionDestroyPartCB
;
16
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONFB_DISASSEMBLE;
17
m_FullBody
=
true
;
18
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ERECT;
19
20
m_SpecialtyWeight
= UASoftSkillsWeight.ROUGH_HIGH;
21
m_Text
=
"#destroy"
;
22
}
23
24
override
void
CreateConditionComponents
()
25
{
26
m_ConditionItem
=
new
CCINonRuined
;
27
m_ConditionTarget
=
new
CCTNone
;
28
}
29
30
override
void
OnActionInfoUpdate
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
31
{
32
ConstructionActionData
construction_action_data = player.GetConstructionActionData();
33
m_Text
=
"#destroy "
+ construction_action_data.
GetTargetPart
();
34
}
35
36
override
bool
CanBeUsedLeaning
()
37
{
38
return
false
;
39
}
40
41
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
42
{
43
//Action not allowed if player has broken legs
44
if
(player.GetBrokenLegs() ==
eBrokenLegs
.BROKEN_LEGS)
45
return
false
;
46
47
return
DestroyCondition
( player, target, item,
true
);
48
}
49
50
override
bool
ActionConditionContinue
(
ActionData
action_data )
51
{
52
return
DestroyCondition
( action_data.m_Player, action_data.m_Target, action_data.m_MainItem ,
false
);
53
}
54
55
override
void
OnFinishProgressServer
(
ActionData
action_data )
56
{
57
BaseBuildingBase
base_building =
BaseBuildingBase
.Cast( action_data.m_Target.GetObject() );
58
Construction
construction = base_building.GetConstruction();
59
ConstructionActionData
construction_action_data = action_data.m_Player.GetConstructionActionData();
60
ConstructionPart
construction_part = construction_action_data.
GetTargetPart
();
61
62
if
( construction.CanDestroyPart( construction_part.
GetPartName
() ) )
63
{
64
//build
65
string
part_name = construction_part.
GetPartName
();
66
string
zone_name;
67
DamageSystem.GetDamageZoneFromComponentName(base_building,part_name,zone_name);
68
69
if
(zone_name !=
""
)
70
{
71
base_building.AddHealth(zone_name,
"Health"
,-(base_building.GetMaxHealth(zone_name,
""
)/
CYCLES
));
72
if
( base_building.GetHealth(zone_name,
"Health"
) < 1 )
73
construction.DestroyPartServer( action_data.m_Player, construction_part.
GetPartName
(),
AT_DESTROY_PART
);
74
}
75
else
76
{
77
construction.DestroyPartServer( action_data.m_Player, construction_part.
GetPartName
(),
AT_DESTROY_PART
);
78
}
79
80
//add damage to tool
81
action_data.m_MainItem.DecreaseHealth(
UADamageApplied
.
DESTROY
,
false
);
82
}
83
}
84
85
protected
bool
DestroyCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item,
bool
camera_check )
86
{
87
Object
target_object = target.GetObject();
88
if
( target_object && target_object.CanUseConstruction() )
89
{
90
string
part_name = target_object.GetActionComponentName( target.GetComponentIndex() );
91
92
BaseBuildingBase
base_building =
BaseBuildingBase
.Cast( target_object );
93
Construction
construction = base_building.GetConstruction();
94
ConstructionPart
construction_part = construction.GetConstructionPartToDestroy( part_name );
95
96
if
( construction_part )
97
{
98
//camera and position checks
99
if
( !player.GetInputController().CameraIsFreeLook() &&
IsInReach
(player, target,
UAMaxDistances
.
DEFAULT
) && !player.GetInputController().CameraIsFreeLook() )
100
{
101
//Camera check (client-only)
102
if
( camera_check )
103
{
104
if
(
g_Game
&& ( !
g_Game
.IsDedicatedServer() ) )
105
{
106
if
( !base_building.
IsFacingCamera
( part_name ) )
107
{
108
return
false
;
109
}
110
}
111
}
112
113
ConstructionActionData
construction_action_data = player.GetConstructionActionData();
114
construction_action_data.
SetTargetPart
( construction_part );
115
116
return
true
;
117
}
118
}
119
}
120
121
return
false
;
122
}
123
124
override
string
GetAdminLogMessage
(
ActionData
action_data)
125
{
126
return
" destroyed "
+ action_data.m_Target.GetObject().GetDisplayName() +
" with "
+ action_data.m_MainItem.GetDisplayName();
127
}
128
}
AT_DESTROY_PART
const int AT_DESTROY_PART
Definition
_constants.c:8
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBaseCB::m_ActionData
ActionData m_ActionData
Definition
animatedactionbase.c:3
ActionBase::m_FullBody
bool m_FullBody
Definition
actionbase.c:67
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::IsInReach
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition
actionbase.c:1181
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_SpecialtyWeight
float m_SpecialtyWeight
Definition
actionbase.c:83
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionContinuousBaseCB
Definition
actioncontinuousbase.c:2
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionDestroyPartCB
Definition
actiondestroypart.c:2
ActionDestroyPartCB::CreateActionComponent
override void CreateActionComponent()
Definition
actiondestroypart.c:3
ActionDestroyPart
Definition
actiondestroypart.c:10
ActionDestroyPart::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actiondestroypart.c:55
ActionDestroyPart::CanBeUsedLeaning
override bool CanBeUsedLeaning()
Definition
actiondestroypart.c:36
ActionDestroyPart::ActionConditionContinue
override bool ActionConditionContinue(ActionData action_data)
Definition
actiondestroypart.c:50
ActionDestroyPart::OnActionInfoUpdate
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actiondestroypart.c:30
ActionDestroyPart::GetAdminLogMessage
override string GetAdminLogMessage(ActionData action_data)
Definition
actiondestroypart.c:124
ActionDestroyPart::CreateConditionComponents
override void CreateConditionComponents()
Definition
actiondestroypart.c:24
ActionDestroyPart::CYCLES
static int CYCLES
Definition
actiondestroypart.c:11
ActionDestroyPart::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actiondestroypart.c:41
ActionDestroyPart::DestroyCondition
bool DestroyCondition(PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
Definition
actiondestroypart.c:85
ActionDestroyPart::ActionDestroyPart
void ActionDestroyPart()
Definition
actiondestroypart.c:13
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
BaseBuildingBase
Definition
fence.c:2
BaseBuildingBase::IsFacingCamera
override bool IsFacingCamera(string selection)
Definition
fence.c:678
CAContinuousRepeat
Definition
cacontinuousrepeat.c:2
CCINonRuined
Definition
ccinonruined.c:2
CCTNone
Definition
cctnone.c:2
ConstructionActionData
Definition
constructionactiondata.c:2
ConstructionActionData::GetTargetPart
ConstructionPart GetTargetPart()
Definition
constructionactiondata.c:93
ConstructionActionData::SetTargetPart
void SetTargetPart(ConstructionPart target_part)
Definition
constructionactiondata.c:88
ConstructionPart
Definition
constructionpart.c:2
ConstructionPart::GetPartName
string GetPartName()
Definition
constructionpart.c:30
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlayerBase
Definition
playerbaseclient.c:2
UADamageApplied
Definition
actionconstants.c:147
UADamageApplied::DESTROY
const float DESTROY
Definition
actionconstants.c:151
UAMaxDistances
Definition
actionconstants.c:110
UAMaxDistances::DEFAULT
const float DEFAULT
Definition
actionconstants.c:112
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::DEFAULT_DESTROY
const float DEFAULT_DESTROY
Definition
actionconstants.c:36
Construction
void Construction(BaseBuildingBase parent)
Definition
construction.c:26
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
eBrokenLegs
eBrokenLegs
Definition
ebrokenlegs.c:2
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actiondestroypart.c
Generated by
1.17.0