DayZ 1.24
Loading...
Searching...
No Matches
ActionTakeFireplaceFromBarrel.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
7 m_Text = "#take_fireplace";
8 }
9
10 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
11 {
12 Object target_object = target.GetObject();
13
14 if (target_object && target_object.IsFireplace())
15 {
17
18 //check barrel fireplace state
19 if (fireplace_barrel && fireplace_barrel.IsOpen() && !fireplace_barrel.HasAshes() && !fireplace_barrel.IsBurning())
20 {
21 //check cargo and attachments
22 if (fireplace_barrel.IsCargoEmpty() && fireplace_barrel.GetInventory().AttachmentCount() > 0)
23 return true;
24 }
25 }
26
27 return false;
28 }
29
31 {
32 Object target_object = action_data.m_Target.GetObject();
34
35 string newTypeName = "Fireplace";
37 bool found = action_data.m_Player.GetInventory().FindFirstFreeLocationForNewEntity(newTypeName, FindInventoryLocationType.ANY, targetIL);
38 if (found)
39 {
40 // allow action only if there is place in inventory
42 lambda.OverrideNewLocation(targetIL);
43 action_data.m_Player.ServerReplaceItemWithNew(lambda);
44 }
45 }
46}
47
49{
51
56
57 override protected void RemoveOldItemFromLocation()
58 {
59 // intentional no-operation
60 m_RemoveFromLocationPassed = true; // but indicate the operation to be success
61 }
62 override protected void UndoRemoveOldItemFromLocation()
63 {
64 // undo nothing
65 }
66
68 {
69 super.CopyOldPropertiesToNew(old_item, new_item);
70
72 }
73
74 override protected void DeleteOldEntity()
75 {
76 // intentional no-operation
77 }
78
79 override protected void CreateNetworkObjectInfo(EntityAI new_item)
80 {
81 super.CreateNetworkObjectInfo(new_item);
82 GetGame().RemoteObjectTreeCreate(m_OldItem); // re-create network for old item
83 }
84}
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
void TakeFireplaceFromBarrelLambda(EntityAI old_item, string new_item_type, PlayerBase player)
DayZPlayer m_Player
Definition Hand_Events.c:42
FindInventoryLocationType
flags for searching locations in inventory
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnExecuteServer(ActionData action_data)
InventoryLocation.
base class for transformation operations (creating one item from another)
void RemoveOldItemFromLocation()
Step B. - free location for new item @NOTE this operation does not delete the object,...
void DeleteOldEntity()
Step F. - deletes physically old item.
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
void CreateNetworkObjectInfo(EntityAI new_item)
Step G. - create NetworkObjectInfo for new item.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()