Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actiontakeovenindoor.c
Go to the documentation of this file.
1
3{
4 string m_NewItemTypeName = "Fireplace";
5
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 OvenIndoor fireplace_indoor = OvenIndoor.Cast( target_object );
21
22 if ( fireplace_indoor && !fireplace_indoor.HasAshes() && !fireplace_indoor.IsBurning() && fireplace_indoor.IsCargoEmpty() && !fireplace_indoor.DirectCookingSlotsInUse() )
23 {
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 OvenIndoor fireplace_indoor = OvenIndoor.Cast( target_object );
37
38 TakeOvenFromIndoorLambda lambda( fireplace_indoor, m_NewItemTypeName, action_data.m_Player );
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
51{
53
54 void TakeOvenFromIndoorLambda ( 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}
void TakeOvenFromIndoorLambda(EntityAI old_item, string new_item_type, PlayerBase player)
int m_StanceMask
Definition actionbase.c:62
string m_Text
Definition actionbase.c:58
InventoryLocation.
base class for transformation operations (creating one item from another)
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
DayZPlayer m_Player
Definition hand_events.c:42
FindInventoryLocationType
flags for searching locations in inventory