public void SetIntellect(Intellect value, bool shouldDeleteAfterDetach) { Intellect oldIntellect = intellect; bool oldIntellectShouldDeleteAfterDetach = intellectShouldDeleteAfterDetach; if (intellect != null) { UnsubscribeToDeletionEvent(intellect); } intellect = value; intellectShouldDeleteAfterDetach = shouldDeleteAfterDetach; if (intellect != null) { SubscribeToDeletionEvent(intellect); } if (oldIntellect != null && oldIntellectShouldDeleteAfterDetach) { oldIntellect.SetForDeletion(true); } //send update to clients if (EntitySystemWorld.Instance.IsServer()) { Server_SendIntellectToClients(EntitySystemWorld.Instance.RemoteEntityWorlds); } }