DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Execute()

void ReplaceItemWithNewLambdaBase::Execute ( HumanInventoryWithFSM fsm_to_notify = null)
inlineprotected

См. определение в файле ReplaceItemWithNewLambdaBase.c строка 231

232 {
233 int t = GetGame().GetTime();
234 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[syncinv] t=" + t + " lambda.Execute start ");
235
236 // A) init
237 bool prepared = PrepareLocations();
238
239 if (prepared && CanExecuteLambda())
240 {
241 // B) rm old (and delete on client)
244 {
245 Error("[inv] ReplaceItemWithNewLambdaBase Step B) ABORT - failed while rm old item from loc=" + InventoryLocation.DumpToStringNullSafe(m_OldLocation));
246
247 if (fsm_to_notify)
248 fsm_to_notify.ProcessHandAbortEvent(new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
249 OnAbort();
250 return;
251 }
252
253 // C) rm NetworkObjectInfo from old item (+ send delete object tree to clients)
255
256 // D) mk new in place of old
257 EntityAI new_item = CreateNewEntity();
258 if (WantCreateNewEntity() && new_item == null)
259 {
260 //Error("[inv] ReplaceItemWithNewLambdaBase Step D) ABORT - wanted to create=" + m_NewItemType + " at loc=" + m_NewLocation.DumpToString() + ", but failed");
261 Print("Error [inv] ReplaceItemWithNewLambdaBase Step D) ABORT - wanted to create=" + m_NewItemType + " at loc=" + InventoryLocation.DumpToStringNullSafe(m_NewLocation) + ", but failed");
266
267 OnAbort();
268 if (fsm_to_notify)
269 fsm_to_notify.ProcessHandAbortEvent(new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
270 return;
271 }
272
273 // E) cpy props
275
276 // F) del old
278
279 // G) mk new NetworkObjectInfo
280 CreateNetworkObjectInfo(new_item);
281
282 // H) notification
283 OnSuccess(new_item);
284 }
285 else
286 {
287 Print("[syncinv] warning, lambda cannot be executed, skipping!");
288 if (fsm_to_notify)
289 fsm_to_notify.ProcessHandAbortEvent(new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
290 OnAbort();
291 return;
292 }
293 int te = GetGame().GetTime();
294 int dt = te - t;
295 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[syncinv] te=" + te + " lambda.Execute end, exec time=" + dt);
296 }
class LogManager EntityAI
void hndDebugPrint(string s)
Определения HandFSM.c:1
proto int GetTime()
returns mission time in milliseconds
Man GetManOwner()
Определения HumanInventory.c:102
bool ProcessHandAbortEvent(HandEventBase e)
Определения HumanInventoryWithFSM.c:116
void DeleteOldEntity()
Step F. - deletes physically old item.
Определения ReplaceItemWithNewLambdaBase.c:193
void OnAbort()
Step Out - notification on abort.
Определения ReplaceItemWithNewLambdaBase.c:226
ref InventoryLocation m_OldLocation
Определения ReplaceItemWithNewLambdaBase.c:8
void CreateNetworkObjectInfo(EntityAI new_item)
Step G. - create NetworkObjectInfo for new item.
Определения ReplaceItemWithNewLambdaBase.c:204
ref InventoryLocation m_NewLocation
Определения ReplaceItemWithNewLambdaBase.c:9
void RemoveOldItemFromLocation()
Step B. - free location for new item @NOTE this operation does not delete the object,...
Определения ReplaceItemWithNewLambdaBase.c:86
void OnSuccess(EntityAI new_item)
Step H. - notification on finish.
Определения ReplaceItemWithNewLambdaBase.c:216
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
Определения ReplaceItemWithNewLambdaBase.c:185
EntityAI CreateNewEntity()
Step D. - create new entity (LOCAL) with specified type.
Определения ReplaceItemWithNewLambdaBase.c:123
bool PrepareLocations()
Step A. - prepare inventory locations.
Определения ReplaceItemWithNewLambdaBase.c:43
void RemoveNetworkObjectInfo()
Step C. - remove network part of the object @NOTE this operation does not delete the object,...
Определения ReplaceItemWithNewLambdaBase.c:107
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
proto void Print(void var)
Prints content of variable to console/log.

Перекрестные ссылки CanExecuteLambda(), CopyOldPropertiesToNew(), CreateNetworkObjectInfo(), CreateNewEntity(), DeleteOldEntity(), InventoryLocation::DumpToStringNullSafe(), Error(), GetGame(), CGame::GetTime(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), m_NewItemType, m_NewLocation, m_OldItem, m_OldLocation, m_RemoveFromLocationPassed, m_RemoveNetworkObjectInfoPassed, OnAbort(), OnSuccess(), PrepareLocations(), Print(), RemoveNetworkObjectInfo(), RemoveOldItemFromLocation(), UndoRemoveNetworkObjectInfo(), UndoRemoveOldItemFromLocation() и WantCreateNewEntity().

Используется в GameInventory::ReplaceItemWithNew().