fix remaining bugs

This commit is contained in:
Player Name 2026-06-28 07:49:29 +02:00
parent bd2887919b
commit d1550675bf
3 changed files with 12 additions and 8 deletions

View file

@ -173,18 +173,16 @@ class HazeelCultListeners : InteractionListener {
}
// chest with hazeel scroll. unlocks with key, opens, and contains the scroll.
onUseWith(IntType.SCENERY, CHEST_KEY, Scenery.CHEST_2856) { player, _, _ ->
onUseWith(IntType.SCENERY, CHEST_KEY, Scenery.CHEST_2856) { player, _, node ->
sendMessage(player, "You unlock the chest.")
animate(player, Animations.HUMAN_OPEN_CHEST_536)
addScenery(Scenery.CHEST_2857,CHEST_LOCATION, 2, 10)
removeScenery(core.game.node.scenery.Scenery(Scenery.CHEST_2856, Location(2565, 3272, 2)))
replaceScenery(node.asScenery(), Scenery.CHEST_2857, 20)
return@onUseWith true
}
// chest with hazeel scroll. unlocks with key, opens, and contains the scroll.
on(Scenery.CHEST_2857, IntType.SCENERY, "Close") { _, _ ->
addScenery(Scenery.CHEST_2856, CHEST_LOCATION, 2, 10)
removeScenery(core.game.node.scenery.Scenery(Scenery.CHEST_2857, CHEST_LOCATION))
on(Scenery.CHEST_2857, IntType.SCENERY, "Close") { _, node ->
replaceScenery(node.asScenery(), Scenery.CHEST_2856, 20)
return@on true
}

View file

@ -1059,5 +1059,4 @@ public class NPC extends Entity {
public void setNeverWalks(boolean neverWalks) {
this.neverWalks = neverWalks;
}
}

View file

@ -292,7 +292,14 @@ public final class DynamicRegion extends Region {
replacement.rebaseObjects();
replacement.rebuildFlags(orig);
replacement.syncFlagsToRegionManager();
replacement.getNpcs().addAll(orig.getNpcs()); //DO NOT create a copy npc, because it won't be initialized!
for (NPC npc : orig.getNpcs()) {
Location newLoc = currentBase.transform(npc.getLocation().getChunkOffsetX(), npc.getLocation().getChunkOffsetY(), 0);
NPC copy = NPC.create(npc.getId(), newLoc, npc.getDirection());
copy.setAggressive(npc.isAggressive());
copy.setRespawn(npc.isRespawn());
copy.setWalks(npc.isWalks());
copy.init();
}
}
@Override