void PlayerZoneComponent::teleport(SceneObject* sceneObject, float newPositionX, float newPositionZ, float newPositionY, uint64 parentID) {
	//sceneObject->setTeleporting(true);
	CreatureObject* player = NULL;

	if (sceneObject->isPlayerCreature()) {
		player = cast<CreatureObject*>( sceneObject);
	}

	if (player != NULL && sceneObject->getParent() != NULL && parentID != 0) {
		ManagedReference<SceneObject*> par = sceneObject->getParent();

		if (par->isVehicleObject() || par->isMount()) {
			player->executeObjectControllerAction(String("dismount").hashCode());
		}
	}

	ZoneComponent::teleport(sceneObject, newPositionX, newPositionZ, newPositionY, parentID);

	if (player != NULL) {
		PlayerObject* ghost = player->getPlayerObject();

		ghost->setTeleporting(true);
		ghost->updateLastValidatedPosition();
		player->setMovementCounter(0);
		ghost->setClientLastMovementStamp(0);
	}
}
void PlayerZoneComponent::switchZone(SceneObject* sceneObject, const String& newTerrainName, float newPostionX, float newPositionZ, float newPositionY, uint64 parentID) {
	if (sceneObject->isPlayerCreature()) {
		CreatureObject* player = cast<CreatureObject*>( sceneObject);
		PlayerObject* ghost = player->getPlayerObject();

		ManagedReference<SceneObject*> par = sceneObject->getParent();

		if (par != NULL && (par->isVehicleObject() || par->isMount())) {
			player->executeObjectControllerAction(String("dismount").hashCode());
		}

		ghost->setSavedParentID(0);

		ghost->setTeleporting(true);
		ghost->updateLastValidatedPosition();
		player->setMovementCounter(0);
		ghost->setClientLastMovementStamp(0);

		ghost->unloadSpawnedChildren();
	}

	ZoneComponent::switchZone(sceneObject, newTerrainName, newPostionX, newPositionZ, newPositionY, parentID);
}