1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

[Solved] Small Characters not opening doors

Discussion in 'Modding Help' started by Frikman, Jul 26, 2016.

Thread Status:
Not open for further replies.
  1. Frikman

    Frikman Bison Rider

    Messages:
    162
    EDIT: Had to edit SwingDoor.as as well, I hate how things are linked to other things without saying it.

    Hi, after getting the playable chicken builder working right I've found yet another issue: he can't open doors or any door-related block. I tried setting DoorCommon.as like this, reducing it's required radius for opening
    Code:
    //common functionality for door-like objects
    
    bool canOpenDoor(CBlob@ this, CBlob@ blob)
    {
        if ((blob.getShape().getConsts().collidable) && //solid              // vvv lets see
                (blob.getRadius() > 2.0f) && //large
                (this.getTeamNum() == 255 || this.getTeamNum() == blob.getTeamNum()) &&
                (blob.hasTag("player") || blob.hasTag("vehicle"))) //tags that can open doors
        {
            Vec2f direction = Vec2f(0, -1);
            direction.RotateBy(this.getAngleDegrees());
    
            Vec2f doorpos = this.getPosition();
            Vec2f playerpos = blob.getPosition();
    
            if (blob.isKeyPressed(key_left) && playerpos.x > doorpos.x && Maths::Abs(playerpos.y - doorpos.y) < 11) return true;
            if (blob.isKeyPressed(key_right) && playerpos.x < doorpos.x && Maths::Abs(playerpos.y - doorpos.y) < 11) return true;
            if (blob.isKeyPressed(key_up) && playerpos.y > doorpos.y && Maths::Abs(playerpos.x - doorpos.x) < 11) return true;
            if (blob.isKeyPressed(key_down) && playerpos.y < doorpos.y && Maths::Abs(playerpos.x - doorpos.x) < 11) return true;
        }
        return false;
    }
    Yet it's just not working at all. Do I need to modify something else for it to work?
     
  2. makmoud98

    makmoud98 You are already DEAD Forum Moderator Staff Alumni Tester

    Messages:
    586
    locked thread, seemed to have solved his own issue
     
Thread Status:
Not open for further replies.