forked from 2009Scape/Server
Fixed Barbarian fishing spot issue preventing it from acquiring a new location
This commit is contained in:
parent
e95df88b0a
commit
c53784c721
1 changed files with 3 additions and 2 deletions
|
|
@ -53,8 +53,8 @@ fun getNewTTL(): Int{
|
|||
}
|
||||
|
||||
fun getNewLoc(): Location {
|
||||
val possibleLoc = locations.toTypedArray().toMutableList()
|
||||
possibleLoc.removeAll(usedLocations)
|
||||
val possibleLoc = ArrayList<Location>()
|
||||
for(loc in locations) if(usedLocations.contains(loc)) continue else possibleLoc.add(loc)
|
||||
val loc = possibleLoc.random()
|
||||
usedLocations.add(loc)
|
||||
return loc
|
||||
|
|
@ -76,6 +76,7 @@ class BarbFishingSpot(var loc: Location? = null, var ttl: Int) : NPC(1176){
|
|||
override fun handleTickActions() {
|
||||
if(location != loc) properties.teleportLocation = loc.also { ttl = getNewTTL() }
|
||||
if(ttl-- <= 0){
|
||||
usedLocations.remove(location)
|
||||
loc = getNewLoc()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue