[Bot] Add GetBotOwnerByBotID Method (#2715)

* [Bot] Add GetBotOwnerByBotID Method

* Cleanup.

* Remove EVENT_DESPAWN exports in Lua.

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
Aeadoin
2023-01-10 21:14:42 -05:00
committed by GitHub
parent 0d23ffe5e5
commit 8fe02b5ed1
11 changed files with 107 additions and 10 deletions
+15
View File
@@ -2025,6 +2025,21 @@ void PerlembParser::ExportEventVariables(
break;
}
case EVENT_DESPAWN: {
ExportVar(package_name.c_str(), "despawned_entity_id", npcmob->GetID());
if (npcmob->IsNPC()) {
ExportVar(package_name.c_str(), "despawned_bot_id", 0);
ExportVar(package_name.c_str(), "despawned_npc_id", npcmob->GetNPCTypeID());
#ifdef BOTS
} else if (npcmob->IsBot()) {
ExportVar(package_name.c_str(), "despawned_bot_id", npcmob->CastToBot()->GetBotID());
ExportVar(package_name.c_str(), "despawned_npc_id", 0);
#endif
}
break;
}
case EVENT_DESPAWN_ZONE: {
ExportVar(package_name.c_str(), "despawned_entity_id", mob->GetID());