Cuberite Forum

Full Version: Spawning an entity
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Maybe it would be usefull when spawning an entity it returns the entity object/ID. for example if you spawn a mob or a pickup you get the entity object.
local Creeper = World:SpawnMob(X, Y, Z, 50)
The server already does so.

Don't forget to use named constants instead of numbers (E_ENTITY_TYPE_CREEPER instead of 50)

Maybe we should rename the SpawnMob() function to SpawnMonster(), so that it corresponds with the overall naming (cMonster class)
Maybe we also need a cRoot:Get():GetEntity(EntityID)
Can't do. By the time you get the cEntity object, it may already have been freed by another thread in the server.

We have a cWorld::DoWithEntytiByID(), I just noticed it is not exported to Lua yet, I'll do that soon (ish Smile )