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

◆ Execute()

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

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

240 {
241 int t = g_Game.GetTime();
242 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[syncinv] t=" + t + " lambda.Execute start ");
243
244 // A) init
245 bool prepared = PrepareLocations();
246
247 if (prepared && CanExecuteLambda())
248 {
249 // B) rm old (and delete on client)
252 {
253 Error("[inv] ReplaceItemWithNewLambdaBase Step B) ABORT - failed while rm old item from loc=" + InventoryLocation.DumpToStringNullSafe(m_OldLocation));
254
255 if (fsm_to_notify)
256 fsm_to_notify.ProcessHandAbortEvent(new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
257 OnAbort();
258 return;
259 }
260
261 // C) rm NetworkObjectInfo from old item (+ send delete object tree to clients)
263
264 // D) mk new in place of old
265 EntityAI new_item = CreateNewEntity();
266 if (WantCreateNewEntity() && new_item == null)
267 {
268 //Error("[inv] ReplaceItemWithNewLambdaBase Step D) ABORT - wanted to create=" + m_NewItemType + " at loc=" + m_NewLocation.DumpToString() + ", but failed");
269 Print("Error [inv] ReplaceItemWithNewLambdaBase Step D) ABORT - wanted to create=" + m_NewItemType + " at loc=" + InventoryLocation.DumpToStringNullSafe(m_NewLocation) + ", but failed");
274
275 OnAbort();
276 if (fsm_to_notify)
277 fsm_to_notify.ProcessHandAbortEvent(new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
278 return;
279 }
280
281 // E) cpy props
283
284 // F) del old
286
287 // G) mk new NetworkObjectInfo
288 CreateNetworkObjectInfo(new_item);
289
290 // H) notification
291 OnSuccess(new_item);
292 }
293 else
294 {
295 Print("[syncinv] warning, lambda cannot be executed, skipping!");
296 if (fsm_to_notify)
297 fsm_to_notify.ProcessHandAbortEvent(new HandEventHumanCommandActionAborted(fsm_to_notify.GetManOwner()));
298 OnAbort();
299 return;
300 }
301 int te = g_Game.GetTime();
302 int dt = te - t;
303 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[syncinv] te=" + te + " lambda.Execute end, exec time=" + dt);
304 }
class LogManager EntityAI
DayZGame g_Game
Определения DayZGame.c:3942
void hndDebugPrint(string s)
Определения HandFSM.c:1
Man GetManOwner()
Определения HumanInventory.c:102
bool ProcessHandAbortEvent(HandEventBase e)
Определения HumanInventoryWithFSM.c:116
void DeleteOldEntity()
Step F. - deletes physically old item.
Определения ReplaceItemWithNewLambdaBase.c:201
void OnAbort()
Step Out - notification on abort.
Определения ReplaceItemWithNewLambdaBase.c:234
ref InventoryLocation m_OldLocation
Определения ReplaceItemWithNewLambdaBase.c:8
void CreateNetworkObjectInfo(EntityAI new_item)
Step G. - create NetworkObjectInfo for new item.
Определения ReplaceItemWithNewLambdaBase.c:212
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:224
void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Step E. copy properties from old object to the created one.
Определения ReplaceItemWithNewLambdaBase.c:193
EntityAI CreateNewEntity()
Step D. - create new entity (LOCAL) with specified type.
Определения ReplaceItemWithNewLambdaBase.c:131
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:115
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(), g_Game, 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().