summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/World.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 699767d5e..6a83da489 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2414,14 +2414,24 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, int a_EntityTy
default:
{
- LOGWARNING("cWorld::SpawnMob(): Unhandled entity type: %d. Not spawning.", a_EntityType);
+ LOGWARNING("%s: Unhandled entity type: %d. Not spawning.", __FUNCTION__, a_EntityType);
return -1;
}
}
Monster->SetPosition(a_PosX, a_PosY, a_PosZ);
Monster->SetHealth(Monster->GetMaxHealth());
- Monster->Initialize(this);
+ if (cPluginManager::Get()->CallHookSpawningMonster(*this, *Monster))
+ {
+ delete Monster;
+ return -1;
+ }
+ if (!Monster->Initialize(this))
+ {
+ delete Monster;
+ return -1;
+ }
BroadcastSpawnEntity(*Monster);
+ cPluginManager::Get()->CallHookSpawnedMonster(*this, *Monster);
return Monster->GetUniqueID();
}