DayZ 1.24
Loading...
Searching...
No Matches
ReplaceItemWithNewLambda Class Reference

adds automatic QuickBar handling More...

Inheritance diagram for ReplaceItemWithNewLambda:
[legend]
Collaboration diagram for ReplaceItemWithNewLambda:
[legend]

Private Member Functions

void TurnItemIntoItemLambda (EntityAI old_item, string new_item_type, PlayerBase player)
 
void SetTransferParams (bool transfer_agents=true, bool transfer_variables=true, bool transfer_health=true, bool exclude_quantity=false, float quantity_override=-1)
 
override void CopyOldPropertiesToNew (notnull EntityAI old_item, EntityAI new_item)
 
override void VerifyItemTypeBySlotType ()
 if attaching from att.slot to att.slot, skips the change to "ground" version. Allows for correct property transfers.
 
override void OnSuccess (EntityAI new_item)
 
void ReplaceItemWithNewLambda (EntityAI old_item, string new_item_type, PlayerBase player)
 
override void CopyOldPropertiesToNew (notnull EntityAI old_item, EntityAI new_item)
 
override void OnSuccess (EntityAI new_item)
 
- Private Member Functions inherited from ReplaceItemWithNewLambdaBase
bool WantCreateNewEntity ()
 
bool CanExecuteLambda ()
 
bool PrepareLocations ()
 Step A. - prepare inventory locations.
 
void RemoveOldItemFromLocation ()
 Step B. - free location for new item @NOTE this operation does not delete the object, only removes it from inventory location.
 
void UndoRemoveOldItemFromLocation ()
 
void RemoveNetworkObjectInfo ()
 Step C. - remove network part of the object @NOTE this operation does not delete the object, only removes its network part (and deletes it on client)
 
void UndoRemoveNetworkObjectInfo ()
 
EntityAI CreateNewEntity ()
 Step D. - create new entity (LOCAL) with specified type.
 
void CopyOldPropertiesToNew (notnull EntityAI old_item, EntityAI new_item)
 Step E. copy properties from old object to the created one.
 
void DeleteOldEntity ()
 Step F. - deletes physically old item.
 
void CreateNetworkObjectInfo (EntityAI new_item)
 Step G. - create NetworkObjectInfo for new item.
 
void OnSuccess (EntityAI new_item)
 Step H. - notification on finish.
 
void OnAbort ()
 Step Out - notification on abort.
 
void Execute (HumanInventoryWithFSM fsm_to_notify=null)
 
string DumpToString ()
 

Private Attributes

bool m_TransferAgents
 
bool m_TransferVariables
 
bool m_TransferHealth
 
bool m_ExcludeQuantity
 
float m_quantity_override
 
PlayerBase m_Player
 
int m_IndexQB
 
- Private Attributes inherited from ReplaceItemWithNewLambdaBase
ref InventoryLocation m_OldLocation
 
ref InventoryLocation m_NewLocation
 
bool m_RemoveFromLocationPassed = false
 

Detailed Description

adds automatic QuickBar handling

Definition at line 1 of file MiscGameplayFunctions.c.

Constructor & Destructor Documentation

◆ ReplaceItemWithNewLambda()

void ReplaceItemWithNewLambda::ReplaceItemWithNewLambda ( EntityAI old_item,
string new_item_type,
PlayerBase player )
inlineprivate

Definition at line 9 of file ReplaceItemWithNewLambda.c.

10 {
12 m_IndexQB = -1;
13
14 if (m_Player)
15 m_IndexQB = m_Player.FindQuickBarEntityIndex(old_item);
16 }

References m_IndexQB, and m_Player.

Member Function Documentation

◆ CopyOldPropertiesToNew() [1/2]

override void ReplaceItemWithNewLambda::CopyOldPropertiesToNew ( notnull EntityAI old_item,
EntityAI new_item )
inlineprivate

Definition at line 23 of file MiscGameplayFunctions.c.

24 {
25 super.CopyOldPropertiesToNew(old_item, new_item);
26
27 if (new_item)
28 {
31
32 //quantity override
33 if (ItemBase.Cast(new_item) && m_quantity_override != -1)
34 {
36 ItemBase.Cast(new_item).SetQuantity(m_quantity_override);
37 }
38 }
39 else
40 Debug.LogError("TurnItemIntoItemLambda: failed to create new item", "static");
41 }
Definition Debug.c:14
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:341
Definition EnMath.c:7
static proto float Max(float x, float y)
Returns bigger of two given values.

References Debug::LogError(), m_Player, and Math::Max().

◆ CopyOldPropertiesToNew() [2/2]

