• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

C++ TFS 1.2 The runes give Exhaust, which prevents me from pushing the player.

Darius93

Active Member
Joined
Oct 16, 2022
Messages
88
Reaction score
27
Hello!I have a problem where I can't push a player while using a rune.
Where can I reduce the exhaust for pushing the player in the source?
I’m using TFS 1.2 downgrade 8.0.

My function playerMoveCreature:
C++:
void Game::playerMoveCreature(Player* player, Creature* movingCreature, const Position& movingCreatureOrigPos, Tile* toTile)
{
    if (!player->canDoAction()) {
        uint32_t delay = player->getNextActionTime();
        SchedulerTask* task = createSchedulerTask(delay, std::bind(&Game::playerMoveCreatureByID,
            this, player->getID(), movingCreature->getID(), movingCreatureOrigPos, toTile->getPosition()));
        player->setNextActionTask(task);
        return;
    }

    player->setNextActionTask(nullptr);

    if (!Position::areInRange<1, 1, 0>(movingCreatureOrigPos, player->getPosition())) {
        //need to walk to the creature first before moving it
        std::forward_list<Direction> listDir;
        if (player->getPathTo(movingCreatureOrigPos, listDir, 0, 1, true, true)) {
            g_dispatcher.addTask(createTask(std::bind(&Game::playerAutoWalk,
                                            this, player->getID(), listDir)));
            SchedulerTask* task = createSchedulerTask(1500, std::bind(&Game::playerMoveCreatureByID, this,
                player->getID(), movingCreature->getID(), movingCreatureOrigPos, toTile->getPosition()));
            player->setNextWalkActionTask(task);
        } else {
            player->sendCancelMessage(RETURNVALUE_THEREISNOWAY);
        }
        return;
    }

    if ((!movingCreature->isPushable() && !player->hasFlag(PlayerFlag_CanPushAllCreatures)) ||
            (movingCreature->isInGhostMode() && !player->isAccessPlayer())) {
        player->sendCancelMessage(RETURNVALUE_NOTMOVEABLE);
        return;
    }

    //check throw distance
    const Position& movingCreaturePos = movingCreature->getPosition();
    const Position& toPos = toTile->getPosition();
    if ((Position::getDistanceX(movingCreaturePos, toPos) > movingCreature->getThrowRange()) || (Position::getDistanceY(movingCreaturePos, toPos) > movingCreature->getThrowRange()) || (Position::getDistanceZ(movingCreaturePos, toPos) * 4 > movingCreature->getThrowRange())) {
        player->sendCancelMessage(RETURNVALUE_DESTINATIONOUTOFREACH);
        return;
    }

    if (player != movingCreature) {
        if (toTile->hasFlag(TILESTATE_BLOCKPATH)) {
            player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
            return;
        } else if ((movingCreature->getZone() == ZONE_PROTECTION && !toTile->hasFlag(TILESTATE_PROTECTIONZONE)) || (movingCreature->getZone() == ZONE_NOPVP && !toTile->hasFlag(TILESTATE_NOPVPZONE))) {
            player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
            return;
        } else {
            if (CreatureVector* tileCreatures = toTile->getCreatures()) {
                for (Creature* tileCreature : *tileCreatures) {
                    if (!tileCreature->isInGhostMode()) {
                        player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
                        return;
                    }
                }
            }

            Npc* movingNpc = movingCreature->getNpc();
            if (movingNpc && !Spawns::isInZone(movingNpc->getMasterPos(), movingNpc->getMasterRadius(), toPos)) {
                player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
                return;
            }
        }
    }

The mere removal of this:
C++:
if (!player->canDoAction()) {

    uint32_t delay = player->getNextActionTime();

    SchedulerTask* task = createSchedulerTask(delay, std::bind(&Game::playerMoveCreatureByID,

        this, player->getID(), movingCreature->getID(), movingCreatureOrigPos, toTile->getPosition()));

    player->setNextActionTask(task);

    return;

}

Doesn't help because the exhaust still occurs.
And that's the effect I would like to achieve.


 
I trust there's an option in config.lua that allow players use runes, potions etc and change equipment or push other players simultaneously.
May be easier than editing source.
 
Back
Top