Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionunpackbox.c
Go to the documentation of this file.
1
class
ActionUnpackBoxCB
:
ActionContinuousBaseCB
2
{
3
override
void
CreateActionComponent
()
4
{
5
m_ActionData
.m_ActionComponent =
new
CAContinuousTime
(
UATimeSpent
.
UNPACK
);
6
}
7
};
8
9
class
ActionUnpackBox
:
ActionContinuousBase
10
{
11
void
ActionUnpackBox
()
12
{
13
m_CallbackClass
=
ActionUnpackBoxCB
;
14
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_OPENITEM;
15
m_CommandUIDProne
=
DayZPlayerConstants
.CMD_ACTIONFB_OPENITEM;
16
m_SpecialtyWeight
= UASoftSkillsWeight.PRECISE_LOW;
17
m_Text
=
"#unbox"
;
18
}
19
20
override
void
CreateConditionComponents
()
21
{
22
m_ConditionItem
=
new
CCINonRuined
;
23
m_ConditionTarget
=
new
CCTNone
;
24
}
25
26
override
bool
HasProneException
()
27
{
28
return
true
;
29
}
30
31
override
bool
HasTarget
()
32
{
33
return
false
;
34
}
35
36
override
void
OnFinishProgressServer
(
ActionData
action_data )
37
{
38
if
( action_data.m_MainItem && action_data.m_MainItem.GetHierarchyRootPlayer() == action_data.m_Player )
39
{
40
string
path
=
"CfgVehicles "
+ action_data.m_MainItem.GetType();
41
string
child_name =
""
;
42
int
count;
43
array<string>
resources =
new
array<string>
;
44
45
if
(
g_Game
.ConfigIsExisting(
path
) &&
g_Game
.ConfigIsExisting(
path
+
" Resources"
) )
46
{
47
path
=
path
+
" Resources"
;
48
count =
g_Game
.ConfigGetChildrenCount (
path
);
49
for
(
int
i = 0; i < count; i++)
50
{
51
g_Game
.ConfigGetChildName (
path
, i, child_name );
52
53
if
(
g_Game
.ConfigGetInt(
path
+
" "
+ child_name +
" value"
) )
54
{
55
resources.Insert( child_name );
56
}
57
}
58
59
//TODO modify to allow for multiple ammo types spawning (if needed??)
60
string
itemType = resources.Get(0);
61
int
itemCount =
g_Game
.ConfigGetInt(
path
+
" "
+ itemType +
" value"
);
62
63
UnboxLambda
lambda =
new
UnboxLambda
(action_data.m_MainItem, itemType, action_data.m_Player, itemCount);
64
action_data.m_Player.ServerReplaceItemInHandsWithNew(lambda);
65
}
66
}
67
}
68
};
69
70
class
UnboxLambda
:
ReplaceItemWithNewLambdaBase
71
{
72
int
m_ItemCount
;
73
void
UnboxLambda
(
EntityAI
old_item,
string
new_item_type,
PlayerBase
player,
int
count) {
m_ItemCount
= count; }
74
75
override
void
CopyOldPropertiesToNew
(notnull
EntityAI
old_item,
EntityAI
new_item)
76
{
77
super.CopyOldPropertiesToNew(old_item, new_item);
78
79
if
(
g_Game
.ConfigIsExisting(
"CfgMagazines "
+
m_NewItemType
) )
80
{
81
Magazine pile;
82
Class
.
CastTo
(pile, new_item);
83
pile.ServerSetAmmoCount(
m_ItemCount
);
84
}
85
else
86
{
87
ItemBase
unboxed;
88
Class
.
CastTo
(unboxed, new_item);
89
unboxed.
SetQuantity
(
m_ItemCount
);
90
}
91
}
92
93
override
void
OnSuccess
(
EntityAI
new_item)
94
{
95
super.OnSuccess(new_item);
96
97
//spawns wrapping Paper
98
ItemBase
paper =
ItemBase
.Cast(
g_Game
.CreateObjectEx(
"Paper"
, new_item.GetHierarchyRoot().GetPosition(),
ECE_PLACE_ON_SURFACE
) );
99
}
100
};
101
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition
centraleconomy.c:37
ActionBaseCB::m_ActionData
ActionData m_ActionData
Definition
animatedactionbase.c:3
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
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
ActionContinuousBaseCB
Definition
actioncontinuousbase.c:2
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionUnpackBoxCB
Definition
actionunpackbox.c:2
ActionUnpackBoxCB::CreateActionComponent
override void CreateActionComponent()
Definition
actionunpackbox.c:3
ActionUnpackBox::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actionunpackbox.c:36
ActionUnpackBox::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionunpackbox.c:20
ActionUnpackBox::HasTarget
override bool HasTarget()
Definition
actionunpackbox.c:31
ActionUnpackBox::ActionUnpackBox
void ActionUnpackBox()
Definition
actionunpackbox.c:11
ActionUnpackBox::HasProneException
override bool HasProneException()
Definition
actionunpackbox.c:26
AnimatedActionBase::m_CommandUIDProne
int m_CommandUIDProne
Definition
animatedactionbase.c:144
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
CAContinuousTime
Definition
cacontinuoustime.c:2
CCINonRuined
Definition
ccinonruined.c:2
CCTNone
Definition
cctnone.c:2
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
ItemBase::SetQuantity
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Definition
pileofwoodenplanks.c:88
PlayerBase
Definition
playerbaseclient.c:2
ReplaceItemWithNewLambdaBase::ReplaceItemWithNewLambdaBase
void ReplaceItemWithNewLambdaBase(EntityAI old_item, string new_item_type)
Definition
replaceitemwithnewlambdabase.c:13
ReplaceItemWithNewLambdaBase::m_NewItemType
string m_NewItemType
Definition
replaceitemwithnewlambdabase.c:7
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::UNPACK
const float UNPACK
Definition
actionconstants.c:86
UnboxLambda
Definition
actionunpackbox.c:71
UnboxLambda::CopyOldPropertiesToNew
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Definition
actionunpackbox.c:75
UnboxLambda::OnSuccess
override void OnSuccess(EntityAI new_item)
Definition
actionunpackbox.c:93
UnboxLambda::m_ItemCount
int m_ItemCount
Definition
actionunpackbox.c:72
UnboxLambda::UnboxLambda
void UnboxLambda(EntityAI old_item, string new_item_type, PlayerBase player, int count)
Definition
actionunpackbox.c:73
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
path
string path
Definition
optionselectormultistate.c:142
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionunpackbox.c
Generated by
1.17.0