11 private bool m_RemoveNetworkObjectInfoPassed =
false;
16 m_NewItemType = new_item_type;
24 void VerifyItemTypeBySlotType() {}
45 if (
LogManager.IsInventoryHFSMLogEnable())
hndDebugPrint(
"[inv] ReplaceItemWithNewLambdaBase Step A) Prepare inventory locations, old_item=" + m_OldItem);
47 if (m_OldItem.GetInventory().GetCurrentInventoryLocation(
m_OldLocation))
58 Math3D.MatrixIdentity4(m4);
78 Error(
"[inv] ReplaceItemWithNewLambdaBase Step A.1) failed to get old_item inventory location");
90 Error(
"[inv] ReplaceItemWithNewLambdaBase Step B) failed to remove old_item rom current inventory location");
99 Error(
"[inv] ReplaceItemWithNewLambdaBase Step B) failed to undo remove");
109 GetGame().RemoteObjectTreeDelete(m_OldItem);
111 m_RemoveNetworkObjectInfoPassed =
true;
115 GetGame().RemoteObjectTreeCreate(m_OldItem);
127 VerifyItemTypeBySlotType();
138 new_item.SetOrientation(m_OldItem.GetOrientation());
151 if (
LogManager.IsInventoryHFSMLogEnable())
hndDebugPrint(
"[inv] ReplaceItemWithNewLambdaBase Step D) Created new new_item=" + new_item);
187 if (
LogManager.IsInventoryHFSMLogEnable())
hndDebugPrint(
"[inv] ReplaceItemWithNewLambdaBase Step E) Copying props " + old_item +
" --> " + new_item);
195 if (
LogManager.IsInventoryHFSMLogEnable())
hndDebugPrint(
"[inv] ReplaceItemWithNewLambdaBase Step F) delete old item=" + m_OldItem);
196 m_OldItem.DeleteSafe();
206 if (
LogManager.IsInventoryHFSMLogEnable())
hndDebugPrint(
"[inv] ReplaceItemWithNewLambdaBase Step G) CreateNetworkObjectInfo =" + new_item);
208 GetGame().RemoteObjectTreeCreate(new_item);
218 if (
LogManager.IsInventoryHFSMLogEnable())
hndDebugPrint(
"[inv] ReplaceItemWithNewLambdaBase Step H) OnSuccess=" + new_item);
228 Print(
"Error [inv] ReplaceItemWithNewLambdaBase OnAbort");
248 fsm_to_notify.ProcessHandAbortEvent(
new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
261 Print(
"Error [inv] ReplaceItemWithNewLambdaBase Step D) ABORT - wanted to create=" + m_NewItemType +
" at loc=" +
InventoryLocation.DumpToStringNullSafe(
m_NewLocation) +
", but failed");
264 if (m_RemoveNetworkObjectInfoPassed)
269 fsm_to_notify.ProcessHandAbortEvent(
new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
287 Print(
"[syncinv] warning, lambda cannot be executed, skipping!");
289 fsm_to_notify.ProcessHandAbortEvent(
new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
295 if (
LogManager.IsInventoryHFSMLogEnable())
hndDebugPrint(
"[syncinv] te=" + te +
" lambda.Execute end, exec time=" + dt);
300 string s =
"{ old=" + m_OldItem +
" newType=" + m_NewItemType +
"}";
const int ECE_OBJECT_SWAP
const int ECE_PLACE_ON_SURFACE
proto int GetTime()
returns mission time in milliseconds
script counterpart to engine's class Inventory
static proto native EntityAI LocationCreateLocalEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new local item directly at location @NOTE: the item is created localy, i.e....
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
static proto native bool LocationAddEntity(notnull InventoryLocation inv_loc)
adds item to inventory location
static proto native bool LocationCanRemoveEntity(notnull InventoryLocation inv_loc)
queries if the entity contained in inv_loc.m_item can be removed from ground/attachment/cargo/hands/....
static proto native bool LocationRemoveEntity(notnull InventoryLocation inv_loc)
removes item from inventory location
HumanInventory... with FSM (synchronous, no anims)
base class for transformation operations (creating one item from another)
void DeleteOldEntity()
Step F. - deletes physically old item.
void OnAbort()
Step Out - notification on abort.
void UndoRemoveNetworkObjectInfo()
void UndoRemoveOldItemFromLocation()
ref InventoryLocation m_OldLocation
void CreateNetworkObjectInfo(EntityAI new_item)
Step G. - create NetworkObjectInfo for new item.
bool WantCreateNewEntity()
ref InventoryLocation m_NewLocation
bool m_RemoveFromLocationPassed
void RemoveOldItemFromLocation()
Step B. - free location for new item @NOTE this operation does not delete the object,...
void Execute(HumanInventoryWithFSM fsm_to_notify=null)
void OnSuccess(EntityAI new_item)
Step H. - notification on finish.
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
EntityAI CreateNewEntity()
Step D. - create new entity (LOCAL) with specified type.
bool PrepareLocations()
Step A. - prepare inventory locations.
void RemoveNetworkObjectInfo()
Step C. - remove network part of the object @NOTE this operation does not delete the object,...
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto void Print(void var)
Prints content of variable to console/log.
void hndDebugPrint(string s)
InventoryLocationType
types of Inventory Location