======  OnSpawningEntity hook callback function ======
This callback is called before the server spawns an entity. The plugin can either modify the entity before it is spawned, or disable the spawning altogether.
If the entity spawning is a monster, the [[API:Plugin:OnSpawningMonster|OnSpawningMonster]]() hook is called before this hook.

===== Function signature =====
<code lua>
function OnSpawningEntity(World, Entity)
</code>
Parameters:
| World | [[API:cWorld|cWorld]] | The world in which the entity is spawning |
| Entity | [[API:cEntity|cEntity]] | The entity that is spawning |

===== Return values =====
If the function returns false or no value, the next plugin's callback is called. Finally, the server spawns the entity with whatever parameters have been set on the cEntity object by the callbacks.
If the function returns true, no other callback is called for this event and the entity is not spawned.

===== Registering the callback =====
To register your plugin to receive a callback through this function, use the hook [[api:plugin:hooks|HOOK_SPAWNING_ENTITY]]
<code lua>
PluginManager = cPluginManager:GetPluginManager()
PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNING_ENTITY)
</code>