Cuberite Forum
Spawning an entity - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Spawning an entity (/thread-1206.html)



Spawning an entity - NiLSPACE - 08-03-2013

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)



RE: Spawning an entity - xoft - 08-03-2013

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)


RE: Spawning an entity - NiLSPACE - 08-05-2013

Maybe we also need a cRoot:Get():GetEntity(EntityID)


RE: Spawning an entity - xoft - 08-05-2013

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 )