- Joined
- Apr 1, 2012
- Messages
- 1,249
- Solutions
- 71
- Reaction score
- 621
- Location
- Hell
- GitHub
- idontreallywolf
TFS : 0.4 — 3777
VER: 8.6
#[UPDATED]
I was trying to fix player walktrough in pz, and it did work for a moment but i noticed a "bug".
First when two players are on screen, in pz, they can walk trough eachother just fine, except if one is standing on a depot-tile. However. When players go off screen (can't see eachother) and come back. They can't walk trough eachother. I asked cykotitan he mentioned that "sendCreatureImpassable" isn't called whenever necessary, and because of that the client is not able to determine if creature is walkable or not.
player.cpp ( canwalkTrough)
protocolgame.cpp ( sendCreatureImpassable() )
VER: 8.6
#[UPDATED]
I was trying to fix player walktrough in pz, and it did work for a moment but i noticed a "bug".
First when two players are on screen, in pz, they can walk trough eachother just fine, except if one is standing on a depot-tile. However. When players go off screen (can't see eachother) and come back. They can't walk trough eachother. I asked cykotitan he mentioned that "sendCreatureImpassable" isn't called whenever necessary, and because of that the client is not able to determine if creature is walkable or not.
player.cpp ( canwalkTrough)
C++:
bool Player::canWalkthrough(const Creature* creature) const
{
if(creature == this || creature->isWalkable() ||
(creature->getMaster() && creature->getMaster() != this && canWalkthrough(creature->getMaster())))
return true;
const Player* player = creature->getPlayer();
if(!player)
return false;
if(
(
(
(
(
player->getVocation()->isAttackable() &&
player->getLevel() < (uint32_t)g_config.getNumber(ConfigManager::PROTECTION_LEVEL)
)
|| (
player->getTile()->hasFlag(TILESTATE_PROTECTIONZONE) &&
!player->getTile()->hasFlag(TILESTATE_HOUSE)
)
)
) && player->getTile()->ground &&
player->getTile()->ground->getID() != 11062
) && (
!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)
|| player->getAccess() <= getAccess()
)
) return true;
return (player->isGhost() && getGhostAccess() < player->getGhostAccess())
|| (isGhost() && getGhostAccess() > player->getGhostAccess());
}
protocolgame.cpp ( sendCreatureImpassable() )
C++:
void ProtocolGame::sendCreatureImpassable(const Creature* creature)
{
// TODO: how this actually work...
if(!canSee(creature))
return;
NetworkMessage_ptr msg = getOutputBuffer();
if(msg)
{
TRACK_MESSAGE(msg);
msg->put<char>(0x92);
msg->put<uint32_t>(creature->getID());
msg->put<char>(!player->canWalkthrough(creature));
}
}
Last edited: