MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / ForceEntitiesToSleep

Method ForceEntitiesToSleep

CryGame/ScriptObjectGame.cpp:335–362  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

333
334//////////////////////////////////////////////////////////////////////////
335int CScriptObjectGame::ForceEntitiesToSleep(IFunctionHandler *pH)
336{
337 if (!m_pGame->IsDevModeEnable())
338 return (pH->EndFunction());
339
340 IEntity *pLocal=m_pGame->GetMyPlayer();
341 IEntityItPtr pEntities=m_pSystem->GetIEntitySystem()->GetEntityIterator();
342 pEntities->MoveFirst();
343 IEntity *pEnt=NULL;
344 while((pEnt=pEntities->Next())!=NULL)
345 {
346 //EntityClass *pClass=pECR->GetByClass(pEnt->GetEntityClassName());
347 if (pEnt==pLocal)
348 continue; // do not put to sleep ourselves
349
350 IAIObject *pAI=pEnt->GetAI();
351 if (!pAI || (pAI->GetType()==AIOBJECT_PLAYER))
352 continue;
353
354 pAI->Event(AIEVENT_SLEEP,0);
355 pEnt->SetSleep(true);
356
357 //Vec3 pos = pEnt->GetPos();
358 //m_pSystem->GetILog()->Log("ENTITY class=%s/%d ent=%s/%d pos=(%.1f,%.1f,%.1f)", pClass->strClassName.c_str(), pClass->cTypeID, pEnt->GetName(), pEnt->GetId(), pos.x, pos.y, pos.z);
359 }
360
361 return (pH->EndFunction());
362}
363
364//////////////////////////////////////////////////////////////////////////
365int CScriptObjectGame::__RespawnEntity(IFunctionHandler *pH)

Callers

nothing calls this directly

Calls 11

EndFunctionMethod · 0.80
GetMyPlayerMethod · 0.80
GetEntityIteratorMethod · 0.80
GetIEntitySystemMethod · 0.80
EventMethod · 0.80
SetSleepMethod · 0.80
IsDevModeEnableMethod · 0.45
MoveFirstMethod · 0.45
NextMethod · 0.45
GetAIMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected