remove mobs on player leave
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "td/protocol/packets/WorldDataPacket.h"
|
||||
#include "td/protocol/packets/SpawnMobPacket.h"
|
||||
#include "td/protocol/packets/UpgradeTowerPacket.h"
|
||||
#include "td/protocol/packets/RemoveMobPacket.h"
|
||||
#include "td/protocol/packets/RemoveTowerPacket.h"
|
||||
#include "td/protocol/packets/UpdateCastleLifePacket.h"
|
||||
#include "td/protocol/packets/UpdateMobStatesPacket.h"
|
||||
@@ -21,6 +22,7 @@ WorldClient::WorldClient(ClientGame* game) : game::World(game), protocol::Packet
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldData, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::SpawnMob, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::UpgradeTower, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::RemoveMob, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::RemoveTower, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::UpdateCastleLife, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::UpdateMobStates, this);
|
||||
@@ -70,6 +72,14 @@ void WorldClient::HandlePacket(const protocol::RemoveTowerPacket* packet) {
|
||||
GetWorldNotifier().NotifyListeners(&WorldListener::OnTowerRemove, tower);
|
||||
}
|
||||
|
||||
void WorldClient::HandlePacket(const protocol::RemoveMobPacket* packet) {
|
||||
game::MobPtr mob = RemoveMob(packet->GetMobID());
|
||||
|
||||
SAFE_CHECK(mob);
|
||||
|
||||
//GetWorldNotifier().NotifyListeners(&MobListener::OnMobDie, mob.get());
|
||||
}
|
||||
|
||||
void WorldClient::HandlePacket(const protocol::UpdateMobStatesPacket* packet) {
|
||||
for (auto mobState : packet->GetMobStates()) {
|
||||
game::MobID mobId = mobState.GetMobId();
|
||||
|
||||
Reference in New Issue
Block a user