MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / ActorUse

Method ActorUse

ogsr_engine/xrGame/ActorInput.cpp:388–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386extern bool g_bDisableAllInput;
387
388void CActor::ActorUse()
389{
390 auto pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
391 if (auto Pda = GetPDA(); Pda && Pda->Is3DPDA() && psActorFlags.test(AF_3D_PDA) && pGameSP->PdaMenu->IsShown())
392 return;
393
394 auto active_hud = smart_cast<CHudItem*>(inventory().ActiveItem());
395 if (active_hud && active_hud->GetState() != CHudItem::eIdle && Core.Features.test(xrCore::Feature::busy_actor_restrictions))
396 return;
397
398 if (g_bDisableAllInput || HUD().GetUI()->MainInputReceiver())
399 return;
400
401 if (m_holder)
402 {
403 CGameObject* GO = smart_cast<CGameObject*>(m_holder);
404 NET_Packet P;
405 CGameObject::u_EventGen(P, GEG_PLAYER_DETACH_HOLDER, ID());
406 P.w_u32(GO->ID());
407 CGameObject::u_EventSend(P);
408 return;
409 }
410
411 if (character_physics_support()->movement()->PHCapture())
412 {
413 character_physics_support()->movement()->PHReleaseObject();
414 return;
415 }
416
417 if (m_pUsableObject)
418 {
419 m_pUsableObject->use(this);
420 if (g_bDisableAllInput || HUD().GetUI()->MainInputReceiver())
421 return;
422 }
423
424 if (m_pInvBoxWeLookingAt && m_pInvBoxWeLookingAt->object().nonscript_usable() && m_pInvBoxWeLookingAt->IsOpened())
425 {
426 // если контейнер открыт
427 CUIGameSP* pGameSP = smart_cast<CUIGameSP*>(HUD().GetUI()->UIGame());
428 if (pGameSP)
429 pGameSP->StartCarBody(this, m_pInvBoxWeLookingAt);
430 return;
431 }
432
433 else if (!m_pUsableObject || m_pUsableObject->nonscript_usable())
434 {
435 if (m_pPersonWeLookingAt)
436 {
437 CEntityAlive* pEntityAliveWeLookingAt = smart_cast<CEntityAlive*>(m_pPersonWeLookingAt);
438 VERIFY(pEntityAliveWeLookingAt);
439 if (pEntityAliveWeLookingAt->g_Alive())
440 {
441 TryToTalk();
442 return;
443 }
444 //обыск трупа
445 else if (!pInput->iGetAsyncKeyState(DIK_LSHIFT))

Callers

nothing calls this directly

Calls 15

IDFunction · 0.85
UIGameMethod · 0.80
GetUIMethod · 0.80
Is3DPDAMethod · 0.80
IsShownMethod · 0.80
ActiveItemMethod · 0.80
movementMethod · 0.80
nonscript_usableMethod · 0.80
StartCarBodyMethod · 0.80
g_AliveMethod · 0.80
iGetAsyncKeyStateMethod · 0.80

Tested by

no test coverage detected