MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / DebugGun

Method DebugGun

Code/GameSDK/GameDll/WeaponSystem.cpp:889–919  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

887
888//------------------------------------------------------------------------
889void CWeaponSystem::DebugGun(IConsoleCmdArgs *args)
890{
891 IGameFramework* pGF = gEnv->pGame->GetIGameFramework();
892 IItemSystem* pItemSystem = pGF->GetIItemSystem();
893
894 IActor* pActor = pGF->GetClientActor();
895 if (!pActor || !pActor->IsPlayer())
896 return;
897
898 IInventory *pInventory = pActor->GetInventory();
899 if (!pInventory)
900 return;
901
902 // give & select the debuggun
903 EntityId itemId = pInventory->GetItemByClass(CItem::sDebugGunClass);
904 if (0 == itemId)
905 {
906 // if actor doesn't have it, only give it in editor
907 if (!gEnv->IsEditor())
908 return;
909
910 if(!CItem::sDebugGunClass)
911 {
912 CRY_ASSERT_MESSAGE(0, "DebugGun is not defined.");
913 return;
914 }
915
916 itemId = pItemSystem->GiveItem(pActor, CItem::sDebugGunClass->GetName(), false, true, true);
917 }
918 pItemSystem->SetActorItem(pActor, itemId, true);
919}
920
921//------------------------------------------------------------------------
922void CWeaponSystem::RefGun(IConsoleCmdArgs *args)

Callers 1

Calls 10

GetIGameFrameworkMethod · 0.45
GetIItemSystemMethod · 0.45
GetClientActorMethod · 0.45
IsPlayerMethod · 0.45
GetInventoryMethod · 0.45
GetItemByClassMethod · 0.45
IsEditorMethod · 0.45
GiveItemMethod · 0.45
GetNameMethod · 0.45
SetActorItemMethod · 0.45

Tested by

no test coverage detected