Skip to content

Commit

Permalink
Add Missing Forward Calls
Browse files Browse the repository at this point in the history
  • Loading branch information
caxanga334 committed Dec 6, 2024
1 parent 8738fac commit 7862693
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/developers/sourcepawn/FORWARDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# NavBot Global Forwards

## On Bot Add

`Action OnPreNavBotAdd()` is called when a bot is about to be added to the game.

Returning anything higher than `Plugin_Continue` will block the bot from being added to the game.

`void OnNavBotAdded(int bot)` is called after a bot has been added to the game.

* `int bot`: Client index of the bot that was just added.

## On Create Plugin Bot

`Action OnPrePluginBotAdd(int entity)` is called when a plugin has requested to attach a NavBot Plugin Bot instance on the given entity.

Returning anything higher than `Plugin_Continue` will block the plugin bot from being created.

* `int entity`: Client index that the plugin bot will attach to.

`void OnPluginBotAdded(int entity)` is called after a plugin bot was created.

* `int entity`: Client index that the plugin bot will attach to.
2 changes: 2 additions & 0 deletions docs/developers/sourcepawn/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# SourcePawn API

* [Natives]
* [Forwards]
* [Plugin Bot]

<!-- LINKS -->

[Natives]: NATIVES.md
[Forwards]: FORWARDS.md
[Plugin Bot]: PLUGIN_BOTS.md
7 changes: 7 additions & 0 deletions extension/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ void CExtManager::AddBot(std::string* newbotname, edict_t** newbotedict)
*newbotedict = edict;
}

m_postbotaddforward->PushCell(gamehelpers->IndexOfEdict(edict));
m_postbotaddforward->Execute();

smutils->LogMessage(myself, "NavBot added to the game.");
}

Expand All @@ -356,6 +359,10 @@ CBaseBot* CExtManager::AttachBotInstanceToEntity(edict_t* entity)
CBaseBot* newBot = static_cast<CBaseBot*>(new CPluginBot(entity));
newBot->PostAdd();
m_bots.emplace_back(newBot);

m_postpluginbotaddforward->PushCell(gamehelpers->IndexOfEdict(entity));
m_postpluginbotaddforward->Execute();

return newBot;
}

Expand Down

0 comments on commit 7862693

Please sign in to comment.