mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-14 10:30:20 -07:00
Fixed combat movement regression that occurred when fighting large NPCs
This commit is contained in:
parent
6a3e91f13c
commit
98a5b95407
5 changed files with 10 additions and 14 deletions
|
|
@ -6,6 +6,7 @@ import core.game.interaction.IntType
|
||||||
|
|
||||||
class AttackListener : InteractionListener {
|
class AttackListener : InteractionListener {
|
||||||
override fun defineListeners() {
|
override fun defineListeners() {
|
||||||
|
flagInstant()
|
||||||
on(IntType.NPC, "attack"){ player, npc ->
|
on(IntType.NPC, "attack"){ player, npc ->
|
||||||
//Makes sure player uses correct attack styles for lumbridge dummies
|
//Makes sure player uses correct attack styles for lumbridge dummies
|
||||||
if (npc.id == 4474 && player.getSwingHandler(false).type != CombatStyle.MAGIC) {
|
if (npc.id == 4474 && player.getSwingHandler(false).type != CombatStyle.MAGIC) {
|
||||||
|
|
|
||||||
|
|
@ -255,14 +255,6 @@ object InteractionListeners {
|
||||||
|
|
||||||
val destOverride = getOverride(type.ordinal, id, option) ?: getOverride(type.ordinal,node.id) ?: getOverride(type.ordinal,option.toLowerCase())
|
val destOverride = getOverride(type.ordinal, id, option) ?: getOverride(type.ordinal,node.id) ?: getOverride(type.ordinal,option.toLowerCase())
|
||||||
|
|
||||||
|
|
||||||
if(option.toLowerCase() == "attack") //Attack needs special handling >.>
|
|
||||||
{
|
|
||||||
player.dispatch(InteractionEvent(node, option.toLowerCase()))
|
|
||||||
method.invoke(player, node)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if(type != IntType.ITEM && !isInstant(method)) {
|
if(type != IntType.ITEM && !isInstant(method)) {
|
||||||
if(player.locks.isMovementLocked) return false
|
if(player.locks.isMovementLocked) return false
|
||||||
player.pulseManager.run(object : MovementPulse(player, node, flag, destOverride) {
|
player.pulseManager.run(object : MovementPulse(player, node, flag, destOverride) {
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ public abstract class MovementPulse extends Pulse {
|
||||||
else if (loc == destination.getLocation()) loc = null;
|
else if (loc == destination.getLocation()) loc = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destination instanceof NPC)
|
if (destination instanceof NPC && mover.getProperties().getCombatPulse().getVictim() != destination)
|
||||||
loc = checkForEntityPathInterrupt(loc != null ? loc : destination.getLocation());
|
loc = checkForEntityPathInterrupt(loc != null ? loc : destination.getLocation());
|
||||||
|
|
||||||
if (interactLocation == null)
|
if (interactLocation == null)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import core.game.world.GameWorld
|
||||||
import core.game.world.update.flag.context.Animation
|
import core.game.world.update.flag.context.Animation
|
||||||
import core.tools.RandomFunction
|
import core.tools.RandomFunction
|
||||||
import core.api.*
|
import core.api.*
|
||||||
|
import core.game.interaction.DestinationFlag
|
||||||
import core.game.system.timer.impl.*
|
import core.game.system.timer.impl.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -352,6 +353,7 @@ class CombatPulse(
|
||||||
override fun start() {
|
override fun start() {
|
||||||
super.start()
|
super.start()
|
||||||
entity!!.face(victim)
|
entity!!.face(victim)
|
||||||
|
entity.walkingQueue.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stop() {
|
override fun stop() {
|
||||||
|
|
@ -466,7 +468,7 @@ class CombatPulse(
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
movement = object : MovementPulse(entity, null) {
|
movement = object : MovementPulse(entity, null, DestinationFlag.ENTITY) {
|
||||||
override fun pulse(): Boolean {
|
override fun pulse(): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import core.game.interaction.IntType
|
||||||
import core.game.interaction.InteractionListeners
|
import core.game.interaction.InteractionListeners
|
||||||
|
|
||||||
class ListenerTests : InteractionListener {
|
class ListenerTests : InteractionListener {
|
||||||
|
init {TestUtils.preTestSetup()}
|
||||||
@Test fun doubleDefinedListenerShouldThrowIllegalStateException() {
|
@Test fun doubleDefinedListenerShouldThrowIllegalStateException() {
|
||||||
on(0, IntType.ITEM, "touch") { _, _ -> return@on true}
|
on(0, IntType.ITEM, "touch") { _, _ -> return@on true}
|
||||||
Assertions.assertThrows(IllegalStateException::class.java) {
|
Assertions.assertThrows(IllegalStateException::class.java) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue