TF2-DMB / CBaseNPC

Provides a friendly interface for plugins to use in order to create custom NPCs on the game Team Fortress 2
36 stars 5 forks source link

Rough implementation of NextBotPlayer for events propagation #29

Closed Kenzzer closed 2 years ago

Kenzzer commented 2 years ago

This PR introduces the object class ToolsNextBotPlayer which intends to mimic NextBotPlayer in order to propagate source events to underlying NextBot's components. As such, not all the features of NextBotPlayer have been implemented.

As this nextbot interface required TheNextBots in order to be properly implemented, although outside this PR's scope, the various TO-DO(s) surrounding TheNextBots have been addressed. The extension's PathFollower object will now properly notify all nextbots when destroyed, NextBot objects created by the extension will be (un)registered into TheNextBots.

In order to preserve backwards compatibility the following code

EntityFactory = new CEntityFactory("nextbot_sentrygun");
EntityFactory.DeriveFromClass("obj_sentrygun");
EntityFactory.AttachNextBot();
EntityFactory.Install();

Is equivalent to performing

EntityFactory = new CEntityFactory("nextbot_sentrygun");
EntityFactory.DeriveFromClass("obj_sentrygun");
EntityFactory.AttachNextBot(FACTORY_NEXTBOT);
EntityFactory.Install();

While AttachNextBot(FACTORY_NEXTBOT_PLAYER); is to be used as a ToolsNextBotPlayer link to a given factory.