class ActiveEntity : ServiceScript { Entity entity; void onInit() { entity = Engine::getMainEnvironment().getRootEntity(); } [ServiceAPI] Entity getActiveEntity() { return entity; } [ServiceAPI] void setActiveEntity(Entity ent) { entity = ent; } }