mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Greatly improved server performance by limiting the max wander radius return-to-spawn behavior applies to, and ensuring only one return-to-spawn movement pulse triggers at a time
This commit is contained in:
parent
6cf0e03177
commit
16a7640e56
2 changed files with 12 additions and 2 deletions
|
|
@ -447,10 +447,14 @@ public class NPC extends Entity {
|
||||||
if (
|
if (
|
||||||
!pathBoundMovement
|
!pathBoundMovement
|
||||||
&& walkRadius > 0
|
&& walkRadius > 0
|
||||||
|
&& walkRadius <= 20
|
||||||
&& !getLocation().withinDistance(getProperties().getSpawnLocation(), (int)(walkRadius * 1.5))
|
&& !getLocation().withinDistance(getProperties().getSpawnLocation(), (int)(walkRadius * 1.5))
|
||||||
&& !getAttribute("no-spawn-return", false)
|
&& !getAttribute("no-spawn-return", false)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
MovementPulse current = getAttribute("return-to-spawn-pulse");
|
||||||
|
if (current != null && current.isRunning()) return;
|
||||||
|
|
||||||
if(!isNeverWalks()){
|
if(!isNeverWalks()){
|
||||||
if(walkRadius == 0)
|
if(walkRadius == 0)
|
||||||
walkRadius = 3;
|
walkRadius = 3;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,14 @@ import org.junit.jupiter.api.Assertions
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class APITests {
|
class APITests {
|
||||||
val testPlayer = TestUtils.getMockPlayer("test")
|
var testPlayer: MockPlayer
|
||||||
val testPlayer2 = TestUtils.getMockPlayer("test2")
|
var testPlayer2: MockPlayer
|
||||||
|
|
||||||
|
init {
|
||||||
|
TestUtils.preTestSetup()
|
||||||
|
testPlayer = TestUtils.getMockPlayer("test")
|
||||||
|
testPlayer2 = TestUtils.getMockPlayer("test2")
|
||||||
|
}
|
||||||
|
|
||||||
@Test fun testIfaceSettings(){
|
@Test fun testIfaceSettings(){
|
||||||
var builder = IfaceSettingsBuilder()
|
var builder = IfaceSettingsBuilder()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue