Depop and cleanup existing node npc's when command executed again. Also remove string from "name" and leave metadata in "lastname" otherwise it is visually too busy

This commit is contained in:
Akkadius 2018-07-09 01:39:14 -05:00
parent 0d094754db
commit dc87b8e78b
2 changed files with 11 additions and 1 deletions

View File

@ -2044,6 +2044,16 @@ void command_grid(Client *c, const Seperator *sep)
return; return;
} }
/**
* Depop any node npc's already spawned
*/
auto &mob_list = entity_list.GetMobList();
for (auto itr = mob_list.begin(); itr != mob_list.end(); ++itr) {
Mob *mob = itr->second;
if (mob->IsNPC() && mob->GetRace() == 2254)
mob->Depop();
}
/** /**
* Spawn grid nodes * Spawn grid nodes
*/ */

View File

@ -989,7 +989,7 @@ NPC * NPC::SpawnGridNodeNPC(std::string name, const glm::vec4 &position, uint32
auto npc_type = new NPCType; auto npc_type = new NPCType;
memset(npc_type, 0, sizeof(NPCType)); memset(npc_type, 0, sizeof(NPCType));
sprintf(npc_type->name, "(%s)_%u", name.c_str(), grid_number); sprintf(npc_type->name, "%u_%u", grid_id, grid_number);
sprintf(npc_type->lastname, "Number: %u Grid: %u Pause: %u", grid_number, grid_id, pause); sprintf(npc_type->lastname, "Number: %u Grid: %u Pause: %u", grid_number, grid_id, pause);
npc_type->cur_hp = 4000000; npc_type->cur_hp = 4000000;