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

Function DisableEntityAI

TombEngine/Game/control/lot.cpp:103–115  ·  view source on GitHub ↗

* @brief Disables AI processing for a creature. * * Cleans up the creature's AI state, destroys its AI target item if any, * removes it from the ActiveCreatures list, and clears its CreatureInfo data. * Called when a creature dies, is deactivated, or leaves the active area. * * @param itemNumber Index of the creature item. */

Source from the content-addressed store, hash-verified

101 * @param itemNumber Index of the creature item.
102 */
103void DisableEntityAI(short itemNumber)
104{
105 auto* item = &g_Level.Items[itemNumber];
106
107 if (!item->IsCreature())
108 return;
109
110 auto* creature = GetCreatureInfo(item);
111 creature->ItemNumber = NO_VALUE;
112 KillItem(creature->AITargetNumber);
113 ActiveCreatures.erase(std::find(ActiveCreatures.begin(), ActiveCreatures.end(), item->Index));
114 item->Data = nullptr;
115}
116
117/**
118 * @brief Initializes a creature's AI slot with movement capabilities based on its LotType.

Callers 15

SmallSpiderControlFunction · 0.85
SkidooManControlFunction · 0.85
ControlDragonFunction · 0.85
ControlTwinAutoGunFunction · 0.85
DoppelgangerControlFunction · 0.85
LarsonControlFunction · 0.85
EnemyJeepControlFunction · 0.85
KillRespawnedBaboonFunction · 0.85
UpdateRespawnedBaboonFunction · 0.85
GuideControlFunction · 0.85
SkeletonControlFunction · 0.85
ScorpionControlFunction · 0.85

Calls 7

GetCreatureInfoFunction · 0.85
KillItemFunction · 0.85
findFunction · 0.85
IsCreatureMethod · 0.80
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected