MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / AIGuard

Function AIGuard

TombEngine/Game/control/box.cpp:462–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462short AIGuard(CreatureInfo* creature)
463{
464 auto& item = g_Level.Items[creature->ItemNumber];
465 if (item.AIBits & MODIFY)
466 return 0;
467
468 if (Random::TestProbability(1.0f / 128.0f))
469 {
470 creature->HeadRight = true;
471 creature->HeadLeft = true;
472 }
473 else if (Random::TestProbability(1.0f / 96.0f))
474 {
475 creature->HeadRight = false;
476 creature->HeadLeft = true;
477 }
478 else if (Random::TestProbability(1.0f / 64.0f))
479 {
480 creature->HeadRight = true;
481 creature->HeadLeft = false;
482 }
483
484 if (creature->HeadLeft && creature->HeadRight)
485 return 0;
486
487 if (creature->HeadLeft)
488 return -CREATURE_AI_ROTATION_MAX;
489
490 if (creature->HeadRight)
491 return CREATURE_AI_ROTATION_MAX;
492
493 return 0;
494}
495
496void AlertNearbyGuards(ItemInfo* item)
497{

Callers 15

MPGunControlFunction · 0.85
CivvyControlFunction · 0.85
FlameThrowerControlFunction · 0.85
MPStickControlFunction · 0.85
MonkeyControlFunction · 0.85
TribemanDartsControlFunction · 0.85
ClawMutantControlFunction · 0.85
ControlSealMutantFunction · 0.85
HeavyGuardControlFunction · 0.85
GuardControlFunction · 0.85
Mafia2ControlFunction · 0.85
ControlGladiatorFunction · 0.85

Calls 1

TestProbabilityFunction · 0.85

Tested by

no test coverage detected