Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionfoldentitytoslot.c
Go to the documentation of this file.
1
class
ActionFoldEntityToSlot
:
ActionSingleUseBase
2
{
3
int
m_SlotID
=
InventorySlots
.
INVALID
;
4
5
override
void
CreateConditionComponents
()
6
{
7
m_ConditionItem
=
new
CCINonRuined
;
8
m_ConditionTarget
=
new
CCTNone
;
9
}
10
11
override
bool
HasTarget
() {
return
false
; }
12
13
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
14
{
15
EntityAI
att = player.GetInventory().FindAttachment(
m_SlotID
);
16
if
( item && att == null )
17
return
true
;
18
return
false
;
19
}
20
21
override
bool
ActionConditionContinue
(
ActionData
action_data ) {
return
true
; }
22
23
override
void
OnExecuteClient
(
ActionData
action_data )
24
{
25
ClearInventoryReservationEx
(action_data);
26
}
27
28
override
void
OnExecuteServer
(
ActionData
action_data )
29
{
30
if
( !
g_Game
.IsMultiplayer() )
31
ClearInventoryReservationEx
(action_data);
32
33
ItemBase
old_item = action_data.m_MainItem;
34
if
(old_item.ConfigIsExisting(
"ChangeIntoOnAttach"
))
35
{
36
string
slot_name =
InventorySlots
.
GetSlotName
(
m_SlotID
);
37
string
str = old_item.ChangeIntoOnAttach(slot_name);
38
if
(str !=
""
)
39
{
40
FoldBandanaToSlotLambda
lambda =
new
FoldBandanaToSlotLambda
(action_data.m_MainItem, str, action_data.m_Player,
m_SlotID
);
41
action_data.m_Player.ServerReplaceItemInHandsWithNewElsewhere(lambda);
42
}
43
}
44
}
45
};
46
47
class
FoldBandanaToSlotLambda
:
TurnItemIntoItemLambda
48
{
49
void
FoldBandanaToSlotLambda
(
EntityAI
old_item,
string
new_item_type,
PlayerBase
player,
int
slot)
50
{
51
InventoryLocation
targetAtt =
new
InventoryLocation
;
52
targetAtt.
SetAttachment
(player, NULL, slot);
53
OverrideNewLocation(targetAtt);
54
}
55
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
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
ActionFoldEntityToSlot
Definition
actionfoldentitytoslot.c:2
ActionFoldEntityToSlot::ActionConditionContinue
override bool ActionConditionContinue(ActionData action_data)
Definition
actionfoldentitytoslot.c:21
ActionFoldEntityToSlot::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actionfoldentitytoslot.c:28
ActionFoldEntityToSlot::m_SlotID
int m_SlotID
Definition
actionfoldentitytoslot.c:3
ActionFoldEntityToSlot::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionfoldentitytoslot.c:5
ActionFoldEntityToSlot::OnExecuteClient
override void OnExecuteClient(ActionData action_data)
Definition
actionfoldentitytoslot.c:23
ActionFoldEntityToSlot::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionfoldentitytoslot.c:13
ActionFoldEntityToSlot::HasTarget
override bool HasTarget()
Definition
actionfoldentitytoslot.c:11
ActionSingleUseBase::ActionSingleUseBase
void ActionSingleUseBase()
Definition
actionsingleusebase.c:31
CCINonRuined
Definition
ccinonruined.c:2
CCTNone
Definition
cctnone.c:2
EntityAI
Definition
inventoryitem.c:2
FoldBandanaToSlotLambda
Definition
actionfoldentitytoslot.c:48
FoldBandanaToSlotLambda::FoldBandanaToSlotLambda
void FoldBandanaToSlotLambda(EntityAI old_item, string new_item_type, PlayerBase player, int slot)
Definition
actionfoldentitytoslot.c:49
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::SetAttachment
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
InventorySlots
provides access to slot configuration
Definition
inventoryslots.c:6
InventorySlots::GetSlotName
static proto native owned string GetSlotName(int id)
InventorySlots::INVALID
const int INVALID
Invalid slot (-1).
Definition
inventoryslots.c:17
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
TurnItemIntoItemLambda
Definition
miscgameplayfunctions.c:92
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
singleuse
actionfoldentitytoslot.c
Generated by
1.17.0