• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

PUSH DELAY DOES NOT WORK AT 1 SQM

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
110
Solutions
1
Reaction score
4
I have a problem with the push to 1 sqm has exausted in the players less in the summon?
some help ... and tried to compile it but one has a delay
 
C++:
    if(Creature* movingCreature = thing->getCreature())
    {
        uint32_t delay = g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY);
        if(Position::areInRange<1,1,0>(movingCreature->getPosition(), player->getPosition()) && delay > 0
            && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere))
        {
            SchedulerTask* task = createSchedulerTask(delay, boost::bind(&Game::playerMoveCreature, this,
                player->getID(), movingCreature->getID(), movingCreature->getPosition(), toCylinder->getPosition()));
            player->setNextActionTask(task);
        }
        else
            playerMoveCreature(playerId, movingCreature->getID(), movingCreature->getPosition(), toCylinder->getPosition());
    }
    else if(thing->getItem())
        playerMoveItem(playerId, fromPos, spriteId, fromStackpos, toPos, count);

    return true;
}

bool Game::playerMoveCreature(uint32_t playerId, uint32_t movingCreatureId,
    const Position& movingCreaturePos, const Position& toPos)
{
    Player* player = getPlayerByID(playerId);
    if(!player || player->isRemoved() || player->hasFlag(PlayerFlag_CannotMoveCreatures))
        return false;

    if(!player->canDoAction())
    {
        uint32_t delay = player->getNextActionTime();
        SchedulerTask* task = createSchedulerTask(delay, boost::bind(&Game::playerMoveCreature,
            this, playerId, movingCreatureId, movingCreaturePos, toPos));

        player->setNextActionTask(task);
        return false;
    }

    Creature* movingCreature = getCreatureByID(movingCreatureId);
    if(!movingCreature || movingCreature->isRemoved() || movingCreature->getNoMove())
        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(player->getStepDuration(),
                boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos));

            player->setNextWalkActionTask(task);
            return true;
        }

        player->sendCancelMessage(RET_THEREISNOWAY);
        return false;
    }
 
Back
Top