MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / Spawn

Method Spawn

src/World.cpp:109–118  ·  view source on GitHub ↗

Spawn an entity in the world. This schedules the Entity to be added to the Entity list and its components to the component store at the beginning of the next tick. @param e the entity to spawn @return true if the spawn succeeded, false if it failed */

Source from the content-addressed store, hash-verified

107 @return true if the spawn succeeded, false if it failed
108 */
109bool RavEngine::World::Spawn(Ref<Entity> e){
110 //if the entity is not already spawned or pending spawn
111 if (find(Entities.begin(), Entities.end(),e) == Entities.end() && find(PendingSpawn.begin(), PendingSpawn.end(),e) == PendingSpawn.end() ){
112 mtx.lock();
113 PendingSpawn.push_back(e);
114 mtx.unlock();
115 return true;
116 }
117 return false;
118}
119
120/**
121 Marks an entity for destruction. This does NOT destroy it or its components immediately. At the end of the tick, entities marked with

Callers 2

StartMethod · 0.45
tickMethod · 0.45

Calls 6

findFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
lockMethod · 0.45
push_backMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected