Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actiontakefireplaceindoor.c
Go to the documentation of this file.
1
2
class
ActionTakeFireplaceIndoor
:
ActionInteractBase
3
{
4
string
m_NewItemTypeName
=
"Fireplace"
;
5
6
void
ActionTakeFireplaceIndoor
()
7
{
8
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_PICKUP_HANDS;
9
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_CROUCH |
DayZPlayerConstants
.STANCEMASK_ERECT;
10
m_Text
=
"#take_fireplace"
;
11
}
12
13
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
14
{
15
Object
target_object = target.GetObject();
16
17
//empty hands --interact action base condition
18
if
( target_object && target_object.IsFireplace() )
19
{
20
FireplaceIndoor
fireplace_indoor =
FireplaceIndoor
.Cast( target_object );
21
22
if
( fireplace_indoor && !fireplace_indoor.HasAshes() && !fireplace_indoor.IsBurning() && fireplace_indoor.IsCargoEmpty() && !fireplace_indoor.DirectCookingSlotsInUse() )
23
{
24
InventoryLocation
targetIL =
new
InventoryLocation
;
25
bool
found = player.GetInventory().FindFirstFreeLocationForNewEntity(
m_NewItemTypeName
,
FindInventoryLocationType
.ANY, targetIL );
26
return
found;
27
}
28
}
29
30
return
false
;
31
}
32
33
override
void
OnExecuteServer
(
ActionData
action_data )
34
{
35
Object
target_object = action_data.m_Target.GetObject();
36
FireplaceIndoor
fireplace_indoor =
FireplaceIndoor
.Cast( target_object );
37
38
TakeFireplaceFromIndoorLambda
lambda( fireplace_indoor,
m_NewItemTypeName
, action_data.m_Player );
39
InventoryLocation
targetIL =
new
InventoryLocation
;
40
bool
found = action_data.m_Player.GetInventory().FindFirstFreeLocationForNewEntity(
m_NewItemTypeName
,
FindInventoryLocationType
.ANY, targetIL );
41
if
( found )
42
{
43
// allow action only if there is place in inventory
44
lambda.OverrideNewLocation( targetIL );
45
action_data.m_Player.ServerReplaceItemWithNew( lambda );
46
}
47
}
48
}
49
50
class
TakeFireplaceFromIndoorLambda
:
ReplaceItemWithNewLambdaBase
51
{
52
PlayerBase
m_Player
;
53
54
void
TakeFireplaceFromIndoorLambda
(
EntityAI
old_item,
string
new_item_type,
PlayerBase
player )
55
{
56
m_Player
= player;
57
}
58
59
override
void
CopyOldPropertiesToNew
( notnull
EntityAI
old_item,
EntityAI
new_item )
60
{
61
super.CopyOldPropertiesToNew( old_item, new_item );
62
63
MiscGameplayFunctions.TransferInventory(old_item, new_item,
m_Player
);
64
}
65
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
TakeFireplaceFromIndoorLambda
void TakeFireplaceFromIndoorLambda(EntityAI old_item, string new_item_type, PlayerBase player)
Definition
actiontakefireplaceindoor.c:54
ActionTarget
class ActionTargets ActionTarget
m_Player
map m_Player
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionInteractBase::ActionInteractBase
void ActionInteractBase()
Definition
actioninteractbase.c:43
ActionTakeFireplaceIndoor::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actiontakefireplaceindoor.c:33
ActionTakeFireplaceIndoor::m_NewItemTypeName
string m_NewItemTypeName
Definition
actiontakefireplaceindoor.c:4
ActionTakeFireplaceIndoor::ActionTakeFireplaceIndoor
void ActionTakeFireplaceIndoor()
Definition
actiontakefireplaceindoor.c:6
ActionTakeFireplaceIndoor::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actiontakefireplaceindoor.c:13
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
EntityAI
Definition
inventoryitem.c:2
FireplaceIndoor
Definition
fireplaceindoor.c:2
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlayerBase
Definition
playerbaseclient.c:2
ReplaceItemWithNewLambdaBase
base class for transformation operations (creating one item from another)
Definition
replaceitemwithnewlambdabase.c:5
ReplaceItemWithNewLambdaBase::CopyOldPropertiesToNew
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Definition
replaceitemwithnewlambdabase.c:193
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
FindInventoryLocationType
FindInventoryLocationType
flags for searching locations in inventory
Definition
inventorylocation.c:18
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
interact
actiontakefireplaceindoor.c
Generated by
1.17.0