• 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+ issue with hangable items tfs 1.5 7.72

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
881
Solutions
7
Reaction score
122
Location
Brazil
YouTube
caruniawikibr
hello, I'm having problems with hangable items in tf 1.5 nekiro, if anyone has had this problem and knows how to fix it please help me. I had to edit position to +1 to be able to accept digonal from the wall. the problem occurs as follows.
the player being in a diagonal position cannot use the wall item. just facing or on the right side of the wall. If anyone knows how to fix it I'd be grateful.

I had to increase the position to +1, however that way I can use the item from behind the wall and I didn't want that to happen.

note that in the position I put +2, when the original it has a bug that does not accept in certain diagonal positions of the wall just facing the wall or on the right side (position of the player to the wall)

that was the way I found to use it, however I can use it in any position on the wall, including behind it.

if anyone has had this problem and can help. I thank
game.cpp
Lua:
if (player && tile->hasFlag(TILESTATE_SUPPORTS_HANGABLE)) {
            //do extra checks here if the thing is accessible
            if (thing && thing->getItem()) {
                if (tile->hasProperty(CONST_PROP_ISVERTICAL)) {
                    if (player->getPosition().x + 2 == tile->getPosition().x) {
                        thing = nullptr;
                    }
                } else { // horizontal
                    if (player->getPosition().y + 2 == tile->getPosition().y) {
                        thing = nullptr;
                    }
                }
            }
        }
        return thing;
    }
 
I use 7.72

if anyone can help me, the bug is summarized as follows. Trying to place hanging things diagonally doesn't work, only if you face the wall or in the upper position of the screen.
 
@bpm91
For me this works:
Thing* Game::internalGetThing(Player* player, const Position& pos, int32_t index, uint32_t spriteId, stackPosType_t type) const
C++:
if (player && tile->hasFlag(TILESTATE_SUPPORTS_HANGABLE)) {
    // do extra checks here if the thing is accessible
    if (thing && thing->getItem()) {
        if (tile->hasProperty(CONST_PROP_ISVERTICAL)) {
            if (player->getPosition().x + 1 == tile->getPosition().x) {
                thing = nullptr;
            }
        } else { // horizontal
            if (player->getPosition().y + 1 == tile->getPosition().y) {
                thing = nullptr;
            }
        }
    }
}
And in:
void Game::playerMoveItem(Player* player, const Position& fromPos, uint16_t spriteId, uint8_t fromStackPos, const Position& toPos, uint8_t count, Item* item, Cylinder* toCylinder)
C++:
// destination supports hangable objects so need to move there first
bool vertical = toCylinderTile->hasProperty(CONST_PROP_ISVERTICAL);
if (vertical) {
    if (playerPos.x + 1 == mapToPos.x) {
        player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
        return;
    }
} else { // horizontal
    if (playerPos.y + 1 == mapToPos.y) {
        player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
        return;
    }
}
 
Well hard to tell as I never checked how it works, I'd compile it on Windows and try to put there a breakpoint to see why it fails, hard to say as I never used this distro.
 
Last edited:
Back
Top