More stability improvements
This commit is contained in:
@@ -7,6 +7,8 @@ import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.tools.RandomFunction
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import rs09.game.content.activity.pestcontrol.PestControlHelper.GATE_ENTRIES
|
||||
import rs09.game.content.activity.pestcontrol.PestControlHelper.getMyPestControlSession1
|
||||
import rs09.game.world.GameWorld
|
||||
@@ -100,7 +102,7 @@ class CombatState(val bot: PestControlTestBot) {
|
||||
|
||||
fun randomWalkTo(loc: Location, radius: Int) {
|
||||
if(!bot.walkingQueue.isMoving) {
|
||||
Executors.newSingleThreadExecutor().execute {
|
||||
GlobalScope.launch {
|
||||
var newloc = loc.transform(RandomFunction.random(radius, -radius),
|
||||
RandomFunction.random(radius, -radius), 0)
|
||||
walkToIterator(newloc)
|
||||
|
||||
+3
-1
@@ -7,6 +7,8 @@ import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.tools.RandomFunction
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import rs09.game.content.activity.pestcontrol.PestControlHelper.GATE_ENTRIES
|
||||
import rs09.game.content.activity.pestcontrol.PestControlHelper.getMyPestControlSession2
|
||||
import rs09.game.world.GameWorld
|
||||
@@ -99,7 +101,7 @@ class CombatStateIntermediate(val bot: PestControlTestBot2) {
|
||||
|
||||
fun randomWalkTo(loc: Location, radius: Int) {
|
||||
if(!bot.walkingQueue.isMoving) {
|
||||
Executors.newSingleThreadExecutor().execute {
|
||||
GlobalScope.launch {
|
||||
Thread.currentThread().name = "RandomWalkToIteratorBot"
|
||||
var newloc = loc.transform(RandomFunction.random(radius, -radius),
|
||||
RandomFunction.random(radius, -radius), 0)
|
||||
|
||||
@@ -8,6 +8,8 @@ import core.game.world.repository.InitializingNodeList
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.PlayerContext
|
||||
import core.net.packet.out.ClearMinimapFlag
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import rs09.game.world.repository.Repository
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.Executors
|
||||
@@ -58,7 +60,7 @@ class UpdateSequence
|
||||
fun run() {
|
||||
val latch = CountDownLatch(renderablePlayers.size)
|
||||
playersList!!.forEach(Consumer { player: Player ->
|
||||
EXECUTOR.execute {
|
||||
GlobalScope.launch {
|
||||
try {
|
||||
player.update()
|
||||
} catch (t: Throwable) {
|
||||
@@ -89,7 +91,6 @@ class UpdateSequence
|
||||
* Terminates the update sequence.
|
||||
*/
|
||||
fun terminate() {
|
||||
EXECUTOR.shutdown()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -103,11 +104,5 @@ class UpdateSequence
|
||||
@JvmStatic
|
||||
val renderablePlayers = InitializingNodeList<Player>()
|
||||
|
||||
/**
|
||||
* The executor used.
|
||||
*/
|
||||
@JvmStatic
|
||||
private val EXECUTOR = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user