DimitriKovarsk
New Member
- Joined
- Jun 19, 2016
- Messages
- 26
- Reaction score
- 0
Hello everyone.
Sometime ago, I became annoyed with my GOD character walking through NPCs, monsters and players.
Well, after some time, I found the line that made my GOD character walk through NPCs and monsters and set it to false. So my GOD won't walk through them.
But I don't seem to find the line that makes my GOD character don't walk through players.
What do I need to change to make it work?
Sometime ago, I became annoyed with my GOD character walking through NPCs, monsters and players.
Well, after some time, I found the line that made my GOD character walk through NPCs and monsters and set it to false. So my GOD won't walk through them.
But I don't seem to find the line that makes my GOD character don't walk through players.
What do I need to change to make it work?
Code:
bool Player::canWalkthrough(const Creature* creature) const
{
if (group->access || creature->isInGhostMode()) {
return true;
}
const Player* player = creature->getPlayer();
const Monster* monster = creature->getMonster();
if (monster) {
if (!monster->isPet()) {
return false;
}
return true;
}
if (player) {
const Tile* playerTile = player->getTile();
if (!playerTile || !playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
return false;
}
const Item* playerTileGround = playerTile->getGround();
if (!playerTileGround || !playerTileGround->hasWalkStack()) {
return false;
}
Player* thisPlayer = const_cast<Player*>(this);
if ((OTSYS_TIME() - lastWalkthroughAttempt) > 2000) {
thisPlayer->setLastWalkthroughAttempt(OTSYS_TIME());
return false;
}
if (creature->getPosition() != lastWalkthroughPosition) {
thisPlayer->setLastWalkthroughPosition(creature->getPosition());
return false;
}
thisPlayer->setLastWalkthroughPosition(creature->getPosition());
return true;
}
else {
return false;
}
}
bool Player::canWalkthroughEx(const Creature* creature) const
{
if (group->access) {
return false;
}
const Monster* monster = creature->getMonster();
if (monster) {
if (!monster->isPet()) {
return false;
}
return true;
}
const Player* player = creature->getPlayer();
if (player) {
const Tile* playerTile = player->getTile();
return playerTile && playerTile->hasFlag(TILESTATE_PROTECTIONZONE);
}
else {
return false;
}
}