Fixed doors getting stuck "in use"

This commit is contained in:
downthecrop
2022-02-23 13:21:50 +00:00
committed by Ryan
parent 49bf0d6ef5
commit 7850199016
3 changed files with 15 additions and 18 deletions
@@ -1,5 +1,6 @@
package core.game.content.global.action;
import api.ContentAPIKt;
import core.game.node.entity.Entity;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
@@ -98,16 +99,11 @@ public final class DoorActionHandler {
entity.lock(4);
final Location loc = entity.getLocation();
entity.addExtension(LogoutTask.class, new LocationLogoutTask(4, loc));
object.setCharge(IN_USE_CHARGE);
if (second != null) {
second.setCharge(IN_USE_CHARGE);
}
if (entity instanceof Player) {
((Player) entity).getAudioManager().send(new Audio(3419));
}
GameWorld.getPulser().submit(new Pulse(1) {
boolean opened = false;
@Override
public boolean pulse() {
if (!opened) {
@@ -115,12 +111,14 @@ public final class DoorActionHandler {
entity.getWalkingQueue().reset();
entity.getWalkingQueue().addPath(endLocation.getX(), endLocation.getY());
opened = true;
// Set the door in_use
object.setCharge(IN_USE_CHARGE);
if (second != null) {
second.setCharge(IN_USE_CHARGE);
}
return false;
}
object.setCharge(1000);
if (second != null) {
second.setCharge(1000);
}
if (entity instanceof Player) {
Player player = entity.asPlayer();
if (object.getId() == 2112 && player.getLocation().withinDistance(new Location(3046, 9756, 0), 10)) {
@@ -137,6 +135,12 @@ public final class DoorActionHandler {
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 1, 6);
}
}
// Reset door to inactive
object.setCharge(1000);
if (second != null) {
second.setCharge(1000);
}
return true;
}
});
@@ -83,12 +83,9 @@ public final class EdgevilleNodePlugin extends OptionHandler {
if (option.equalsIgnoreCase("open") && player.getLocation().getY() < 9918) {
player.getInterfaceManager().openComponent(382);
player.setAttribute("wildy_gate", node);
player.setAttribute("wildy_gate_loc",
Location.create(player.getLocation().getX(),player.getLocation().getY()+1));
}
else{ // Leaving the wilderness
DoorActionHandler.handleAutowalkDoor(player, (Scenery) node,
Location.create(player.getLocation().getX(),player.getLocation().getY()-1));
DoorActionHandler.handleAutowalkDoor(player, (Scenery) node);
}
}
return true;
@@ -74,13 +74,9 @@ public final class WildernessInterfacePlugin extends ComponentPlugin {
}
public static void handleGate(final Player player){
Scenery gate = player.getAttribute("wildy_gate");
Location endLocation = player.getAttribute("wildy_gate_loc");
// Cleanup
player.removeAttribute("wildy_gate");
player.removeAttribute("wildy_gate_loc");
// Move player through gate/door
DoorActionHandler.handleAutowalkDoor(player,gate,endLocation);
DoorActionHandler.handleAutowalkDoor(player,gate);
}
}