• 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!

TFS 1.X+ TFS 1.3 summons teleport to master

Mjmackan

Mapper ~ Writer
Joined
Jul 18, 2009
Messages
1,209
Solutions
8
Reaction score
90
Location
Sweden
As topic says, I found something in sources of latest tfs 1.3 repo but is it a borked function or what do these lines even do?
C++:
        if (!summons.empty()) {
            //check if any of our summons is out of range (+/- 2 floors or 30 tiles away)
            std::forward_list<Creature*> despawnList;
            for (Creature* summon : summons) {
                const Position& pos = summon->getPosition();
                if (Position::getDistanceZ(newPos, pos) > 2 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 30)) {
                    despawnList.push_front(summon);
                }
            }

            for (Creature* despawnCreature : despawnList) {
                g_game.removeCreature(despawnCreature, true);
            }
        }


I tried to change to internal teleport instead but without any success: (credits to: otservbr)
C++:
        if (!summons.empty()) {
            //check if any of our summons is out of range (+/- 2 floors or 30 tiles away)
            std::forward_list<Creature*> despawnList;
            for (Creature* summon : summons) {
                const Position& pos = summon->getPosition();
                if (Position::getDistanceZ(newPos, pos) > 1 || (std::max<int32_t>(Position::getDistanceX(newPos, pos), Position::getDistanceY(newPos, pos)) > 5)) {
                    g_game.internalTeleport(summon, summon->getMaster()->getPosition(), true);
                }
            }

            for (Creature* despawnCreature : despawnList) {
                g_game.removeCreature(despawnCreature, true);
            }
        }

On a sidenote, Is it possible to let summons walk in/out of PZ without an entire change of sources?
 
Top