override void ReplaceItemWithNewLambda::CopyOldPropertiesToNew ( notnull EntityAI old_item,
EntityAI new_item )
inlineprivate

Definition at line 23 of file ReplaceItemWithNewLambda.c.

24 {
25 super.CopyOldPropertiesToNew(old_item, new_item);
26
27 if (m_Player && m_IndexQB != -1)
28 m_Player.SetQuickBarEntityShortcut(new_item, m_IndexQB, true);
29 }

References m_IndexQB, and m_Player.

◆ OnSuccess() [1/2]

override void ReplaceItemWithNewLambda::OnSuccess ( EntityAI new_item)
inlineprivate

Definition at line 75 of file MiscGameplayFunctions.c.

76 {
77 super.OnSuccess(new_item);
78 if (m_Player)
79 m_Player.GetItemAccessor().OnItemInHandsChanged();
80 }

References m_Player.

◆ OnSuccess() [2/2]

override void ReplaceItemWithNewLambda::OnSuccess ( EntityAI new_item)
inlineprivate

Definition at line 31 of file ReplaceItemWithNewLambda.c.

32 {
33 super.OnSuccess(new_item);
34
35 if (m_Player && m_IndexQB != -1)
36 m_Player.SetQuickBarEntityShortcut(new_item, m_IndexQB, true);
37 }

References m_IndexQB, and m_Player.

◆ SetTransferParams()

void ReplaceItemWithNewLambda::SetTransferParams ( bool transfer_agents = true,
bool transfer_variables = true,
bool transfer_health = true,
bool exclude_quantity = false,
float quantity_override = -1 )
inlineprivate

◆ TurnItemIntoItemLambda()

void ReplaceItemWithNewLambda::TurnItemIntoItemLambda ( EntityAI old_item,
string new_item_type,
PlayerBase player )
inlineprivate

Definition at line 9 of file MiscGameplayFunctions.c.

10 {
12 }
void SetTransferParams(bool transfer_agents=true, bool transfer_variables=true, bool transfer_health=true, bool exclude_quantity=false, float quantity_override=-1)

◆ VerifyItemTypeBySlotType()

override void ReplaceItemWithNewLambda::VerifyItemTypeBySlotType ( )
inlineprivate

if attaching from att.slot to att.slot, skips the change to "ground" version. Allows for correct property transfers.

Definition at line 44 of file MiscGameplayFunctions.c.

45 {
46 if (m_NewLocation.GetType() == InventoryLocationType.ATTACHMENT && m_OldItem.ConfigIsExisting("ChangeIntoOnAttach"))
47 {
48 string str;
49 int idx = -1;
53
54 m_OldItem.ConfigGetTextArray("ChangeInventorySlot", inventory_slots);
55 if (inventory_slots.Count() < 1) //is string
56 {
57 inventory_slots_idx.Insert(InventorySlots.GetSlotIdFromString(m_OldItem.ConfigGetString("ChangeInventorySlot")));
58 attach_types.Insert(m_OldItem.ConfigGetString("ChangeIntoOnAttach"));
59 }
60 else //is array
61 {
62 inventory_slots_idx.Clear();
63 for (int i = 0; i < inventory_slots.Count(); i++)
65 m_OldItem.ConfigGetTextArray("ChangeIntoOnAttach", attach_types);
66 }
67
68 idx = m_NewLocation.GetSlot();
70 if (str != "")
72 }
73 }
InventoryLocationType
types of Inventory Location
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
array< string > TStringArray
Definition EnScript.c:666
array< int > TIntArray
Definition EnScript.c:668

References InventorySlots::GetSlotIdFromString().

Member Data Documentation

◆ m_ExcludeQuantity

bool ReplaceItemWithNewLambda::m_ExcludeQuantity
private

Definition at line 6 of file MiscGameplayFunctions.c.

◆ m_IndexQB

int ReplaceItemWithNewLambda::m_IndexQB
private

◆ m_Player

◆ m_quantity_override

float ReplaceItemWithNewLambda::m_quantity_override
private

Definition at line 7 of file MiscGameplayFunctions.c.

◆ m_TransferAgents

bool ReplaceItemWithNewLambda::m_TransferAgents
private

Definition at line 3 of file MiscGameplayFunctions.c.

◆ m_TransferHealth

bool ReplaceItemWithNewLambda::m_TransferHealth
private

Definition at line 5 of file MiscGameplayFunctions.c.

◆ m_TransferVariables

bool ReplaceItemWithNewLambda::m_TransferVariables
private

Definition at line 4 of file MiscGameplayFunctions.c.


The documentation for this class was generated from the following files: