Fix bugs with familiars

Fixed a bug where familiars would sometimes not respond to the 'Call' button
Fixed random events not spawning when standing in front of the Lumbridge furnace
Fixed incorrect restrictions on familiars and random events inside POHs
This commit is contained in:
Player Name 2024-10-06 11:03:33 +00:00 committed by Ryan
parent 0a89439c80
commit 4799176c14
2 changed files with 26 additions and 12 deletions

View file

@ -37,7 +37,7 @@ public final class HouseZone extends MapZone {
* Constructs the house zone object. * Constructs the house zone object.
*/ */
public HouseZone(HouseManager house) { public HouseZone(HouseManager house) {
super("poh-zone" + house, true, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.FOLLOWERS); super("poh-zone" + house, true);
this.house = house; this.house = house;
} }

View file

@ -312,23 +312,37 @@ object RegionManager {
if (owner == null || node == null) { if (owner == null || node == null) {
return null return null
} }
var destination: Location? = null
outer@ for (i in 0..7) { outer@ for (i in 0..7) {
val dir = Direction.get(i) val dir = Direction.get(i)
inner@for(j in 0 until node.size()) { var stepX = dir.stepX
val l = owner.location.transform(dir, j) var stepY = dir.stepY
// For objects that are larger than 1, the below corrects for the fact that their origin is on the SW tile
if (dir.stepX < 0) {
stepX -= (node.size() - 1)
}
if (dir.stepY < 0) {
stepY -= (node.size() - 1)
}
if (owner.size() > 1) { //e.g. if you used ::pnpc to morph yourself into a large NPC
if (dir.stepX > 0) {
stepX += (owner.size() - 1)
}
if (dir.stepY > 0) {
stepY += (owner.size() - 1)
}
}
val l = owner.location.transform(stepX, stepY, 0)
// Check if ALL target tiles are unclipped
for (x in 0 until node.size()) { for (x in 0 until node.size()) {
for (y in 0 until node.size()) { for (y in 0 until node.size()) {
if (isClipped(l.transform(x, y, 0))) { if (isClipped(l.transform(x, y, 0))) {
continue@inner continue@outer
} }
} }
} }
destination = l return l
break@outer
} }
} return null
return destination
} }
/** /**