Changed the script processor code to no longer incorrectly close interfaces on SOFT queue scripts
Rewrote Jarvald
This commit is contained in:
@@ -1606,6 +1606,16 @@ fun closeTabInterface(player: Player) {
|
||||
player.interfaceManager.closeSingleTab()
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes any open (both chat and non-chat) interfaces for the player
|
||||
* @param player the player to close the interfaces for
|
||||
*/
|
||||
fun closeAllInterfaces(player: Player) {
|
||||
player.interfaceManager.close()
|
||||
player.interfaceManager.closeChatbox()
|
||||
player.dialogueInterpreter.close()
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a dialogue that uses the player's chathead.
|
||||
* @param player the player to send the dialogue to
|
||||
|
||||
@@ -46,6 +46,7 @@ class DropListener : InteractionListener {
|
||||
if (getAttribute(player, "equipLock:${node.id}", 0 ) > getWorldTicks())
|
||||
return false
|
||||
|
||||
closeAllInterfaces(player)
|
||||
queueScript (player, strength = QueueStrength.SOFT) {
|
||||
if (player.inventory.replace(null, item.slot) != item) return@queueScript stopExecuting(player)
|
||||
val droppedItem = item.dropItem
|
||||
|
||||
@@ -12,7 +12,6 @@ import core.game.world.map.Location
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.game.bots.AIPlayer
|
||||
import core.tools.Log
|
||||
import core.tools.SystemLogger
|
||||
import java.lang.Integer.max
|
||||
import java.io.*
|
||||
|
||||
@@ -97,11 +96,9 @@ class ScriptProcessor(val entity: Entity) {
|
||||
strongInQueue = hasTypeInQueue(QueueStrength.STRONG)
|
||||
softInQueue = hasTypeInQueue(QueueStrength.SOFT)
|
||||
|
||||
if (softInQueue || strongInQueue) {
|
||||
if (strongInQueue) {
|
||||
if (entity is Player) {
|
||||
entity.interfaceManager.close()
|
||||
entity.interfaceManager.closeChatbox()
|
||||
entity.dialogueInterpreter.close()
|
||||
closeAllInterfaces(entity)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +115,8 @@ class ScriptProcessor(val entity: Entity) {
|
||||
continue
|
||||
if (script.nextExecution > GameWorld.ticks)
|
||||
continue
|
||||
if ((script.strength == QueueStrength.STRONG || script.strength == QueueStrength.SOFT) && entity is Player) {
|
||||
entity.interfaceManager.close()
|
||||
entity.interfaceManager.closeChatbox()
|
||||
entity.dialogueInterpreter.close()
|
||||
if ((script.strength == QueueStrength.STRONG) && entity is Player) {
|
||||
closeAllInterfaces(entity)
|
||||
}
|
||||
script.nextExecution = GameWorld.ticks + 1
|
||||
val finished = executeScript(script)
|
||||
@@ -142,10 +137,8 @@ class ScriptProcessor(val entity: Entity) {
|
||||
}
|
||||
if (script.nextExecution > GameWorld.ticks)
|
||||
continue
|
||||
if ((script.strength == QueueStrength.STRONG || script.strength == QueueStrength.SOFT)) {
|
||||
entity.interfaceManager.close()
|
||||
entity.interfaceManager.closeChatbox()
|
||||
entity.dialogueInterpreter.close()
|
||||
if ((script.strength == QueueStrength.STRONG)) {
|
||||
closeAllInterfaces(entity)
|
||||
}
|
||||
script.nextExecution = GameWorld.ticks + 1
|
||||
val finished = executeScript(script)
|
||||
@@ -284,9 +277,7 @@ class ScriptProcessor(val entity: Entity) {
|
||||
return
|
||||
}
|
||||
if (strength == QueueStrength.STRONG && entity is Player) {
|
||||
entity.interfaceManager.close()
|
||||
entity.interfaceManager.closeChatbox()
|
||||
entity.dialogueInterpreter.close()
|
||||
closeAllInterfaces(entity)
|
||||
}
|
||||
script.nextExecution = max(GameWorld.ticks + 1, script.nextExecution)
|
||||
queue.add(script)
|
||||
|
||||
Reference in New Issue
Block a user