Como o título diz, eu estou procurando a linha das fontes tentando fazer o movimento mais rápido, mas não funciona.
Deixo um video de como eu quero colocar ....
bool Game::playerMoveCreature(uint32_t playerId, uint32_t movingCreatureId,
const Position& movingCreaturePos, const Position& toPos, bool delay)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved() || player->hasFlag(PlayerFlag_CannotMoveCreatures))
return false;
if(!player->canDoAction())
{
SchedulerTask* task = createSchedulerTask(player->getNextActionTime(),
boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos, true));
player->setNextActionTask(task);
return false;
}
Creature* movingCreature = getCreatureByID(movingCreatureId);
if(!movingCreature || movingCreature->isRemoved() || !player->canSeeCreature(movingCreature))
return false;
player->setNextActionTask(NULL);
if(!Position::areInRange<1,1,0>(movingCreaturePos, player->getPosition()) && !player->hasCustomFlag(PlayerCustomFlag_CanMoveFromFar))
{
//need to walk to the creature first before moving it
std::list<Direction> listDir;
if(getPathToEx(player, movingCreaturePos, listDir, 0, 1, true, true))
{
Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::playerAutoWalk,
this, player->getID(), listDir)));
SchedulerTask* task = createSchedulerTask(std::max((int32_t)SCHEDULER_MINTICKS, player->getStepDuration()),
boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos, true));
player->setNextWalkActionTask(task);
return true;
}
player->sendCancelMessage(RET_THEREISNOWAY);
return false;
}
else if(delay)
{
uint32_t delayTime = g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY);
if(delayTime > 0)
{
SchedulerTask* task = createSchedulerTask(delayTime,
boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos, false));
player->setNextActionTask(task);
return true;
}
}
Video