Menu

#426 OnePlayerRoomDoor is closed after 3sec, even player is out

open
nobody
None
2010-12-14
2010-12-14
No

If you enter zone via OnePlayerRoomDoor and exit quickly before 3 seconds has passed, door is still open, exiting will try to open it but it is open already and then door will closed after 3 sec has passed. So we don't need periodic opener. Just check to see if zone is empty while closing.

[code]
public class OnePlayerRoomDoor extends Door {
public OnePlayerRoomDoor(final String clazz) {
super(clazz);
}

@Override
protected boolean isAllowed(final RPEntity user) {
final StendhalRPWorld world = SingletonRepository.getRPWorld();
final StendhalRPZone zone = world.getZone(super.getDestinationZone());
return (zone.getPlayerAndFriends().size() == 0);
}

@Override
protected void close() {
if (!isAllowed(null)) {
super.close();
}
}
}
[/code]

Discussion

  • Zlatan Momic

    Zlatan Momic - 2010-12-15

    I forgot that player can log-out while in room. So we still need periodic opener.
    And patch is just:

    ...
    @Override
    protected void close() {
    if (!isAllowed(null)) {
    super.close();
    }
    ...

     
  • Katie Russell

    Katie Russell - 2011-01-09

    Hi, I have tried applying your patch but am unclear exactly what it is supposed to fix. Could you explain exactly the bug and exactly how to recreate the bug you are describing?

     
  • Zlatan Momic

    Zlatan Momic - 2011-01-09

    Bug is just in correcting visual state of doors. If you enter int_ados_reverse_arrow and exit quickly after entering, you'll noticed that doors are visually closed although they are not closed and you can walk trough because room is empty.

    Problem: door will close them after period of 3 sec and you can get out of the room before that period expires.

    Soltion: So don't close the door if there is no one in the room:
    @Override
    protected void close() {
    if (!isAllowed(null)) {
    super.close();
    }

    Periodic opener is needed because if player logs out in that room door have to visually be open.

     

Anonymous
Anonymous

Add attachments
Cancel