mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Added /toggleai command for easier mob placement and testing.
This commit is contained in:
parent
7a83a3b45c
commit
0d0332e551
@ -266,6 +266,19 @@ void unsummonWCommand(std::string full, std::vector<std::string>& args, CNSocket
|
||||
NPCManager::destroyNPC(npc->appearanceData.iNPC_ID);
|
||||
}
|
||||
|
||||
void toggleAiCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
||||
MobManager::simulateMobs = !MobManager::simulateMobs;
|
||||
|
||||
if (MobManager::simulateMobs)
|
||||
return;
|
||||
|
||||
// return all mobs to their spawn points
|
||||
for (auto& pair : MobManager::Mobs) {
|
||||
pair.second->state = MobState::RETREAT;
|
||||
pair.second->target = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void npcRotateCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
|
||||
PlayerView& plrv = PlayerManager::players[sock];
|
||||
Player* plr = plrv.plr;
|
||||
@ -324,6 +337,7 @@ void ChatManager::init() {
|
||||
registerCommand("npcr", 30, npcRotateCommand);
|
||||
registerCommand("summonW", 30, summonWCommand);
|
||||
registerCommand("unsummonW", 30, unsummonWCommand);
|
||||
registerCommand("toggleai", 30, toggleAiCommand);
|
||||
registerCommand("flush", 30, flushCommand);
|
||||
registerCommand("level", 50, levelCommand);
|
||||
registerCommand("population", 100, populationCommand);
|
||||
|
@ -12,6 +12,8 @@
|
||||
std::map<int32_t, Mob*> MobManager::Mobs;
|
||||
std::queue<int32_t> MobManager::RemovalQueue;
|
||||
|
||||
bool MobManager::simulateMobs;
|
||||
|
||||
void MobManager::init() {
|
||||
REGISTER_SHARD_TIMER(step, 200);
|
||||
REGISTER_SHARD_TIMER(playerTick, 2000);
|
||||
@ -22,6 +24,8 @@ void MobManager::init() {
|
||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_COMBAT_END, combatEnd);
|
||||
REGISTER_SHARD_PACKET(P_CL2FE_DOT_DAMAGE_ONOFF, dotDamageOnOff);
|
||||
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_ATTACK_CHARs, pcAttackChars);
|
||||
|
||||
simulateMobs = settings::SIMULATEMOBS;
|
||||
}
|
||||
|
||||
void MobManager::pcAttackNpcs(CNSocket *sock, CNPacketData *data) {
|
||||
@ -436,7 +440,8 @@ void MobManager::step(CNServer *serv, time_t currTime) {
|
||||
continue;
|
||||
|
||||
// skip mob movement and combat if disabled
|
||||
if (!settings::SIMULATEMOBS && pair.second->state != MobState::DEAD)
|
||||
if (!simulateMobs && pair.second->state != MobState::DEAD
|
||||
&& pair.second->state != MobState::RETREAT)
|
||||
continue;
|
||||
|
||||
// skip attack/move if stunned or asleep
|
||||
|
@ -85,6 +85,7 @@ struct Mob : public BaseNPC {
|
||||
namespace MobManager {
|
||||
extern std::map<int32_t, Mob*> Mobs;
|
||||
extern std::queue<int32_t> RemovalQueue;
|
||||
extern bool simulateMobs;
|
||||
|
||||
void init();
|
||||
void step(CNServer*, time_t);
|
||||
|
Loading…
Reference in New Issue
Block a user