virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); if(pIM == NULL) return; CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection()); // If mode Combat (no talk, no give, no mount) if(UserEntity->mode()==MBEHAV::COMBAT || UserEntity->mode()==MBEHAV::COMBAT_FLOAT) { return; // Cant mount } // Mount else if(UserEntity->isRiding()) { // We are currently mounted so unmount pIM->runActionHandler("context_unseat",NULL); } // Not in combat mode. else { // check if we can mount if ((selection) && (selection->properties().mountable())) { CVectorD vect1 = selection->pos(); CVectorD vect2 = UserEntity->pos(); double distanceSquare = pow(vect1.x-vect2.x,2) + pow(vect1.y-vect2.y,2); if(distanceSquare <= MaxTalkingDistSquare) { // Ok lets mount pIM->runActionHandler("context_mount",NULL); } } } }
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); if(pIM == NULL) return; CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection()); if(UserEntity->mode()==MBEHAV::COMBAT || UserEntity->mode()==MBEHAV::COMBAT_FLOAT) { return; // Cant exchange } // Mount else { if (selection && selection->properties().canExchangeItem()) if (!UserEntity->isBusy()) pIM->runActionHandler("context_exchange",NULL); } }